From 9dcfdcbcac9e63c231b1468156645029961bac5b Mon Sep 17 00:00:00 2001 From: sayakpaul Date: Thu, 9 Oct 2025 16:38:36 +0530 Subject: [PATCH 1/5] xfail more incorrect transformer imports. --- tests/pipelines/test_pipelines.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/pipelines/test_pipelines.py b/tests/pipelines/test_pipelines.py index 5b86423553c5..2db9c6635010 100644 --- a/tests/pipelines/test_pipelines.py +++ b/tests/pipelines/test_pipelines.py @@ -600,6 +600,7 @@ def test_download_legacy_variants_with_sharded_ckpts_raises_warning(self): ) assert deprecated_warning_msg in str(cap_logger), "Deprecation warning not found in logs" + @pytest.mark.xfail(condition=is_transformers_version(">", "4.56.2"), reason="Some import error", strict=True) def test_download_safetensors_only_variant_exists_for_model(self): variant = None use_safetensors = True @@ -658,6 +659,7 @@ def test_download_bin_only_variant_exists_for_model(self): # https://huggingface.co/hf-internal-testing/stable-diffusion-broken-variants/tree/main/unet assert len(files) == 15, f"We should only download 15 files, not {len(files)}" + @pytest.mark.xfail(condition=is_transformers_version(">", "4.56.2"), reason="Some import error", strict=True) def test_download_safetensors_variant_does_not_exist_for_model(self): variant = "no_ema" use_safetensors = True @@ -1890,6 +1892,7 @@ def test_dduf_raises_error_with_connected_pipeline(self): "DDUF/tiny-flux-dev-pipe-dduf", dduf_file="fluxpipeline.dduf", load_connected_pipeline=True ) + @pytest.mark.xfail(condition=is_transformers_version(">", "4.56.2"), reason="Some import error", strict=True) def test_wrong_model(self): tokenizer = CLIPTokenizer.from_pretrained("hf-internal-testing/tiny-random-clip") with self.assertRaises(ValueError) as error_context: From 8a0d1fa48ccaf97511bb5084760d5f74cfc6d0f4 Mon Sep 17 00:00:00 2001 From: sayakpaul Date: Tue, 14 Oct 2025 11:07:24 +0530 Subject: [PATCH 2/5] xfail more. --- tests/pipelines/test_pipelines.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/pipelines/test_pipelines.py b/tests/pipelines/test_pipelines.py index 2db9c6635010..6fbc950cd743 100644 --- a/tests/pipelines/test_pipelines.py +++ b/tests/pipelines/test_pipelines.py @@ -630,6 +630,7 @@ def test_download_safetensors_only_variant_exists_for_model(self): # https://huggingface.co/hf-internal-testing/stable-diffusion-broken-variants/tree/main/unet assert len(files) == 15, f"We should only download 15 files, not {len(files)}" + @pytest.mark.xfail(condition=is_transformers_version(">", "4.56.2"), reason="Some import error", strict=True) def test_download_bin_only_variant_exists_for_model(self): variant = None use_safetensors = False @@ -676,6 +677,7 @@ def test_download_safetensors_variant_does_not_exist_for_model(self): assert "Could not find the necessary `safetensors` weights" in str(error_context.exception) + @pytest.mark.xfail(condition=is_transformers_version(">", "4.56.2"), reason="Some import error", strict=True) def test_download_bin_variant_does_not_exist_for_model(self): variant = "no_ema" use_safetensors = False From 439d03977f9db50e2490aacb28f3c99b7d4ce506 Mon Sep 17 00:00:00 2001 From: sayakpaul Date: Tue, 14 Oct 2025 11:51:47 +0530 Subject: [PATCH 3/5] up --- tests/pipelines/test_pipelines.py | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/tests/pipelines/test_pipelines.py b/tests/pipelines/test_pipelines.py index 6fbc950cd743..f4f3447fa918 100644 --- a/tests/pipelines/test_pipelines.py +++ b/tests/pipelines/test_pipelines.py @@ -28,7 +28,6 @@ import numpy as np import PIL.Image -import pytest import requests_mock import safetensors.torch import torch @@ -63,7 +62,7 @@ ) from diffusers.pipelines.pipeline_utils import _get_pipeline_class from diffusers.schedulers.scheduling_utils import SCHEDULER_CONFIG_NAME -from diffusers.utils import CONFIG_NAME, WEIGHTS_NAME, is_transformers_version +from diffusers.utils import CONFIG_NAME, WEIGHTS_NAME from diffusers.utils.torch_utils import is_compiled_module from ..testing_utils import ( @@ -582,7 +581,6 @@ def test_download_variants_with_sharded_checkpoints(self): assert not any(f.endswith(unexpected_ext) for f in files) assert all(variant in f for f in model_files if f.endswith(model_ext) and variant is not None) - @pytest.mark.xfail(condition=is_transformers_version(">", "4.56.2"), reason="Some import error", strict=True) def test_download_legacy_variants_with_sharded_ckpts_raises_warning(self): repo_id = "hf-internal-testing/tiny-stable-diffusion-pipe-variants-all-kinds" logger = logging.get_logger("diffusers.pipelines.pipeline_utils") @@ -600,7 +598,6 @@ def test_download_legacy_variants_with_sharded_ckpts_raises_warning(self): ) assert deprecated_warning_msg in str(cap_logger), "Deprecation warning not found in logs" - @pytest.mark.xfail(condition=is_transformers_version(">", "4.56.2"), reason="Some import error", strict=True) def test_download_safetensors_only_variant_exists_for_model(self): variant = None use_safetensors = True @@ -630,7 +627,7 @@ def test_download_safetensors_only_variant_exists_for_model(self): # https://huggingface.co/hf-internal-testing/stable-diffusion-broken-variants/tree/main/unet assert len(files) == 15, f"We should only download 15 files, not {len(files)}" - @pytest.mark.xfail(condition=is_transformers_version(">", "4.56.2"), reason="Some import error", strict=True) + # def test_download_bin_only_variant_exists_for_model(self): variant = None use_safetensors = False @@ -660,7 +657,6 @@ def test_download_bin_only_variant_exists_for_model(self): # https://huggingface.co/hf-internal-testing/stable-diffusion-broken-variants/tree/main/unet assert len(files) == 15, f"We should only download 15 files, not {len(files)}" - @pytest.mark.xfail(condition=is_transformers_version(">", "4.56.2"), reason="Some import error", strict=True) def test_download_safetensors_variant_does_not_exist_for_model(self): variant = "no_ema" use_safetensors = True @@ -677,7 +673,6 @@ def test_download_safetensors_variant_does_not_exist_for_model(self): assert "Could not find the necessary `safetensors` weights" in str(error_context.exception) - @pytest.mark.xfail(condition=is_transformers_version(">", "4.56.2"), reason="Some import error", strict=True) def test_download_bin_variant_does_not_exist_for_model(self): variant = "no_ema" use_safetensors = False @@ -693,7 +688,6 @@ def test_download_bin_variant_does_not_exist_for_model(self): ) assert "Error no file name" in str(error_context.exception) - @pytest.mark.xfail(condition=is_transformers_version(">", "4.56.2"), reason="Some import error", strict=True) def test_local_save_load_index(self): prompt = "hello" for variant in [None, "fp16"]: @@ -1588,7 +1582,6 @@ def test_save_safe_serialization(self): assert pipeline.scheduler is not None assert pipeline.feature_extractor is not None - @pytest.mark.xfail(condition=is_transformers_version(">", "4.56.2"), reason="Some import error", strict=True) def test_no_pytorch_download_when_doing_safetensors(self): # by default we don't download with tempfile.TemporaryDirectory() as tmpdirname: @@ -1608,7 +1601,6 @@ def test_no_pytorch_download_when_doing_safetensors(self): # pytorch does not assert not os.path.exists(os.path.join(path, "diffusion_pytorch_model.bin")) - @pytest.mark.xfail(condition=is_transformers_version(">", "4.56.2"), reason="Some import error", strict=True) def test_no_safetensors_download_when_doing_pytorch(self): use_safetensors = False @@ -1894,7 +1886,6 @@ def test_dduf_raises_error_with_connected_pipeline(self): "DDUF/tiny-flux-dev-pipe-dduf", dduf_file="fluxpipeline.dduf", load_connected_pipeline=True ) - @pytest.mark.xfail(condition=is_transformers_version(">", "4.56.2"), reason="Some import error", strict=True) def test_wrong_model(self): tokenizer = CLIPTokenizer.from_pretrained("hf-internal-testing/tiny-random-clip") with self.assertRaises(ValueError) as error_context: From 62dff867c5de97fcb7bfc6fac7d12d9038fbe68d Mon Sep 17 00:00:00 2001 From: sayakpaul Date: Tue, 14 Oct 2025 13:51:50 +0530 Subject: [PATCH 4/5] up --- tests/pipelines/test_pipelines.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/pipelines/test_pipelines.py b/tests/pipelines/test_pipelines.py index f4f3447fa918..b748ebfd9318 100644 --- a/tests/pipelines/test_pipelines.py +++ b/tests/pipelines/test_pipelines.py @@ -28,6 +28,7 @@ import numpy as np import PIL.Image +import pytest import requests_mock import safetensors.torch import torch @@ -62,7 +63,7 @@ ) from diffusers.pipelines.pipeline_utils import _get_pipeline_class from diffusers.schedulers.scheduling_utils import SCHEDULER_CONFIG_NAME -from diffusers.utils import CONFIG_NAME, WEIGHTS_NAME +from diffusers.utils import CONFIG_NAME, WEIGHTS_NAME, is_transformers_version from diffusers.utils.torch_utils import is_compiled_module from ..testing_utils import ( @@ -581,6 +582,7 @@ def test_download_variants_with_sharded_checkpoints(self): assert not any(f.endswith(unexpected_ext) for f in files) assert all(variant in f for f in model_files if f.endswith(model_ext) and variant is not None) + @pytest.mark.xfail(condition=is_transformers_version(">", "4.56.2"), reason="Some import error", strict=False) def test_download_legacy_variants_with_sharded_ckpts_raises_warning(self): repo_id = "hf-internal-testing/tiny-stable-diffusion-pipe-variants-all-kinds" logger = logging.get_logger("diffusers.pipelines.pipeline_utils") @@ -627,7 +629,6 @@ def test_download_safetensors_only_variant_exists_for_model(self): # https://huggingface.co/hf-internal-testing/stable-diffusion-broken-variants/tree/main/unet assert len(files) == 15, f"We should only download 15 files, not {len(files)}" - # def test_download_bin_only_variant_exists_for_model(self): variant = None use_safetensors = False @@ -673,6 +674,7 @@ def test_download_safetensors_variant_does_not_exist_for_model(self): assert "Could not find the necessary `safetensors` weights" in str(error_context.exception) + @pytest.mark.xfail(condition=is_transformers_version(">", "4.56.2"), reason="Some import error", strict=False) def test_download_bin_variant_does_not_exist_for_model(self): variant = "no_ema" use_safetensors = False @@ -688,6 +690,7 @@ def test_download_bin_variant_does_not_exist_for_model(self): ) assert "Error no file name" in str(error_context.exception) + @pytest.mark.xfail(condition=is_transformers_version(">", "4.56.2"), reason="Some import error", strict=False) def test_local_save_load_index(self): prompt = "hello" for variant in [None, "fp16"]: @@ -1582,6 +1585,7 @@ def test_save_safe_serialization(self): assert pipeline.scheduler is not None assert pipeline.feature_extractor is not None + @pytest.mark.xfail(condition=is_transformers_version(">", "4.56.2"), reason="Some import error", strict=False) def test_no_pytorch_download_when_doing_safetensors(self): # by default we don't download with tempfile.TemporaryDirectory() as tmpdirname: @@ -1601,6 +1605,7 @@ def test_no_pytorch_download_when_doing_safetensors(self): # pytorch does not assert not os.path.exists(os.path.join(path, "diffusion_pytorch_model.bin")) + @pytest.mark.xfail(condition=is_transformers_version(">", "4.56.2"), reason="Some import error", strict=False) def test_no_safetensors_download_when_doing_pytorch(self): use_safetensors = False @@ -1886,6 +1891,7 @@ def test_dduf_raises_error_with_connected_pipeline(self): "DDUF/tiny-flux-dev-pipe-dduf", dduf_file="fluxpipeline.dduf", load_connected_pipeline=True ) + @pytest.mark.xfail(condition=is_transformers_version(">", "4.56.2"), reason="Some import error", strict=False) def test_wrong_model(self): tokenizer = CLIPTokenizer.from_pretrained("hf-internal-testing/tiny-random-clip") with self.assertRaises(ValueError) as error_context: From f9194f61087f23e928dbd2af99174fa728fc291b Mon Sep 17 00:00:00 2001 From: sayakpaul Date: Fri, 17 Oct 2025 10:14:11 +0530 Subject: [PATCH 5/5] up --- tests/pipelines/test_pipelines.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/pipelines/test_pipelines.py b/tests/pipelines/test_pipelines.py index b748ebfd9318..a17db3ff0c5a 100644 --- a/tests/pipelines/test_pipelines.py +++ b/tests/pipelines/test_pipelines.py @@ -629,6 +629,7 @@ def test_download_safetensors_only_variant_exists_for_model(self): # https://huggingface.co/hf-internal-testing/stable-diffusion-broken-variants/tree/main/unet assert len(files) == 15, f"We should only download 15 files, not {len(files)}" + @pytest.mark.xfail(condition=is_transformers_version(">", "4.56.2"), reason="Some import error", strict=False) def test_download_bin_only_variant_exists_for_model(self): variant = None use_safetensors = False