2828
2929import numpy as np
3030import PIL .Image
31+ import pytest
3132import requests_mock
3233import safetensors .torch
3334import torch
6263)
6364from diffusers .pipelines .pipeline_utils import _get_pipeline_class
6465from diffusers .schedulers .scheduling_utils import SCHEDULER_CONFIG_NAME
65- from diffusers .utils import CONFIG_NAME , WEIGHTS_NAME
66+ from diffusers .utils import CONFIG_NAME , WEIGHTS_NAME , is_transformers_version
6667from diffusers .utils .torch_utils import is_compiled_module
6768
6869from ..testing_utils import (
@@ -581,6 +582,7 @@ def test_download_variants_with_sharded_checkpoints(self):
581582 assert not any (f .endswith (unexpected_ext ) for f in files )
582583 assert all (variant in f for f in model_files if f .endswith (model_ext ) and variant is not None )
583584
585+ @pytest .mark .xfail (condition = is_transformers_version (">" , "4.56.2" ), reason = "Some import error" , strict = False )
584586 def test_download_legacy_variants_with_sharded_ckpts_raises_warning (self ):
585587 repo_id = "hf-internal-testing/tiny-stable-diffusion-pipe-variants-all-kinds"
586588 logger = logging .get_logger ("diffusers.pipelines.pipeline_utils" )
@@ -627,7 +629,6 @@ def test_download_safetensors_only_variant_exists_for_model(self):
627629 # https://huggingface.co/hf-internal-testing/stable-diffusion-broken-variants/tree/main/unet
628630 assert len (files ) == 15 , f"We should only download 15 files, not { len (files )} "
629631
630- #
631632 def test_download_bin_only_variant_exists_for_model (self ):
632633 variant = None
633634 use_safetensors = False
@@ -673,6 +674,7 @@ def test_download_safetensors_variant_does_not_exist_for_model(self):
673674
674675 assert "Could not find the necessary `safetensors` weights" in str (error_context .exception )
675676
677+ @pytest .mark .xfail (condition = is_transformers_version (">" , "4.56.2" ), reason = "Some import error" , strict = False )
676678 def test_download_bin_variant_does_not_exist_for_model (self ):
677679 variant = "no_ema"
678680 use_safetensors = False
@@ -688,6 +690,7 @@ def test_download_bin_variant_does_not_exist_for_model(self):
688690 )
689691 assert "Error no file name" in str (error_context .exception )
690692
693+ @pytest .mark .xfail (condition = is_transformers_version (">" , "4.56.2" ), reason = "Some import error" , strict = False )
691694 def test_local_save_load_index (self ):
692695 prompt = "hello"
693696 for variant in [None , "fp16" ]:
@@ -1582,6 +1585,7 @@ def test_save_safe_serialization(self):
15821585 assert pipeline .scheduler is not None
15831586 assert pipeline .feature_extractor is not None
15841587
1588+ @pytest .mark .xfail (condition = is_transformers_version (">" , "4.56.2" ), reason = "Some import error" , strict = False )
15851589 def test_no_pytorch_download_when_doing_safetensors (self ):
15861590 # by default we don't download
15871591 with tempfile .TemporaryDirectory () as tmpdirname :
@@ -1601,6 +1605,7 @@ def test_no_pytorch_download_when_doing_safetensors(self):
16011605 # pytorch does not
16021606 assert not os .path .exists (os .path .join (path , "diffusion_pytorch_model.bin" ))
16031607
1608+ @pytest .mark .xfail (condition = is_transformers_version (">" , "4.56.2" ), reason = "Some import error" , strict = False )
16041609 def test_no_safetensors_download_when_doing_pytorch (self ):
16051610 use_safetensors = False
16061611
@@ -1886,6 +1891,7 @@ def test_dduf_raises_error_with_connected_pipeline(self):
18861891 "DDUF/tiny-flux-dev-pipe-dduf" , dduf_file = "fluxpipeline.dduf" , load_connected_pipeline = True
18871892 )
18881893
1894+ @pytest .mark .xfail (condition = is_transformers_version (">" , "4.56.2" ), reason = "Some import error" , strict = False )
18891895 def test_wrong_model (self ):
18901896 tokenizer = CLIPTokenizer .from_pretrained ("hf-internal-testing/tiny-random-clip" )
18911897 with self .assertRaises (ValueError ) as error_context :
0 commit comments