Skip to content

Commit 08c72e3

Browse files
TST Skip failing Diffusers tests until v0.40.0 (#3394)
Due to a recent change in huggingface-hub, loading Diffusers pipelines in offline mode can fail. Since the PEFT caching mechanism works by setting offline mode, several PEFT tests are affected by this. There is a fix on the way in Diffusers, but there won't be a patch release: huggingface/diffusers#14118 Therefore, we skip these tests for now. Once Diffusers 0.40.0 releases, the tests will run again, but we can also remove the skipping logic completely.
1 parent 74481e7 commit 08c72e3

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

tests/test_stablediffusion.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
import copy
1616
from dataclasses import asdict, replace
1717

18+
import diffusers
1819
import numpy as np
20+
import packaging.version
1921
import pytest
2022
import torch
2123
from diffusers import AutoModel, StableDiffusionPipeline
@@ -39,6 +41,10 @@
3941
from .testing_utils import hub_online_once, set_init_weights_false, temp_seed
4042

4143

44+
# TODO: remove once Diffusers 0.40 is released
45+
is_diffusers_ge_v040 = packaging.version.parse(diffusers.__version__) >= packaging.version.parse("0.40.0.dev0")
46+
47+
4248
PEFT_DIFFUSERS_SD_MODELS_TO_TEST = ["hf-internal-testing/tiny-sd-pipe"]
4349
DIFFUSERS_CONFIGS = [
4450
(
@@ -344,6 +350,9 @@ def test_add_weighted_adapter_base_unchanged(self, model_id, config_cls, config_
344350
@pytest.mark.parametrize("model_id", PEFT_DIFFUSERS_SD_MODELS_TO_TEST)
345351
@pytest.mark.parametrize("config_cls,config_kwargs", DIFFUSERS_CONFIGS)
346352
def test_disable_adapter(self, model_id, config_cls, config_kwargs):
353+
# TODO: remove once Diffusers 0.40 is released
354+
if not is_diffusers_ge_v040:
355+
pytest.skip("This test fails with Diffusers < 0.40 due to a change in huggingface_hub")
347356
config_kwargs = set_init_weights_false(config_cls, config_kwargs)
348357
self._test_disable_adapter(model_id, config_cls, config_kwargs)
349358

tests/test_tuners_utils.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
import re
1616
from copy import deepcopy
1717

18+
import diffusers
19+
import packaging.version
1820
import pytest
1921
import torch
2022
from diffusers import StableDiffusionPipeline
@@ -59,6 +61,9 @@
5961
from .testing_utils import hub_online_once, require_bitsandbytes, require_non_cpu
6062

6163

64+
# TODO: remove once Diffusers 0.40 is released
65+
is_diffusers_ge_v040 = packaging.version.parse(diffusers.__version__) >= packaging.version.parse("0.40.0.dev0")
66+
6267
# Implements tests for regex matching logic common for all BaseTuner subclasses, and
6368
# tests for correct behaviour with different config kwargs for BaseTuners (Ex: feedforward for IA3, etc) and
6469
# tests for utility function to include all linear layers
@@ -340,6 +345,10 @@ def test_maybe_include_all_linear_layers_internals(self, initial_target_modules,
340345
assert new_config.target_modules == expected_target_modules
341346

342347
def test_maybe_include_all_linear_layers_diffusion(self):
348+
# TODO: remove once Diffusers 0.40 is released
349+
if not is_diffusers_ge_v040:
350+
pytest.skip("This test fails with Diffusers < 0.40 due to a change in huggingface_hub")
351+
343352
model_id = "hf-internal-testing/tiny-sd-pipe"
344353
with hub_online_once(model_id):
345354
model = StableDiffusionPipeline.from_pretrained(model_id)

0 commit comments

Comments
 (0)