From 710e18b95134af58849bb64c6d9bc7d15ad80c72 Mon Sep 17 00:00:00 2001 From: DN6 Date: Thu, 11 Sep 2025 12:53:58 +0530 Subject: [PATCH 1/5] update --- .../single_file/single_file_testing_utils.py | 73 +++++++++++++++++++ tests/single_file/test_lumina2_transformer.py | 28 +------ .../test_model_autoencoder_dc_single_file.py | 31 +------- .../test_model_controlnet_single_file.py | 32 +------- ...test_model_flux_transformer_single_file.py | 27 +------ .../single_file/test_model_vae_single_file.py | 31 +------- .../test_model_wan_autoencoder_single_file.py | 31 +------- ...est_model_wan_transformer3d_single_file.py | 57 ++------------- tests/single_file/test_sana_transformer.py | 28 +------ 9 files changed, 96 insertions(+), 242 deletions(-) diff --git a/tests/single_file/single_file_testing_utils.py b/tests/single_file/single_file_testing_utils.py index 3510d3371ca5..58cbd7ada57b 100644 --- a/tests/single_file/single_file_testing_utils.py +++ b/tests/single_file/single_file_testing_utils.py @@ -1,3 +1,4 @@ +import gc import tempfile from io import BytesIO @@ -9,7 +10,9 @@ from diffusers.models.attention_processor import AttnProcessor from ..testing_utils import ( + backend_empty_cache, numpy_cosine_similarity_distance, + require_torch_accelerator, torch_device, ) @@ -47,6 +50,76 @@ def download_diffusers_config(repo_id, tmpdir): return path +@require_torch_accelerator +class SingleFileModelTesterMixin: + def setUp(self): + super().setUp() + gc.collect() + backend_empty_cache(torch_device) + + def tearDown(self): + super().tearDown() + gc.collect() + backend_empty_cache(torch_device) + + def test_single_file_model_config(self): + pretrained_kwargs = {} + single_file_kwargs = {} + + if hasattr(self, "subfolder") and self.subfolder: + pretrained_kwargs["subfolder"] = self.subfolder + + if hasattr(self, "torch_dtype") and self.torch_dtype: + pretrained_kwargs["torch_dtype"] = self.torch_dtype + single_file_kwargs["torch_dtype"] = self.torch_dtype + + model = self.model_class.from_pretrained(self.repo_id, **pretrained_kwargs) + model_single_file = self.model_class.from_single_file(self.ckpt_path, **single_file_kwargs) + + PARAMS_TO_IGNORE = ["torch_dtype", "_name_or_path", "_use_default_values", "_diffusers_version"] + for param_name, param_value in model_single_file.config.items(): + if param_name in PARAMS_TO_IGNORE: + continue + assert model.config[param_name] == param_value, ( + f"{param_name} differs between pretrained loading and single file loading" + ) + + def test_single_file_model_parameters(self): + pretrained_kwargs = {} + single_file_kwargs = {} + + if hasattr(self, "subfolder") and self.subfolder: + pretrained_kwargs["subfolder"] = self.subfolder + + if hasattr(self, "torch_dtype") and self.torch_dtype: + pretrained_kwargs["torch_dtype"] = self.torch_dtype + single_file_kwargs["torch_dtype"] = self.torch_dtype + + model = self.model_class.from_pretrained(self.repo_id, **pretrained_kwargs) + model_single_file = self.model_class.from_single_file(self.ckpt_path, **single_file_kwargs) + + state_dict = model.state_dict() + state_dict_single_file = model_single_file.state_dict() + + assert set(state_dict.keys()) == set(state_dict_single_file.keys()), ( + "Model parameters keys differ between pretrained and single file loading" + ) + + for key in state_dict.keys(): + param = state_dict[key] + param_single_file = state_dict_single_file[key] + + assert param.shape == param_single_file.shape, ( + f"Parameter shape mismatch for {key}: " + f"pretrained {param.shape} vs single file {param_single_file.shape}" + ) + + assert torch.allclose(param, param_single_file, rtol=1e-5, atol=1e-5), ( + f"Parameter values differ for {key}: " + f"max difference {torch.max(torch.abs(param - param_single_file)).item()}" + ) + + class SDSingleFileTesterMixin: single_file_kwargs = {} diff --git a/tests/single_file/test_lumina2_transformer.py b/tests/single_file/test_lumina2_transformer.py index 99d9b71395c6..2984776df51a 100644 --- a/tests/single_file/test_lumina2_transformer.py +++ b/tests/single_file/test_lumina2_transformer.py @@ -23,16 +23,15 @@ from ..testing_utils import ( backend_empty_cache, enable_full_determinism, - require_torch_accelerator, torch_device, ) +from .single_file_testing_utils import SingleFileModelTesterMixin enable_full_determinism() -@require_torch_accelerator -class Lumina2Transformer2DModelSingleFileTests(unittest.TestCase): +class Lumina2Transformer2DModelSingleFileTests(SingleFileModelTesterMixin, unittest.TestCase): model_class = Lumina2Transformer2DModel ckpt_path = "https://huggingface.co/Comfy-Org/Lumina_Image_2.0_Repackaged/blob/main/split_files/diffusion_models/lumina_2_model_bf16.safetensors" alternate_keys_ckpt_paths = [ @@ -40,28 +39,7 @@ class Lumina2Transformer2DModelSingleFileTests(unittest.TestCase): ] repo_id = "Alpha-VLLM/Lumina-Image-2.0" - - def setUp(self): - super().setUp() - gc.collect() - backend_empty_cache(torch_device) - - def tearDown(self): - super().tearDown() - gc.collect() - backend_empty_cache(torch_device) - - def test_single_file_components(self): - model = self.model_class.from_pretrained(self.repo_id, subfolder="transformer") - model_single_file = self.model_class.from_single_file(self.ckpt_path) - - PARAMS_TO_IGNORE = ["torch_dtype", "_name_or_path", "_use_default_values", "_diffusers_version"] - for param_name, param_value in model_single_file.config.items(): - if param_name in PARAMS_TO_IGNORE: - continue - assert model.config[param_name] == param_value, ( - f"{param_name} differs between single file loading and pretrained loading" - ) + subfolder = "transformer" def test_checkpoint_loading(self): for ckpt_path in self.alternate_keys_ckpt_paths: diff --git a/tests/single_file/test_model_autoencoder_dc_single_file.py b/tests/single_file/test_model_autoencoder_dc_single_file.py index 5195f8e52f8d..d174a8a2d681 100644 --- a/tests/single_file/test_model_autoencoder_dc_single_file.py +++ b/tests/single_file/test_model_autoencoder_dc_single_file.py @@ -13,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import gc import unittest import torch @@ -23,38 +22,24 @@ ) from ..testing_utils import ( - backend_empty_cache, enable_full_determinism, load_hf_numpy, numpy_cosine_similarity_distance, - require_torch_accelerator, - slow, torch_device, ) +from .single_file_testing_utils import SingleFileModelTesterMixin enable_full_determinism() -@slow -@require_torch_accelerator -class AutoencoderDCSingleFileTests(unittest.TestCase): +class AutoencoderDCSingleFileTests(SingleFileModelTesterMixin, unittest.TestCase): model_class = AutoencoderDC ckpt_path = "https://huggingface.co/mit-han-lab/dc-ae-f32c32-sana-1.0/blob/main/model.safetensors" repo_id = "mit-han-lab/dc-ae-f32c32-sana-1.0-diffusers" main_input_name = "sample" base_precision = 1e-2 - def setUp(self): - super().setUp() - gc.collect() - backend_empty_cache(torch_device) - - def tearDown(self): - super().tearDown() - gc.collect() - backend_empty_cache(torch_device) - def get_file_format(self, seed, shape): return f"gaussian_noise_s={seed}_shape={'_'.join([str(s) for s in shape])}.npy" @@ -80,18 +65,6 @@ def test_single_file_inference_same_as_pretrained(self): assert numpy_cosine_similarity_distance(output_slice_1, output_slice_2) < 1e-4 - def test_single_file_components(self): - model = self.model_class.from_pretrained(self.repo_id) - model_single_file = self.model_class.from_single_file(self.ckpt_path) - - PARAMS_TO_IGNORE = ["torch_dtype", "_name_or_path", "_use_default_values", "_diffusers_version"] - for param_name, param_value in model_single_file.config.items(): - if param_name in PARAMS_TO_IGNORE: - continue - assert model.config[param_name] == param_value, ( - f"{param_name} differs between pretrained loading and single file loading" - ) - def test_single_file_in_type_variant_components(self): # `in` variant checkpoints require passing in a `config` parameter # in order to set the scaling factor correctly. diff --git a/tests/single_file/test_model_controlnet_single_file.py b/tests/single_file/test_model_controlnet_single_file.py index e5214fe3f209..257323d8dc26 100644 --- a/tests/single_file/test_model_controlnet_single_file.py +++ b/tests/single_file/test_model_controlnet_single_file.py @@ -13,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import gc import unittest import torch @@ -23,46 +22,19 @@ ) from ..testing_utils import ( - backend_empty_cache, enable_full_determinism, - require_torch_accelerator, - slow, - torch_device, ) +from .single_file_testing_utils import SingleFileModelTesterMixin enable_full_determinism() -@slow -@require_torch_accelerator -class ControlNetModelSingleFileTests(unittest.TestCase): +class ControlNetModelSingleFileTests(SingleFileModelTesterMixin, unittest.TestCase): model_class = ControlNetModel ckpt_path = "https://huggingface.co/lllyasviel/ControlNet-v1-1/blob/main/control_v11p_sd15_canny.pth" repo_id = "lllyasviel/control_v11p_sd15_canny" - def setUp(self): - super().setUp() - gc.collect() - backend_empty_cache(torch_device) - - def tearDown(self): - super().tearDown() - gc.collect() - backend_empty_cache(torch_device) - - def test_single_file_components(self): - model = self.model_class.from_pretrained(self.repo_id) - model_single_file = self.model_class.from_single_file(self.ckpt_path) - - PARAMS_TO_IGNORE = ["torch_dtype", "_name_or_path", "_use_default_values", "_diffusers_version"] - for param_name, param_value in model_single_file.config.items(): - if param_name in PARAMS_TO_IGNORE: - continue - assert model.config[param_name] == param_value, ( - f"{param_name} differs between single file loading and pretrained loading" - ) - def test_single_file_arguments(self): model_default = self.model_class.from_single_file(self.ckpt_path) diff --git a/tests/single_file/test_model_flux_transformer_single_file.py b/tests/single_file/test_model_flux_transformer_single_file.py index 8290c339b931..f36a79660dc2 100644 --- a/tests/single_file/test_model_flux_transformer_single_file.py +++ b/tests/single_file/test_model_flux_transformer_single_file.py @@ -23,43 +23,22 @@ from ..testing_utils import ( backend_empty_cache, enable_full_determinism, - require_torch_accelerator, torch_device, ) +from .single_file_testing_utils import SingleFileModelTesterMixin enable_full_determinism() -@require_torch_accelerator -class FluxTransformer2DModelSingleFileTests(unittest.TestCase): +class FluxTransformer2DModelSingleFileTests(SingleFileModelTesterMixin, unittest.TestCase): model_class = FluxTransformer2DModel ckpt_path = "https://huggingface.co/black-forest-labs/FLUX.1-dev/blob/main/flux1-dev.safetensors" alternate_keys_ckpt_paths = ["https://huggingface.co/Comfy-Org/flux1-dev/blob/main/flux1-dev-fp8.safetensors"] repo_id = "black-forest-labs/FLUX.1-dev" - def setUp(self): - super().setUp() - gc.collect() - backend_empty_cache(torch_device) - - def tearDown(self): - super().tearDown() - gc.collect() - backend_empty_cache(torch_device) - - def test_single_file_components(self): - model = self.model_class.from_pretrained(self.repo_id, subfolder="transformer") - model_single_file = self.model_class.from_single_file(self.ckpt_path) - - PARAMS_TO_IGNORE = ["torch_dtype", "_name_or_path", "_use_default_values", "_diffusers_version"] - for param_name, param_value in model_single_file.config.items(): - if param_name in PARAMS_TO_IGNORE: - continue - assert model.config[param_name] == param_value, ( - f"{param_name} differs between single file loading and pretrained loading" - ) + subfolder = "transformer" def test_checkpoint_loading(self): for ckpt_path in self.alternate_keys_ckpt_paths: diff --git a/tests/single_file/test_model_vae_single_file.py b/tests/single_file/test_model_vae_single_file.py index 3b9e619f13e6..bcbc61e049f1 100644 --- a/tests/single_file/test_model_vae_single_file.py +++ b/tests/single_file/test_model_vae_single_file.py @@ -13,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import gc import unittest import torch @@ -23,22 +22,18 @@ ) from ..testing_utils import ( - backend_empty_cache, enable_full_determinism, load_hf_numpy, numpy_cosine_similarity_distance, - require_torch_accelerator, - slow, torch_device, ) +from .single_file_testing_utils import SingleFileModelTesterMixin enable_full_determinism() -@slow -@require_torch_accelerator -class AutoencoderKLSingleFileTests(unittest.TestCase): +class AutoencoderKLSingleFileTests(SingleFileModelTesterMixin, unittest.TestCase): model_class = AutoencoderKL ckpt_path = ( "https://huggingface.co/stabilityai/sd-vae-ft-mse-original/blob/main/vae-ft-mse-840000-ema-pruned.safetensors" @@ -47,16 +42,6 @@ class AutoencoderKLSingleFileTests(unittest.TestCase): main_input_name = "sample" base_precision = 1e-2 - def setUp(self): - super().setUp() - gc.collect() - backend_empty_cache(torch_device) - - def tearDown(self): - super().tearDown() - gc.collect() - backend_empty_cache(torch_device) - def get_file_format(self, seed, shape): return f"gaussian_noise_s={seed}_shape={'_'.join([str(s) for s in shape])}.npy" @@ -84,18 +69,6 @@ def test_single_file_inference_same_as_pretrained(self): assert numpy_cosine_similarity_distance(output_slice_1, output_slice_2) < 1e-4 - def test_single_file_components(self): - model = self.model_class.from_pretrained(self.repo_id) - model_single_file = self.model_class.from_single_file(self.ckpt_path, config=self.repo_id) - - PARAMS_TO_IGNORE = ["torch_dtype", "_name_or_path", "_use_default_values", "_diffusers_version"] - for param_name, param_value in model_single_file.config.items(): - if param_name in PARAMS_TO_IGNORE: - continue - assert model.config[param_name] == param_value, ( - f"{param_name} differs between pretrained loading and single file loading" - ) - def test_single_file_arguments(self): model_default = self.model_class.from_single_file(self.ckpt_path, config=self.repo_id) diff --git a/tests/single_file/test_model_wan_autoencoder_single_file.py b/tests/single_file/test_model_wan_autoencoder_single_file.py index a1f7155c1072..2eb32d0f4262 100644 --- a/tests/single_file/test_model_wan_autoencoder_single_file.py +++ b/tests/single_file/test_model_wan_autoencoder_single_file.py @@ -13,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import gc import unittest from diffusers import ( @@ -21,42 +20,18 @@ ) from ..testing_utils import ( - backend_empty_cache, enable_full_determinism, - require_torch_accelerator, - torch_device, ) +from .single_file_testing_utils import SingleFileModelTesterMixin enable_full_determinism() -@require_torch_accelerator -class AutoencoderKLWanSingleFileTests(unittest.TestCase): +class AutoencoderKLWanSingleFileTests(SingleFileModelTesterMixin, unittest.TestCase): model_class = AutoencoderKLWan ckpt_path = ( "https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/blob/main/split_files/vae/wan_2.1_vae.safetensors" ) repo_id = "Wan-AI/Wan2.1-T2V-1.3B-Diffusers" - - def setUp(self): - super().setUp() - gc.collect() - backend_empty_cache(torch_device) - - def tearDown(self): - super().tearDown() - gc.collect() - backend_empty_cache(torch_device) - - def test_single_file_components(self): - model = self.model_class.from_pretrained(self.repo_id, subfolder="vae") - model_single_file = self.model_class.from_single_file(self.ckpt_path) - - PARAMS_TO_IGNORE = ["torch_dtype", "_name_or_path", "_use_default_values", "_diffusers_version"] - for param_name, param_value in model_single_file.config.items(): - if param_name in PARAMS_TO_IGNORE: - continue - assert model.config[param_name] == param_value, ( - f"{param_name} differs between single file loading and pretrained loading" - ) + subfolder = "vae" diff --git a/tests/single_file/test_model_wan_transformer3d_single_file.py b/tests/single_file/test_model_wan_transformer3d_single_file.py index d7c758d3d933..2ddaf92bad40 100644 --- a/tests/single_file/test_model_wan_transformer3d_single_file.py +++ b/tests/single_file/test_model_wan_transformer3d_single_file.py @@ -13,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import gc import unittest import torch @@ -23,72 +22,26 @@ ) from ..testing_utils import ( - backend_empty_cache, enable_full_determinism, require_big_accelerator, - require_torch_accelerator, - torch_device, ) +from .single_file_testing_utils import SingleFileModelTesterMixin enable_full_determinism() -@require_torch_accelerator -class WanTransformer3DModelText2VideoSingleFileTest(unittest.TestCase): +class WanTransformer3DModelText2VideoSingleFileTest(SingleFileModelTesterMixin, unittest.TestCase): model_class = WanTransformer3DModel ckpt_path = "https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/blob/main/split_files/diffusion_models/wan2.1_t2v_1.3B_bf16.safetensors" repo_id = "Wan-AI/Wan2.1-T2V-1.3B-Diffusers" - - def setUp(self): - super().setUp() - gc.collect() - backend_empty_cache(torch_device) - - def tearDown(self): - super().tearDown() - gc.collect() - backend_empty_cache(torch_device) - - def test_single_file_components(self): - model = self.model_class.from_pretrained(self.repo_id, subfolder="transformer") - model_single_file = self.model_class.from_single_file(self.ckpt_path) - - PARAMS_TO_IGNORE = ["torch_dtype", "_name_or_path", "_use_default_values", "_diffusers_version"] - for param_name, param_value in model_single_file.config.items(): - if param_name in PARAMS_TO_IGNORE: - continue - assert model.config[param_name] == param_value, ( - f"{param_name} differs between single file loading and pretrained loading" - ) + subfolder = "transformer" @require_big_accelerator -@require_torch_accelerator -class WanTransformer3DModelImage2VideoSingleFileTest(unittest.TestCase): +class WanTransformer3DModelImage2VideoSingleFileTest(SingleFileModelTesterMixin, unittest.TestCase): model_class = WanTransformer3DModel ckpt_path = "https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/blob/main/split_files/diffusion_models/wan2.1_i2v_480p_14B_fp8_e4m3fn.safetensors" repo_id = "Wan-AI/Wan2.1-I2V-14B-480P-Diffusers" torch_dtype = torch.float8_e4m3fn - - def setUp(self): - super().setUp() - gc.collect() - backend_empty_cache(torch_device) - - def tearDown(self): - super().tearDown() - gc.collect() - backend_empty_cache(torch_device) - - def test_single_file_components(self): - model = self.model_class.from_pretrained(self.repo_id, subfolder="transformer", torch_dtype=self.torch_dtype) - model_single_file = self.model_class.from_single_file(self.ckpt_path, torch_dtype=self.torch_dtype) - - PARAMS_TO_IGNORE = ["torch_dtype", "_name_or_path", "_use_default_values", "_diffusers_version"] - for param_name, param_value in model_single_file.config.items(): - if param_name in PARAMS_TO_IGNORE: - continue - assert model.config[param_name] == param_value, ( - f"{param_name} differs between single file loading and pretrained loading" - ) + subfolder = "transformer" diff --git a/tests/single_file/test_sana_transformer.py b/tests/single_file/test_sana_transformer.py index c1543ba17137..b0577e1d6139 100644 --- a/tests/single_file/test_sana_transformer.py +++ b/tests/single_file/test_sana_transformer.py @@ -8,16 +8,15 @@ from ..testing_utils import ( backend_empty_cache, enable_full_determinism, - require_torch_accelerator, torch_device, ) +from .single_file_testing_utils import SingleFileModelTesterMixin enable_full_determinism() -@require_torch_accelerator -class SanaTransformer2DModelSingleFileTests(unittest.TestCase): +class SanaTransformer2DModelSingleFileTests(SingleFileModelTesterMixin, unittest.TestCase): model_class = SanaTransformer2DModel ckpt_path = ( "https://huggingface.co/Efficient-Large-Model/Sana_1600M_1024px/blob/main/checkpoints/Sana_1600M_1024px.pth" @@ -27,28 +26,7 @@ class SanaTransformer2DModelSingleFileTests(unittest.TestCase): ] repo_id = "Efficient-Large-Model/Sana_1600M_1024px_diffusers" - - def setUp(self): - super().setUp() - gc.collect() - backend_empty_cache(torch_device) - - def tearDown(self): - super().tearDown() - gc.collect() - backend_empty_cache(torch_device) - - def test_single_file_components(self): - model = self.model_class.from_pretrained(self.repo_id, subfolder="transformer") - model_single_file = self.model_class.from_single_file(self.ckpt_path) - - PARAMS_TO_IGNORE = ["torch_dtype", "_name_or_path", "_use_default_values", "_diffusers_version"] - for param_name, param_value in model_single_file.config.items(): - if param_name in PARAMS_TO_IGNORE: - continue - assert model.config[param_name] == param_value, ( - f"{param_name} differs between single file loading and pretrained loading" - ) + subfolder = "transformer" def test_checkpoint_loading(self): for ckpt_path in self.alternate_keys_ckpt_paths: From 1f6defd7d6dacb6cc6a4dc8f8d681dc22bebce36 Mon Sep 17 00:00:00 2001 From: DN6 Date: Fri, 19 Sep 2025 13:27:08 +0530 Subject: [PATCH 2/5] update --- tests/single_file/single_file_testing_utils.py | 18 ++++++++++++++++++ tests/single_file/test_lumina2_transformer.py | 12 ------------ .../test_model_flux_transformer_single_file.py | 10 ---------- tests/single_file/test_sana_transformer.py | 12 ------------ 4 files changed, 18 insertions(+), 34 deletions(-) diff --git a/tests/single_file/single_file_testing_utils.py b/tests/single_file/single_file_testing_utils.py index 58cbd7ada57b..60f6de6fd3f6 100644 --- a/tests/single_file/single_file_testing_utils.py +++ b/tests/single_file/single_file_testing_utils.py @@ -119,6 +119,24 @@ def test_single_file_model_parameters(self): f"max difference {torch.max(torch.abs(param - param_single_file)).item()}" ) + def test_checkpoint_altered_keys_loading(self): + # Test loading with checkpoints that have altered keys + if not hasattr(self, "alternate_keys_ckpt_paths") or not self.alternate_keys_ckpt_paths: + return + + for ckpt_path in self.alternate_keys_ckpt_paths: + backend_empty_cache(torch_device) + + single_file_kwargs = {} + if hasattr(self, "torch_dtype") and self.torch_dtype: + single_file_kwargs["torch_dtype"] = self.torch_dtype + + model = self.model_class.from_single_file(ckpt_path, **single_file_kwargs) + + del model + gc.collect() + backend_empty_cache(torch_device) + class SDSingleFileTesterMixin: single_file_kwargs = {} diff --git a/tests/single_file/test_lumina2_transformer.py b/tests/single_file/test_lumina2_transformer.py index 2984776df51a..67de1107ba31 100644 --- a/tests/single_file/test_lumina2_transformer.py +++ b/tests/single_file/test_lumina2_transformer.py @@ -13,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import gc import unittest from diffusers import ( @@ -21,9 +20,7 @@ ) from ..testing_utils import ( - backend_empty_cache, enable_full_determinism, - torch_device, ) from .single_file_testing_utils import SingleFileModelTesterMixin @@ -40,12 +37,3 @@ class Lumina2Transformer2DModelSingleFileTests(SingleFileModelTesterMixin, unitt repo_id = "Alpha-VLLM/Lumina-Image-2.0" subfolder = "transformer" - - def test_checkpoint_loading(self): - for ckpt_path in self.alternate_keys_ckpt_paths: - backend_empty_cache(torch_device) - model = self.model_class.from_single_file(ckpt_path) - - del model - gc.collect() - backend_empty_cache(torch_device) diff --git a/tests/single_file/test_model_flux_transformer_single_file.py b/tests/single_file/test_model_flux_transformer_single_file.py index f36a79660dc2..457b9fa9cda3 100644 --- a/tests/single_file/test_model_flux_transformer_single_file.py +++ b/tests/single_file/test_model_flux_transformer_single_file.py @@ -37,18 +37,8 @@ class FluxTransformer2DModelSingleFileTests(SingleFileModelTesterMixin, unittest alternate_keys_ckpt_paths = ["https://huggingface.co/Comfy-Org/flux1-dev/blob/main/flux1-dev-fp8.safetensors"] repo_id = "black-forest-labs/FLUX.1-dev" - subfolder = "transformer" - def test_checkpoint_loading(self): - for ckpt_path in self.alternate_keys_ckpt_paths: - backend_empty_cache(torch_device) - model = self.model_class.from_single_file(ckpt_path) - - del model - gc.collect() - backend_empty_cache(torch_device) - def test_device_map_cuda(self): backend_empty_cache(torch_device) model = self.model_class.from_single_file(self.ckpt_path, device_map="cuda") diff --git a/tests/single_file/test_sana_transformer.py b/tests/single_file/test_sana_transformer.py index b0577e1d6139..85296ec1daec 100644 --- a/tests/single_file/test_sana_transformer.py +++ b/tests/single_file/test_sana_transformer.py @@ -1,4 +1,3 @@ -import gc import unittest from diffusers import ( @@ -6,9 +5,7 @@ ) from ..testing_utils import ( - backend_empty_cache, enable_full_determinism, - torch_device, ) from .single_file_testing_utils import SingleFileModelTesterMixin @@ -27,12 +24,3 @@ class SanaTransformer2DModelSingleFileTests(SingleFileModelTesterMixin, unittest repo_id = "Efficient-Large-Model/Sana_1600M_1024px_diffusers" subfolder = "transformer" - - def test_checkpoint_loading(self): - for ckpt_path in self.alternate_keys_ckpt_paths: - backend_empty_cache(torch_device) - model = self.model_class.from_single_file(ckpt_path) - - del model - gc.collect() - backend_empty_cache(torch_device) From 6a47dd0c04cdabdbc5e4962b7ffcfe410bcb5a16 Mon Sep 17 00:00:00 2001 From: DN6 Date: Wed, 24 Sep 2025 18:24:50 +0530 Subject: [PATCH 3/5] update --- .../single_file/single_file_testing_utils.py | 8 +++--- tests/single_file/test_lumina2_transformer.py | 3 +-- .../test_model_autoencoder_dc_single_file.py | 3 +-- .../test_model_controlnet_single_file.py | 3 +-- ...test_model_flux_transformer_single_file.py | 3 +-- .../test_model_motion_adapter_single_file.py | 3 +-- .../test_model_sd_cascade_unet_single_file.py | 9 +++---- .../single_file/test_model_vae_single_file.py | 3 +-- .../test_model_wan_autoencoder_single_file.py | 3 +-- ...est_model_wan_transformer3d_single_file.py | 5 ++-- tests/single_file/test_sana_transformer.py | 4 +-- ...iffusion_controlnet_img2img_single_file.py | 9 +++---- ...iffusion_controlnet_inpaint_single_file.py | 14 +++++------ ...stable_diffusion_controlnet_single_file.py | 9 +++---- ...st_stable_diffusion_img2img_single_file.py | 17 +++++-------- ...st_stable_diffusion_inpaint_single_file.py | 22 +++++++--------- .../test_stable_diffusion_single_file.py | 25 +++++++------------ ...st_stable_diffusion_upscale_single_file.py | 9 +++---- ...stable_diffusion_xl_adapter_single_file.py | 9 +++---- ...ble_diffusion_xl_controlnet_single_file.py | 9 +++---- ...stable_diffusion_xl_img2img_single_file.py | 11 +++----- ...st_stable_diffusion_xl_instruct_pix2pix.py | 9 +++---- .../test_stable_diffusion_xl_single_file.py | 9 +++---- 23 files changed, 72 insertions(+), 127 deletions(-) diff --git a/tests/single_file/single_file_testing_utils.py b/tests/single_file/single_file_testing_utils.py index 60f6de6fd3f6..52fd2f5bfc7f 100644 --- a/tests/single_file/single_file_testing_utils.py +++ b/tests/single_file/single_file_testing_utils.py @@ -11,6 +11,7 @@ from ..testing_utils import ( backend_empty_cache, + nightly, numpy_cosine_similarity_distance, require_torch_accelerator, torch_device, @@ -50,15 +51,14 @@ def download_diffusers_config(repo_id, tmpdir): return path +@nightly @require_torch_accelerator class SingleFileModelTesterMixin: - def setUp(self): - super().setUp() + def setup_method(self): gc.collect() backend_empty_cache(torch_device) - def tearDown(self): - super().tearDown() + def teardown_method(self): gc.collect() backend_empty_cache(torch_device) diff --git a/tests/single_file/test_lumina2_transformer.py b/tests/single_file/test_lumina2_transformer.py index 67de1107ba31..b5e4d7bfb17f 100644 --- a/tests/single_file/test_lumina2_transformer.py +++ b/tests/single_file/test_lumina2_transformer.py @@ -13,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import unittest from diffusers import ( Lumina2Transformer2DModel, @@ -28,7 +27,7 @@ enable_full_determinism() -class Lumina2Transformer2DModelSingleFileTests(SingleFileModelTesterMixin, unittest.TestCase): +class Lumina2Transformer2DModelSingleFileTests(SingleFileModelTesterMixin): model_class = Lumina2Transformer2DModel ckpt_path = "https://huggingface.co/Comfy-Org/Lumina_Image_2.0_Repackaged/blob/main/split_files/diffusion_models/lumina_2_model_bf16.safetensors" alternate_keys_ckpt_paths = [ diff --git a/tests/single_file/test_model_autoencoder_dc_single_file.py b/tests/single_file/test_model_autoencoder_dc_single_file.py index d174a8a2d681..14525eae3bd0 100644 --- a/tests/single_file/test_model_autoencoder_dc_single_file.py +++ b/tests/single_file/test_model_autoencoder_dc_single_file.py @@ -13,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import unittest import torch @@ -33,7 +32,7 @@ enable_full_determinism() -class AutoencoderDCSingleFileTests(SingleFileModelTesterMixin, unittest.TestCase): +class AutoencoderDCSingleFileTests(SingleFileModelTesterMixin): model_class = AutoencoderDC ckpt_path = "https://huggingface.co/mit-han-lab/dc-ae-f32c32-sana-1.0/blob/main/model.safetensors" repo_id = "mit-han-lab/dc-ae-f32c32-sana-1.0-diffusers" diff --git a/tests/single_file/test_model_controlnet_single_file.py b/tests/single_file/test_model_controlnet_single_file.py index 257323d8dc26..39a39aec1f3a 100644 --- a/tests/single_file/test_model_controlnet_single_file.py +++ b/tests/single_file/test_model_controlnet_single_file.py @@ -13,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import unittest import torch @@ -30,7 +29,7 @@ enable_full_determinism() -class ControlNetModelSingleFileTests(SingleFileModelTesterMixin, unittest.TestCase): +class ControlNetModelSingleFileTests(SingleFileModelTesterMixin): model_class = ControlNetModel ckpt_path = "https://huggingface.co/lllyasviel/ControlNet-v1-1/blob/main/control_v11p_sd15_canny.pth" repo_id = "lllyasviel/control_v11p_sd15_canny" diff --git a/tests/single_file/test_model_flux_transformer_single_file.py b/tests/single_file/test_model_flux_transformer_single_file.py index 457b9fa9cda3..cc72106bccd8 100644 --- a/tests/single_file/test_model_flux_transformer_single_file.py +++ b/tests/single_file/test_model_flux_transformer_single_file.py @@ -14,7 +14,6 @@ # limitations under the License. import gc -import unittest from diffusers import ( FluxTransformer2DModel, @@ -31,7 +30,7 @@ enable_full_determinism() -class FluxTransformer2DModelSingleFileTests(SingleFileModelTesterMixin, unittest.TestCase): +class FluxTransformer2DModelSingleFileTests(SingleFileModelTesterMixin): model_class = FluxTransformer2DModel ckpt_path = "https://huggingface.co/black-forest-labs/FLUX.1-dev/blob/main/flux1-dev.safetensors" alternate_keys_ckpt_paths = ["https://huggingface.co/Comfy-Org/flux1-dev/blob/main/flux1-dev-fp8.safetensors"] diff --git a/tests/single_file/test_model_motion_adapter_single_file.py b/tests/single_file/test_model_motion_adapter_single_file.py index 7aaf4b577e4b..a047c81b47aa 100644 --- a/tests/single_file/test_model_motion_adapter_single_file.py +++ b/tests/single_file/test_model_motion_adapter_single_file.py @@ -13,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import unittest from diffusers import ( MotionAdapter, @@ -27,7 +26,7 @@ enable_full_determinism() -class MotionAdapterSingleFileTests(unittest.TestCase): +class MotionAdapterSingleFileTests: model_class = MotionAdapter def test_single_file_components_version_v1_5(self): diff --git a/tests/single_file/test_model_sd_cascade_unet_single_file.py b/tests/single_file/test_model_sd_cascade_unet_single_file.py index a5ec9dba30df..7472122710eb 100644 --- a/tests/single_file/test_model_sd_cascade_unet_single_file.py +++ b/tests/single_file/test_model_sd_cascade_unet_single_file.py @@ -14,7 +14,6 @@ # limitations under the License. import gc -import unittest import torch @@ -37,14 +36,12 @@ @slow @require_torch_accelerator -class StableCascadeUNetSingleFileTest(unittest.TestCase): - def setUp(self): - super().setUp() +class StableCascadeUNetSingleFileTest: + def setup_method(self): gc.collect() backend_empty_cache(torch_device) - def tearDown(self): - super().tearDown() + def teardown_method(self): gc.collect() backend_empty_cache(torch_device) diff --git a/tests/single_file/test_model_vae_single_file.py b/tests/single_file/test_model_vae_single_file.py index bcbc61e049f1..c39f7a361ac1 100644 --- a/tests/single_file/test_model_vae_single_file.py +++ b/tests/single_file/test_model_vae_single_file.py @@ -13,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import unittest import torch @@ -33,7 +32,7 @@ enable_full_determinism() -class AutoencoderKLSingleFileTests(SingleFileModelTesterMixin, unittest.TestCase): +class AutoencoderKLSingleFileTests(SingleFileModelTesterMixin): model_class = AutoencoderKL ckpt_path = ( "https://huggingface.co/stabilityai/sd-vae-ft-mse-original/blob/main/vae-ft-mse-840000-ema-pruned.safetensors" diff --git a/tests/single_file/test_model_wan_autoencoder_single_file.py b/tests/single_file/test_model_wan_autoencoder_single_file.py index 2eb32d0f4262..5527f813bb52 100644 --- a/tests/single_file/test_model_wan_autoencoder_single_file.py +++ b/tests/single_file/test_model_wan_autoencoder_single_file.py @@ -13,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import unittest from diffusers import ( AutoencoderKLWan, @@ -28,7 +27,7 @@ enable_full_determinism() -class AutoencoderKLWanSingleFileTests(SingleFileModelTesterMixin, unittest.TestCase): +class AutoencoderKLWanSingleFileTests(SingleFileModelTesterMixin): model_class = AutoencoderKLWan ckpt_path = ( "https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/blob/main/split_files/vae/wan_2.1_vae.safetensors" diff --git a/tests/single_file/test_model_wan_transformer3d_single_file.py b/tests/single_file/test_model_wan_transformer3d_single_file.py index 2ddaf92bad40..27153bd3b0b4 100644 --- a/tests/single_file/test_model_wan_transformer3d_single_file.py +++ b/tests/single_file/test_model_wan_transformer3d_single_file.py @@ -13,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import unittest import torch @@ -31,7 +30,7 @@ enable_full_determinism() -class WanTransformer3DModelText2VideoSingleFileTest(SingleFileModelTesterMixin, unittest.TestCase): +class WanTransformer3DModelText2VideoSingleFileTest(SingleFileModelTesterMixin): model_class = WanTransformer3DModel ckpt_path = "https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/blob/main/split_files/diffusion_models/wan2.1_t2v_1.3B_bf16.safetensors" repo_id = "Wan-AI/Wan2.1-T2V-1.3B-Diffusers" @@ -39,7 +38,7 @@ class WanTransformer3DModelText2VideoSingleFileTest(SingleFileModelTesterMixin, @require_big_accelerator -class WanTransformer3DModelImage2VideoSingleFileTest(SingleFileModelTesterMixin, unittest.TestCase): +class WanTransformer3DModelImage2VideoSingleFileTest(SingleFileModelTesterMixin): model_class = WanTransformer3DModel ckpt_path = "https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/blob/main/split_files/diffusion_models/wan2.1_i2v_480p_14B_fp8_e4m3fn.safetensors" repo_id = "Wan-AI/Wan2.1-I2V-14B-480P-Diffusers" diff --git a/tests/single_file/test_sana_transformer.py b/tests/single_file/test_sana_transformer.py index 85296ec1daec..259678e2b130 100644 --- a/tests/single_file/test_sana_transformer.py +++ b/tests/single_file/test_sana_transformer.py @@ -1,5 +1,3 @@ -import unittest - from diffusers import ( SanaTransformer2DModel, ) @@ -13,7 +11,7 @@ enable_full_determinism() -class SanaTransformer2DModelSingleFileTests(SingleFileModelTesterMixin, unittest.TestCase): +class SanaTransformer2DModelSingleFileTests(SingleFileModelTesterMixin): model_class = SanaTransformer2DModel ckpt_path = ( "https://huggingface.co/Efficient-Large-Model/Sana_1600M_1024px/blob/main/checkpoints/Sana_1600M_1024px.pth" diff --git a/tests/single_file/test_stable_diffusion_controlnet_img2img_single_file.py b/tests/single_file/test_stable_diffusion_controlnet_img2img_single_file.py index e558eeaf6f47..b3df7b6400cf 100644 --- a/tests/single_file/test_stable_diffusion_controlnet_img2img_single_file.py +++ b/tests/single_file/test_stable_diffusion_controlnet_img2img_single_file.py @@ -1,6 +1,5 @@ import gc import tempfile -import unittest import torch @@ -29,7 +28,7 @@ @slow @require_torch_accelerator -class StableDiffusionControlNetPipelineSingleFileSlowTests(unittest.TestCase, SDSingleFileTesterMixin): +class StableDiffusionControlNetPipelineSingleFileSlowTests(SDSingleFileTesterMixin): pipeline_class = StableDiffusionControlNetPipeline ckpt_path = ( "https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5/blob/main/v1-5-pruned-emaonly.safetensors" @@ -39,13 +38,11 @@ class StableDiffusionControlNetPipelineSingleFileSlowTests(unittest.TestCase, SD ) repo_id = "stable-diffusion-v1-5/stable-diffusion-v1-5" - def setUp(self): - super().setUp() + def setup_method(self): gc.collect() backend_empty_cache(torch_device) - def tearDown(self): - super().tearDown() + def teardown_method(self): gc.collect() backend_empty_cache(torch_device) diff --git a/tests/single_file/test_stable_diffusion_controlnet_inpaint_single_file.py b/tests/single_file/test_stable_diffusion_controlnet_inpaint_single_file.py index 54224f51a9b5..820c9e31f2db 100644 --- a/tests/single_file/test_stable_diffusion_controlnet_inpaint_single_file.py +++ b/tests/single_file/test_stable_diffusion_controlnet_inpaint_single_file.py @@ -1,7 +1,7 @@ import gc import tempfile -import unittest +import pytest import torch from diffusers import ControlNetModel, StableDiffusionControlNetInpaintPipeline @@ -29,19 +29,17 @@ @slow @require_torch_accelerator -class StableDiffusionControlNetInpaintPipelineSingleFileSlowTests(unittest.TestCase, SDSingleFileTesterMixin): +class StableDiffusionControlNetInpaintPipelineSingleFileSlowTests(SDSingleFileTesterMixin): pipeline_class = StableDiffusionControlNetInpaintPipeline ckpt_path = "https://huggingface.co/botp/stable-diffusion-v1-5-inpainting/blob/main/sd-v1-5-inpainting.ckpt" original_config = "https://raw.githubusercontent.com/runwayml/stable-diffusion/main/configs/stable-diffusion/v1-inpainting-inference.yaml" repo_id = "stable-diffusion-v1-5/stable-diffusion-inpainting" - def setUp(self): - super().setUp() + def setup_method(self): gc.collect() backend_empty_cache(torch_device) - def tearDown(self): - super().tearDown() + def teardown_method(self): gc.collect() backend_empty_cache(torch_device) @@ -115,7 +113,7 @@ def test_single_file_components_local_files_only(self): super()._compare_component_configs(pipe, pipe_single_file) - @unittest.skip("runwayml original config repo does not exist") + @pytest.mark.skip(reason="runwayml original config repo does not exist") def test_single_file_components_with_original_config(self): controlnet = ControlNetModel.from_pretrained("lllyasviel/control_v11p_sd15_canny", variant="fp16") pipe = self.pipeline_class.from_pretrained(self.repo_id, controlnet=controlnet) @@ -125,7 +123,7 @@ def test_single_file_components_with_original_config(self): super()._compare_component_configs(pipe, pipe_single_file) - @unittest.skip("runwayml original config repo does not exist") + @pytest.mark.skip(reason="runwayml original config repo does not exist") def test_single_file_components_with_original_config_local_files_only(self): controlnet = ControlNetModel.from_pretrained( "lllyasviel/control_v11p_sd15_canny", torch_dtype=torch.float16, variant="fp16" diff --git a/tests/single_file/test_stable_diffusion_controlnet_single_file.py b/tests/single_file/test_stable_diffusion_controlnet_single_file.py index e90e648a9de9..a678d7f75182 100644 --- a/tests/single_file/test_stable_diffusion_controlnet_single_file.py +++ b/tests/single_file/test_stable_diffusion_controlnet_single_file.py @@ -1,6 +1,5 @@ import gc import tempfile -import unittest import torch @@ -29,7 +28,7 @@ @slow @require_torch_accelerator -class StableDiffusionControlNetPipelineSingleFileSlowTests(unittest.TestCase, SDSingleFileTesterMixin): +class StableDiffusionControlNetPipelineSingleFileSlowTests(SDSingleFileTesterMixin): pipeline_class = StableDiffusionControlNetPipeline ckpt_path = ( "https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5/blob/main/v1-5-pruned-emaonly.safetensors" @@ -39,13 +38,11 @@ class StableDiffusionControlNetPipelineSingleFileSlowTests(unittest.TestCase, SD ) repo_id = "stable-diffusion-v1-5/stable-diffusion-v1-5" - def setUp(self): - super().setUp() + def setup_method(self): gc.collect() backend_empty_cache(torch_device) - def tearDown(self): - super().tearDown() + def teardown_method(self): gc.collect() backend_empty_cache(torch_device) diff --git a/tests/single_file/test_stable_diffusion_img2img_single_file.py b/tests/single_file/test_stable_diffusion_img2img_single_file.py index 387f09471dd7..eae371720246 100644 --- a/tests/single_file/test_stable_diffusion_img2img_single_file.py +++ b/tests/single_file/test_stable_diffusion_img2img_single_file.py @@ -1,5 +1,4 @@ import gc -import unittest import torch @@ -23,7 +22,7 @@ @slow @require_torch_accelerator -class StableDiffusionImg2ImgPipelineSingleFileSlowTests(unittest.TestCase, SDSingleFileTesterMixin): +class StableDiffusionImg2ImgPipelineSingleFileSlowTests(SDSingleFileTesterMixin): pipeline_class = StableDiffusionImg2ImgPipeline ckpt_path = ( "https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5/blob/main/v1-5-pruned-emaonly.safetensors" @@ -33,13 +32,11 @@ class StableDiffusionImg2ImgPipelineSingleFileSlowTests(unittest.TestCase, SDSin ) repo_id = "stable-diffusion-v1-5/stable-diffusion-v1-5" - def setUp(self): - super().setUp() + def setup_method(self): gc.collect() backend_empty_cache(torch_device) - def tearDown(self): - super().tearDown() + def teardown_method(self): gc.collect() backend_empty_cache(torch_device) @@ -66,19 +63,17 @@ def test_single_file_format_inference_is_same_as_pretrained(self): @slow @require_torch_accelerator -class StableDiffusion21Img2ImgPipelineSingleFileSlowTests(unittest.TestCase, SDSingleFileTesterMixin): +class StableDiffusion21Img2ImgPipelineSingleFileSlowTests(SDSingleFileTesterMixin): pipeline_class = StableDiffusionImg2ImgPipeline ckpt_path = "https://huggingface.co/stabilityai/stable-diffusion-2-1/blob/main/v2-1_768-ema-pruned.safetensors" original_config = "https://raw.githubusercontent.com/Stability-AI/stablediffusion/main/configs/stable-diffusion/v2-inference-v.yaml" repo_id = "stabilityai/stable-diffusion-2-1" - def setUp(self): - super().setUp() + def setup_method(self): gc.collect() backend_empty_cache(torch_device) - def tearDown(self): - super().tearDown() + def teardown_method(self): gc.collect() backend_empty_cache(torch_device) diff --git a/tests/single_file/test_stable_diffusion_inpaint_single_file.py b/tests/single_file/test_stable_diffusion_inpaint_single_file.py index 84636ec0f0fa..48b7cb22af96 100644 --- a/tests/single_file/test_stable_diffusion_inpaint_single_file.py +++ b/tests/single_file/test_stable_diffusion_inpaint_single_file.py @@ -1,6 +1,6 @@ import gc -import unittest +import pytest import torch from diffusers import ( @@ -23,19 +23,17 @@ @slow @require_torch_accelerator -class StableDiffusionInpaintPipelineSingleFileSlowTests(unittest.TestCase, SDSingleFileTesterMixin): +class StableDiffusionInpaintPipelineSingleFileSlowTests(SDSingleFileTesterMixin): pipeline_class = StableDiffusionInpaintPipeline ckpt_path = "https://huggingface.co/botp/stable-diffusion-v1-5-inpainting/blob/main/sd-v1-5-inpainting.ckpt" original_config = "https://raw.githubusercontent.com/runwayml/stable-diffusion/main/configs/stable-diffusion/v1-inpainting-inference.yaml" repo_id = "botp/stable-diffusion-v1-5-inpainting" - def setUp(self): - super().setUp() + def setup_method(self): gc.collect() backend_empty_cache(torch_device) - def tearDown(self): - super().tearDown() + def teardown_method(self): gc.collect() backend_empty_cache(torch_device) @@ -70,18 +68,18 @@ def test_single_file_loading_4_channel_unet(self): assert pipe.unet.config.in_channels == 4 - @unittest.skip("runwayml original config has been removed") + @pytest.mark.skip(reason="runwayml original config has been removed") def test_single_file_components_with_original_config(self): return - @unittest.skip("runwayml original config has been removed") + @pytest.mark.skip(reason="runwayml original config has been removed") def test_single_file_components_with_original_config_local_files_only(self): return @slow @require_torch_accelerator -class StableDiffusion21InpaintPipelineSingleFileSlowTests(unittest.TestCase, SDSingleFileTesterMixin): +class StableDiffusion21InpaintPipelineSingleFileSlowTests(SDSingleFileTesterMixin): pipeline_class = StableDiffusionInpaintPipeline ckpt_path = ( "https://huggingface.co/stabilityai/stable-diffusion-2-inpainting/blob/main/512-inpainting-ema.safetensors" @@ -89,13 +87,11 @@ class StableDiffusion21InpaintPipelineSingleFileSlowTests(unittest.TestCase, SDS original_config = "https://raw.githubusercontent.com/Stability-AI/stablediffusion/main/configs/stable-diffusion/v2-inpainting-inference.yaml" repo_id = "stabilityai/stable-diffusion-2-inpainting" - def setUp(self): - super().setUp() + def setup_method(self): gc.collect() backend_empty_cache(torch_device) - def tearDown(self): - super().tearDown() + def teardown_method(self): gc.collect() backend_empty_cache(torch_device) diff --git a/tests/single_file/test_stable_diffusion_single_file.py b/tests/single_file/test_stable_diffusion_single_file.py index 4601b75c3ab6..618ab6c6165f 100644 --- a/tests/single_file/test_stable_diffusion_single_file.py +++ b/tests/single_file/test_stable_diffusion_single_file.py @@ -1,6 +1,5 @@ import gc import tempfile -import unittest import torch @@ -28,7 +27,7 @@ @slow @require_torch_accelerator -class StableDiffusionPipelineSingleFileSlowTests(unittest.TestCase, SDSingleFileTesterMixin): +class StableDiffusionPipelineSingleFileSlowTests(SDSingleFileTesterMixin): pipeline_class = StableDiffusionPipeline ckpt_path = ( "https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5/blob/main/v1-5-pruned-emaonly.safetensors" @@ -38,13 +37,11 @@ class StableDiffusionPipelineSingleFileSlowTests(unittest.TestCase, SDSingleFile ) repo_id = "stable-diffusion-v1-5/stable-diffusion-v1-5" - def setUp(self): - super().setUp() + def setup_method(self): gc.collect() backend_empty_cache(torch_device) - def tearDown(self): - super().tearDown() + def teardown_method(self): gc.collect() backend_empty_cache(torch_device) @@ -90,19 +87,17 @@ def test_single_file_legacy_scaling_factor(self): @slow -class StableDiffusion21PipelineSingleFileSlowTests(unittest.TestCase, SDSingleFileTesterMixin): +class StableDiffusion21PipelineSingleFileSlowTests(SDSingleFileTesterMixin): pipeline_class = StableDiffusionPipeline ckpt_path = "https://huggingface.co/stabilityai/stable-diffusion-2-1/blob/main/v2-1_768-ema-pruned.safetensors" original_config = "https://raw.githubusercontent.com/Stability-AI/stablediffusion/main/configs/stable-diffusion/v2-inference-v.yaml" repo_id = "stabilityai/stable-diffusion-2-1" - def setUp(self): - super().setUp() + def setup_method(self): gc.collect() backend_empty_cache(torch_device) - def tearDown(self): - super().tearDown() + def teardown_method(self): gc.collect() backend_empty_cache(torch_device) @@ -125,7 +120,7 @@ def test_single_file_format_inference_is_same_as_pretrained(self): @nightly @slow @require_torch_accelerator -class StableDiffusionInstructPix2PixPipelineSingleFileSlowTests(unittest.TestCase, SDSingleFileTesterMixin): +class StableDiffusionInstructPix2PixPipelineSingleFileSlowTests(SDSingleFileTesterMixin): pipeline_class = StableDiffusionInstructPix2PixPipeline ckpt_path = "https://huggingface.co/timbrooks/instruct-pix2pix/blob/main/instruct-pix2pix-00-22000.safetensors" original_config = ( @@ -134,13 +129,11 @@ class StableDiffusionInstructPix2PixPipelineSingleFileSlowTests(unittest.TestCas repo_id = "timbrooks/instruct-pix2pix" single_file_kwargs = {"extract_ema": True} - def setUp(self): - super().setUp() + def setup_method(self): gc.collect() backend_empty_cache(torch_device) - def tearDown(self): - super().tearDown() + def teardown_method(self): gc.collect() backend_empty_cache(torch_device) diff --git a/tests/single_file/test_stable_diffusion_upscale_single_file.py b/tests/single_file/test_stable_diffusion_upscale_single_file.py index 39ec7b0194a6..a58e5f20c5eb 100644 --- a/tests/single_file/test_stable_diffusion_upscale_single_file.py +++ b/tests/single_file/test_stable_diffusion_upscale_single_file.py @@ -1,5 +1,4 @@ import gc -import unittest import pytest import torch @@ -25,19 +24,17 @@ @slow @require_torch_accelerator -class StableDiffusionUpscalePipelineSingleFileSlowTests(unittest.TestCase, SDSingleFileTesterMixin): +class StableDiffusionUpscalePipelineSingleFileSlowTests(SDSingleFileTesterMixin): pipeline_class = StableDiffusionUpscalePipeline ckpt_path = "https://huggingface.co/stabilityai/stable-diffusion-x4-upscaler/blob/main/x4-upscaler-ema.safetensors" original_config = "https://raw.githubusercontent.com/Stability-AI/stablediffusion/main/configs/stable-diffusion/x4-upscaling.yaml" repo_id = "stabilityai/stable-diffusion-x4-upscaler" - def setUp(self): - super().setUp() + def setup_method(self): gc.collect() backend_empty_cache(torch_device) - def tearDown(self): - super().tearDown() + def teardown_method(self): gc.collect() backend_empty_cache(torch_device) diff --git a/tests/single_file/test_stable_diffusion_xl_adapter_single_file.py b/tests/single_file/test_stable_diffusion_xl_adapter_single_file.py index 3de9ee736417..e4e5bb961f20 100644 --- a/tests/single_file/test_stable_diffusion_xl_adapter_single_file.py +++ b/tests/single_file/test_stable_diffusion_xl_adapter_single_file.py @@ -1,6 +1,5 @@ import gc import tempfile -import unittest import torch @@ -32,7 +31,7 @@ @slow @require_torch_accelerator -class StableDiffusionXLAdapterPipelineSingleFileSlowTests(unittest.TestCase, SDXLSingleFileTesterMixin): +class StableDiffusionXLAdapterPipelineSingleFileSlowTests(SDXLSingleFileTesterMixin): pipeline_class = StableDiffusionXLAdapterPipeline ckpt_path = "https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/blob/main/sd_xl_base_1.0.safetensors" repo_id = "stabilityai/stable-diffusion-xl-base-1.0" @@ -40,13 +39,11 @@ class StableDiffusionXLAdapterPipelineSingleFileSlowTests(unittest.TestCase, SDX "https://raw.githubusercontent.com/Stability-AI/generative-models/main/configs/inference/sd_xl_base.yaml" ) - def setUp(self): - super().setUp() + def setup_method(self): gc.collect() backend_empty_cache(torch_device) - def tearDown(self): - super().tearDown() + def teardown_method(self): gc.collect() backend_empty_cache(torch_device) diff --git a/tests/single_file/test_stable_diffusion_xl_controlnet_single_file.py b/tests/single_file/test_stable_diffusion_xl_controlnet_single_file.py index a0a1aba1030f..397fbc4b32a0 100644 --- a/tests/single_file/test_stable_diffusion_xl_controlnet_single_file.py +++ b/tests/single_file/test_stable_diffusion_xl_controlnet_single_file.py @@ -1,6 +1,5 @@ import gc import tempfile -import unittest import torch @@ -28,7 +27,7 @@ @slow @require_torch_accelerator -class StableDiffusionXLControlNetPipelineSingleFileSlowTests(unittest.TestCase, SDXLSingleFileTesterMixin): +class StableDiffusionXLControlNetPipelineSingleFileSlowTests(SDXLSingleFileTesterMixin): pipeline_class = StableDiffusionXLControlNetPipeline ckpt_path = "https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/blob/main/sd_xl_base_1.0.safetensors" repo_id = "stabilityai/stable-diffusion-xl-base-1.0" @@ -36,13 +35,11 @@ class StableDiffusionXLControlNetPipelineSingleFileSlowTests(unittest.TestCase, "https://raw.githubusercontent.com/Stability-AI/generative-models/main/configs/inference/sd_xl_base.yaml" ) - def setUp(self): - super().setUp() + def setup_method(self): gc.collect() backend_empty_cache(torch_device) - def tearDown(self): - super().tearDown() + def teardown_method(self): gc.collect() backend_empty_cache(torch_device) diff --git a/tests/single_file/test_stable_diffusion_xl_img2img_single_file.py b/tests/single_file/test_stable_diffusion_xl_img2img_single_file.py index 810f412f8def..7ea822ca3ab0 100644 --- a/tests/single_file/test_stable_diffusion_xl_img2img_single_file.py +++ b/tests/single_file/test_stable_diffusion_xl_img2img_single_file.py @@ -1,5 +1,4 @@ import gc -import unittest import torch @@ -25,7 +24,7 @@ @slow @require_torch_accelerator -class StableDiffusionXLImg2ImgPipelineSingleFileSlowTests(unittest.TestCase, SDXLSingleFileTesterMixin): +class StableDiffusionXLImg2ImgPipelineSingleFileSlowTests(SDXLSingleFileTesterMixin): pipeline_class = StableDiffusionXLImg2ImgPipeline ckpt_path = "https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/blob/main/sd_xl_base_1.0.safetensors" repo_id = "stabilityai/stable-diffusion-xl-base-1.0" @@ -33,13 +32,11 @@ class StableDiffusionXLImg2ImgPipelineSingleFileSlowTests(unittest.TestCase, SDX "https://raw.githubusercontent.com/Stability-AI/generative-models/main/configs/inference/sd_xl_base.yaml" ) - def setUp(self): - super().setUp() + def setup_method(self): gc.collect() backend_empty_cache(torch_device) - def tearDown(self): - super().tearDown() + def teardown_method(self): gc.collect() backend_empty_cache(torch_device) @@ -66,7 +63,7 @@ def test_single_file_format_inference_is_same_as_pretrained(self): @slow @require_torch_accelerator -class StableDiffusionXLImg2ImgRefinerPipelineSingleFileSlowTests(unittest.TestCase): +class StableDiffusionXLImg2ImgRefinerPipelineSingleFileSlowTests: pipeline_class = StableDiffusionXLImg2ImgPipeline ckpt_path = ( "https://huggingface.co/stabilityai/stable-diffusion-xl-refiner-1.0/blob/main/sd_xl_refiner_1.0.safetensors" diff --git a/tests/single_file/test_stable_diffusion_xl_instruct_pix2pix.py b/tests/single_file/test_stable_diffusion_xl_instruct_pix2pix.py index 011d59222a5b..d755b7010516 100644 --- a/tests/single_file/test_stable_diffusion_xl_instruct_pix2pix.py +++ b/tests/single_file/test_stable_diffusion_xl_instruct_pix2pix.py @@ -1,5 +1,4 @@ import gc -import unittest import torch @@ -19,19 +18,17 @@ @slow @require_torch_accelerator -class StableDiffusionXLInstructPix2PixPipeline(unittest.TestCase): +class StableDiffusionXLInstructPix2PixPipeline: pipeline_class = StableDiffusionXLInstructPix2PixPipeline ckpt_path = "https://huggingface.co/stabilityai/cosxl/blob/main/cosxl_edit.safetensors" original_config = None repo_id = "diffusers/sdxl-instructpix2pix-768" - def setUp(self): - super().setUp() + def setup_method(self): gc.collect() backend_empty_cache(torch_device) - def tearDown(self): - super().tearDown() + def teardown_method(self): gc.collect() backend_empty_cache(torch_device) diff --git a/tests/single_file/test_stable_diffusion_xl_single_file.py b/tests/single_file/test_stable_diffusion_xl_single_file.py index 0ad180de17db..b2f7567f3f6d 100644 --- a/tests/single_file/test_stable_diffusion_xl_single_file.py +++ b/tests/single_file/test_stable_diffusion_xl_single_file.py @@ -1,5 +1,4 @@ import gc -import unittest import torch @@ -22,7 +21,7 @@ @slow @require_torch_accelerator -class StableDiffusionXLPipelineSingleFileSlowTests(unittest.TestCase, SDXLSingleFileTesterMixin): +class StableDiffusionXLPipelineSingleFileSlowTests(SDXLSingleFileTesterMixin): pipeline_class = StableDiffusionXLPipeline ckpt_path = "https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/blob/main/sd_xl_base_1.0.safetensors" repo_id = "stabilityai/stable-diffusion-xl-base-1.0" @@ -30,13 +29,11 @@ class StableDiffusionXLPipelineSingleFileSlowTests(unittest.TestCase, SDXLSingle "https://raw.githubusercontent.com/Stability-AI/generative-models/main/configs/inference/sd_xl_base.yaml" ) - def setUp(self): - super().setUp() + def setup_method(self): gc.collect() backend_empty_cache(torch_device) - def tearDown(self): - super().tearDown() + def teardown_method(self): gc.collect() backend_empty_cache(torch_device) From 99389854261388759e98153551f2f39b3a525216 Mon Sep 17 00:00:00 2001 From: DN6 Date: Tue, 30 Sep 2025 12:28:19 +0530 Subject: [PATCH 4/5] update --- tests/single_file/test_lumina2_transformer.py | 2 +- tests/single_file/test_model_autoencoder_dc_single_file.py | 2 +- tests/single_file/test_model_controlnet_single_file.py | 2 +- .../single_file/test_model_flux_transformer_single_file.py | 2 +- tests/single_file/test_model_vae_single_file.py | 2 +- tests/single_file/test_model_wan_autoencoder_single_file.py | 2 +- .../single_file/test_model_wan_transformer3d_single_file.py | 4 ++-- tests/single_file/test_sana_transformer.py | 2 +- .../test_stable_diffusion_controlnet_img2img_single_file.py | 2 +- .../test_stable_diffusion_controlnet_inpaint_single_file.py | 2 +- .../test_stable_diffusion_controlnet_single_file.py | 2 +- .../test_stable_diffusion_img2img_single_file.py | 4 ++-- .../test_stable_diffusion_inpaint_single_file.py | 4 ++-- tests/single_file/test_stable_diffusion_single_file.py | 6 +++--- .../test_stable_diffusion_upscale_single_file.py | 2 +- .../test_stable_diffusion_xl_adapter_single_file.py | 2 +- .../test_stable_diffusion_xl_controlnet_single_file.py | 2 +- .../test_stable_diffusion_xl_img2img_single_file.py | 2 +- tests/single_file/test_stable_diffusion_xl_single_file.py | 2 +- 19 files changed, 24 insertions(+), 24 deletions(-) diff --git a/tests/single_file/test_lumina2_transformer.py b/tests/single_file/test_lumina2_transformer.py index b5e4d7bfb17f..063c4ad4395b 100644 --- a/tests/single_file/test_lumina2_transformer.py +++ b/tests/single_file/test_lumina2_transformer.py @@ -27,7 +27,7 @@ enable_full_determinism() -class Lumina2Transformer2DModelSingleFileTests(SingleFileModelTesterMixin): +class TestLumina2Transformer2DModelSingleFileTests(SingleFileModelTesterMixin): model_class = Lumina2Transformer2DModel ckpt_path = "https://huggingface.co/Comfy-Org/Lumina_Image_2.0_Repackaged/blob/main/split_files/diffusion_models/lumina_2_model_bf16.safetensors" alternate_keys_ckpt_paths = [ diff --git a/tests/single_file/test_model_autoencoder_dc_single_file.py b/tests/single_file/test_model_autoencoder_dc_single_file.py index 14525eae3bd0..d57841c827c2 100644 --- a/tests/single_file/test_model_autoencoder_dc_single_file.py +++ b/tests/single_file/test_model_autoencoder_dc_single_file.py @@ -32,7 +32,7 @@ enable_full_determinism() -class AutoencoderDCSingleFileTests(SingleFileModelTesterMixin): +class TestAutoencoderDCSingleFileTests(SingleFileModelTesterMixin): model_class = AutoencoderDC ckpt_path = "https://huggingface.co/mit-han-lab/dc-ae-f32c32-sana-1.0/blob/main/model.safetensors" repo_id = "mit-han-lab/dc-ae-f32c32-sana-1.0-diffusers" diff --git a/tests/single_file/test_model_controlnet_single_file.py b/tests/single_file/test_model_controlnet_single_file.py index 39a39aec1f3a..7c635326130e 100644 --- a/tests/single_file/test_model_controlnet_single_file.py +++ b/tests/single_file/test_model_controlnet_single_file.py @@ -29,7 +29,7 @@ enable_full_determinism() -class ControlNetModelSingleFileTests(SingleFileModelTesterMixin): +class TestControlNetModelSingleFileTests(SingleFileModelTesterMixin): model_class = ControlNetModel ckpt_path = "https://huggingface.co/lllyasviel/ControlNet-v1-1/blob/main/control_v11p_sd15_canny.pth" repo_id = "lllyasviel/control_v11p_sd15_canny" diff --git a/tests/single_file/test_model_flux_transformer_single_file.py b/tests/single_file/test_model_flux_transformer_single_file.py index cc72106bccd8..6331cdaf10f5 100644 --- a/tests/single_file/test_model_flux_transformer_single_file.py +++ b/tests/single_file/test_model_flux_transformer_single_file.py @@ -30,7 +30,7 @@ enable_full_determinism() -class FluxTransformer2DModelSingleFileTests(SingleFileModelTesterMixin): +class TestFluxTransformer2DModelSingleFileTests(SingleFileModelTesterMixin): model_class = FluxTransformer2DModel ckpt_path = "https://huggingface.co/black-forest-labs/FLUX.1-dev/blob/main/flux1-dev.safetensors" alternate_keys_ckpt_paths = ["https://huggingface.co/Comfy-Org/flux1-dev/blob/main/flux1-dev-fp8.safetensors"] diff --git a/tests/single_file/test_model_vae_single_file.py b/tests/single_file/test_model_vae_single_file.py index c39f7a361ac1..9055d79e2f1b 100644 --- a/tests/single_file/test_model_vae_single_file.py +++ b/tests/single_file/test_model_vae_single_file.py @@ -32,7 +32,7 @@ enable_full_determinism() -class AutoencoderKLSingleFileTests(SingleFileModelTesterMixin): +class TestAutoencoderKLSingleFileTests(SingleFileModelTesterMixin): model_class = AutoencoderKL ckpt_path = ( "https://huggingface.co/stabilityai/sd-vae-ft-mse-original/blob/main/vae-ft-mse-840000-ema-pruned.safetensors" diff --git a/tests/single_file/test_model_wan_autoencoder_single_file.py b/tests/single_file/test_model_wan_autoencoder_single_file.py index 5527f813bb52..5f9fc97e203d 100644 --- a/tests/single_file/test_model_wan_autoencoder_single_file.py +++ b/tests/single_file/test_model_wan_autoencoder_single_file.py @@ -27,7 +27,7 @@ enable_full_determinism() -class AutoencoderKLWanSingleFileTests(SingleFileModelTesterMixin): +class TestAutoencoderKLWanSingleFileTests(SingleFileModelTesterMixin): model_class = AutoencoderKLWan ckpt_path = ( "https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/blob/main/split_files/vae/wan_2.1_vae.safetensors" diff --git a/tests/single_file/test_model_wan_transformer3d_single_file.py b/tests/single_file/test_model_wan_transformer3d_single_file.py index 27153bd3b0b4..8dca2b6f0761 100644 --- a/tests/single_file/test_model_wan_transformer3d_single_file.py +++ b/tests/single_file/test_model_wan_transformer3d_single_file.py @@ -30,7 +30,7 @@ enable_full_determinism() -class WanTransformer3DModelText2VideoSingleFileTest(SingleFileModelTesterMixin): +class TestWanTransformer3DModelText2VideoSingleFileTest(SingleFileModelTesterMixin): model_class = WanTransformer3DModel ckpt_path = "https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/blob/main/split_files/diffusion_models/wan2.1_t2v_1.3B_bf16.safetensors" repo_id = "Wan-AI/Wan2.1-T2V-1.3B-Diffusers" @@ -38,7 +38,7 @@ class WanTransformer3DModelText2VideoSingleFileTest(SingleFileModelTesterMixin): @require_big_accelerator -class WanTransformer3DModelImage2VideoSingleFileTest(SingleFileModelTesterMixin): +class TestWanTransformer3DModelImage2VideoSingleFileTest(SingleFileModelTesterMixin): model_class = WanTransformer3DModel ckpt_path = "https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/blob/main/split_files/diffusion_models/wan2.1_i2v_480p_14B_fp8_e4m3fn.safetensors" repo_id = "Wan-AI/Wan2.1-I2V-14B-480P-Diffusers" diff --git a/tests/single_file/test_sana_transformer.py b/tests/single_file/test_sana_transformer.py index 259678e2b130..c810abbecb54 100644 --- a/tests/single_file/test_sana_transformer.py +++ b/tests/single_file/test_sana_transformer.py @@ -11,7 +11,7 @@ enable_full_determinism() -class SanaTransformer2DModelSingleFileTests(SingleFileModelTesterMixin): +class TestSanaTransformer2DModelSingleFileTests(SingleFileModelTesterMixin): model_class = SanaTransformer2DModel ckpt_path = ( "https://huggingface.co/Efficient-Large-Model/Sana_1600M_1024px/blob/main/checkpoints/Sana_1600M_1024px.pth" diff --git a/tests/single_file/test_stable_diffusion_controlnet_img2img_single_file.py b/tests/single_file/test_stable_diffusion_controlnet_img2img_single_file.py index b3df7b6400cf..e4b2239f8b69 100644 --- a/tests/single_file/test_stable_diffusion_controlnet_img2img_single_file.py +++ b/tests/single_file/test_stable_diffusion_controlnet_img2img_single_file.py @@ -28,7 +28,7 @@ @slow @require_torch_accelerator -class StableDiffusionControlNetPipelineSingleFileSlowTests(SDSingleFileTesterMixin): +class TestStableDiffusionControlNetPipelineSingleFileSlowTests(SDSingleFileTesterMixin): pipeline_class = StableDiffusionControlNetPipeline ckpt_path = ( "https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5/blob/main/v1-5-pruned-emaonly.safetensors" diff --git a/tests/single_file/test_stable_diffusion_controlnet_inpaint_single_file.py b/tests/single_file/test_stable_diffusion_controlnet_inpaint_single_file.py index 820c9e31f2db..d047af6899fb 100644 --- a/tests/single_file/test_stable_diffusion_controlnet_inpaint_single_file.py +++ b/tests/single_file/test_stable_diffusion_controlnet_inpaint_single_file.py @@ -29,7 +29,7 @@ @slow @require_torch_accelerator -class StableDiffusionControlNetInpaintPipelineSingleFileSlowTests(SDSingleFileTesterMixin): +class TestStableDiffusionControlNetInpaintPipelineSingleFileSlowTests(SDSingleFileTesterMixin): pipeline_class = StableDiffusionControlNetInpaintPipeline ckpt_path = "https://huggingface.co/botp/stable-diffusion-v1-5-inpainting/blob/main/sd-v1-5-inpainting.ckpt" original_config = "https://raw.githubusercontent.com/runwayml/stable-diffusion/main/configs/stable-diffusion/v1-inpainting-inference.yaml" diff --git a/tests/single_file/test_stable_diffusion_controlnet_single_file.py b/tests/single_file/test_stable_diffusion_controlnet_single_file.py index a678d7f75182..4bee4fa4a1b2 100644 --- a/tests/single_file/test_stable_diffusion_controlnet_single_file.py +++ b/tests/single_file/test_stable_diffusion_controlnet_single_file.py @@ -28,7 +28,7 @@ @slow @require_torch_accelerator -class StableDiffusionControlNetPipelineSingleFileSlowTests(SDSingleFileTesterMixin): +class TestStableDiffusionControlNetPipelineSingleFileSlowTests(SDSingleFileTesterMixin): pipeline_class = StableDiffusionControlNetPipeline ckpt_path = ( "https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5/blob/main/v1-5-pruned-emaonly.safetensors" diff --git a/tests/single_file/test_stable_diffusion_img2img_single_file.py b/tests/single_file/test_stable_diffusion_img2img_single_file.py index eae371720246..1754c4d71652 100644 --- a/tests/single_file/test_stable_diffusion_img2img_single_file.py +++ b/tests/single_file/test_stable_diffusion_img2img_single_file.py @@ -22,7 +22,7 @@ @slow @require_torch_accelerator -class StableDiffusionImg2ImgPipelineSingleFileSlowTests(SDSingleFileTesterMixin): +class TestStableDiffusionImg2ImgPipelineSingleFileSlowTests(SDSingleFileTesterMixin): pipeline_class = StableDiffusionImg2ImgPipeline ckpt_path = ( "https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5/blob/main/v1-5-pruned-emaonly.safetensors" @@ -63,7 +63,7 @@ def test_single_file_format_inference_is_same_as_pretrained(self): @slow @require_torch_accelerator -class StableDiffusion21Img2ImgPipelineSingleFileSlowTests(SDSingleFileTesterMixin): +class TestStableDiffusion21Img2ImgPipelineSingleFileSlowTests(SDSingleFileTesterMixin): pipeline_class = StableDiffusionImg2ImgPipeline ckpt_path = "https://huggingface.co/stabilityai/stable-diffusion-2-1/blob/main/v2-1_768-ema-pruned.safetensors" original_config = "https://raw.githubusercontent.com/Stability-AI/stablediffusion/main/configs/stable-diffusion/v2-inference-v.yaml" diff --git a/tests/single_file/test_stable_diffusion_inpaint_single_file.py b/tests/single_file/test_stable_diffusion_inpaint_single_file.py index 48b7cb22af96..71ff2a180a30 100644 --- a/tests/single_file/test_stable_diffusion_inpaint_single_file.py +++ b/tests/single_file/test_stable_diffusion_inpaint_single_file.py @@ -23,7 +23,7 @@ @slow @require_torch_accelerator -class StableDiffusionInpaintPipelineSingleFileSlowTests(SDSingleFileTesterMixin): +class TestStableDiffusionInpaintPipelineSingleFileSlowTests(SDSingleFileTesterMixin): pipeline_class = StableDiffusionInpaintPipeline ckpt_path = "https://huggingface.co/botp/stable-diffusion-v1-5-inpainting/blob/main/sd-v1-5-inpainting.ckpt" original_config = "https://raw.githubusercontent.com/runwayml/stable-diffusion/main/configs/stable-diffusion/v1-inpainting-inference.yaml" @@ -79,7 +79,7 @@ def test_single_file_components_with_original_config_local_files_only(self): @slow @require_torch_accelerator -class StableDiffusion21InpaintPipelineSingleFileSlowTests(SDSingleFileTesterMixin): +class TestStableDiffusion21InpaintPipelineSingleFileSlowTests(SDSingleFileTesterMixin): pipeline_class = StableDiffusionInpaintPipeline ckpt_path = ( "https://huggingface.co/stabilityai/stable-diffusion-2-inpainting/blob/main/512-inpainting-ema.safetensors" diff --git a/tests/single_file/test_stable_diffusion_single_file.py b/tests/single_file/test_stable_diffusion_single_file.py index 618ab6c6165f..943f73e22c1c 100644 --- a/tests/single_file/test_stable_diffusion_single_file.py +++ b/tests/single_file/test_stable_diffusion_single_file.py @@ -27,7 +27,7 @@ @slow @require_torch_accelerator -class StableDiffusionPipelineSingleFileSlowTests(SDSingleFileTesterMixin): +class TestStableDiffusionPipelineSingleFileSlowTests(SDSingleFileTesterMixin): pipeline_class = StableDiffusionPipeline ckpt_path = ( "https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5/blob/main/v1-5-pruned-emaonly.safetensors" @@ -87,7 +87,7 @@ def test_single_file_legacy_scaling_factor(self): @slow -class StableDiffusion21PipelineSingleFileSlowTests(SDSingleFileTesterMixin): +class TestStableDiffusion21PipelineSingleFileSlowTests(SDSingleFileTesterMixin): pipeline_class = StableDiffusionPipeline ckpt_path = "https://huggingface.co/stabilityai/stable-diffusion-2-1/blob/main/v2-1_768-ema-pruned.safetensors" original_config = "https://raw.githubusercontent.com/Stability-AI/stablediffusion/main/configs/stable-diffusion/v2-inference-v.yaml" @@ -120,7 +120,7 @@ def test_single_file_format_inference_is_same_as_pretrained(self): @nightly @slow @require_torch_accelerator -class StableDiffusionInstructPix2PixPipelineSingleFileSlowTests(SDSingleFileTesterMixin): +class TestStableDiffusionInstructPix2PixPipelineSingleFileSlowTests(SDSingleFileTesterMixin): pipeline_class = StableDiffusionInstructPix2PixPipeline ckpt_path = "https://huggingface.co/timbrooks/instruct-pix2pix/blob/main/instruct-pix2pix-00-22000.safetensors" original_config = ( diff --git a/tests/single_file/test_stable_diffusion_upscale_single_file.py b/tests/single_file/test_stable_diffusion_upscale_single_file.py index a58e5f20c5eb..c848f401c7b9 100644 --- a/tests/single_file/test_stable_diffusion_upscale_single_file.py +++ b/tests/single_file/test_stable_diffusion_upscale_single_file.py @@ -24,7 +24,7 @@ @slow @require_torch_accelerator -class StableDiffusionUpscalePipelineSingleFileSlowTests(SDSingleFileTesterMixin): +class TestStableDiffusionUpscalePipelineSingleFileSlowTests(SDSingleFileTesterMixin): pipeline_class = StableDiffusionUpscalePipeline ckpt_path = "https://huggingface.co/stabilityai/stable-diffusion-x4-upscaler/blob/main/x4-upscaler-ema.safetensors" original_config = "https://raw.githubusercontent.com/Stability-AI/stablediffusion/main/configs/stable-diffusion/x4-upscaling.yaml" diff --git a/tests/single_file/test_stable_diffusion_xl_adapter_single_file.py b/tests/single_file/test_stable_diffusion_xl_adapter_single_file.py index e4e5bb961f20..52a38dedf504 100644 --- a/tests/single_file/test_stable_diffusion_xl_adapter_single_file.py +++ b/tests/single_file/test_stable_diffusion_xl_adapter_single_file.py @@ -31,7 +31,7 @@ @slow @require_torch_accelerator -class StableDiffusionXLAdapterPipelineSingleFileSlowTests(SDXLSingleFileTesterMixin): +class TestStableDiffusionXLAdapterPipelineSingleFileSlowTests(SDXLSingleFileTesterMixin): pipeline_class = StableDiffusionXLAdapterPipeline ckpt_path = "https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/blob/main/sd_xl_base_1.0.safetensors" repo_id = "stabilityai/stable-diffusion-xl-base-1.0" diff --git a/tests/single_file/test_stable_diffusion_xl_controlnet_single_file.py b/tests/single_file/test_stable_diffusion_xl_controlnet_single_file.py index 397fbc4b32a0..bb713ff00894 100644 --- a/tests/single_file/test_stable_diffusion_xl_controlnet_single_file.py +++ b/tests/single_file/test_stable_diffusion_xl_controlnet_single_file.py @@ -27,7 +27,7 @@ @slow @require_torch_accelerator -class StableDiffusionXLControlNetPipelineSingleFileSlowTests(SDXLSingleFileTesterMixin): +class TestStableDiffusionXLControlNetPipelineSingleFileSlowTests(SDXLSingleFileTesterMixin): pipeline_class = StableDiffusionXLControlNetPipeline ckpt_path = "https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/blob/main/sd_xl_base_1.0.safetensors" repo_id = "stabilityai/stable-diffusion-xl-base-1.0" diff --git a/tests/single_file/test_stable_diffusion_xl_img2img_single_file.py b/tests/single_file/test_stable_diffusion_xl_img2img_single_file.py index 7ea822ca3ab0..c5d2f86376e2 100644 --- a/tests/single_file/test_stable_diffusion_xl_img2img_single_file.py +++ b/tests/single_file/test_stable_diffusion_xl_img2img_single_file.py @@ -24,7 +24,7 @@ @slow @require_torch_accelerator -class StableDiffusionXLImg2ImgPipelineSingleFileSlowTests(SDXLSingleFileTesterMixin): +class TestStableDiffusionXLImg2ImgPipelineSingleFileSlowTests(SDXLSingleFileTesterMixin): pipeline_class = StableDiffusionXLImg2ImgPipeline ckpt_path = "https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/blob/main/sd_xl_base_1.0.safetensors" repo_id = "stabilityai/stable-diffusion-xl-base-1.0" diff --git a/tests/single_file/test_stable_diffusion_xl_single_file.py b/tests/single_file/test_stable_diffusion_xl_single_file.py index b2f7567f3f6d..e221095467c6 100644 --- a/tests/single_file/test_stable_diffusion_xl_single_file.py +++ b/tests/single_file/test_stable_diffusion_xl_single_file.py @@ -21,7 +21,7 @@ @slow @require_torch_accelerator -class StableDiffusionXLPipelineSingleFileSlowTests(SDXLSingleFileTesterMixin): +class TestStableDiffusionXLPipelineSingleFileSlowTests(SDXLSingleFileTesterMixin): pipeline_class = StableDiffusionXLPipeline ckpt_path = "https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/blob/main/sd_xl_base_1.0.safetensors" repo_id = "stabilityai/stable-diffusion-xl-base-1.0" From a957ea1f3694ee5878f4563f0e15c6528b6a39cd Mon Sep 17 00:00:00 2001 From: DN6 Date: Tue, 30 Sep 2025 12:36:17 +0530 Subject: [PATCH 5/5] update --- tests/single_file/test_lumina2_transformer.py | 2 +- tests/single_file/test_model_autoencoder_dc_single_file.py | 2 +- tests/single_file/test_model_controlnet_single_file.py | 2 +- .../single_file/test_model_flux_transformer_single_file.py | 2 +- tests/single_file/test_model_vae_single_file.py | 2 +- tests/single_file/test_model_wan_autoencoder_single_file.py | 2 +- .../single_file/test_model_wan_transformer3d_single_file.py | 4 ++-- tests/single_file/test_sana_transformer.py | 2 +- .../test_stable_diffusion_controlnet_img2img_single_file.py | 2 +- .../test_stable_diffusion_controlnet_inpaint_single_file.py | 2 +- .../test_stable_diffusion_controlnet_single_file.py | 2 +- .../test_stable_diffusion_img2img_single_file.py | 4 ++-- .../test_stable_diffusion_inpaint_single_file.py | 4 ++-- tests/single_file/test_stable_diffusion_single_file.py | 6 +++--- .../test_stable_diffusion_upscale_single_file.py | 2 +- .../test_stable_diffusion_xl_adapter_single_file.py | 2 +- .../test_stable_diffusion_xl_controlnet_single_file.py | 2 +- .../test_stable_diffusion_xl_img2img_single_file.py | 2 +- tests/single_file/test_stable_diffusion_xl_single_file.py | 2 +- 19 files changed, 24 insertions(+), 24 deletions(-) diff --git a/tests/single_file/test_lumina2_transformer.py b/tests/single_file/test_lumina2_transformer.py index 063c4ad4395b..bb5a0bf473b6 100644 --- a/tests/single_file/test_lumina2_transformer.py +++ b/tests/single_file/test_lumina2_transformer.py @@ -27,7 +27,7 @@ enable_full_determinism() -class TestLumina2Transformer2DModelSingleFileTests(SingleFileModelTesterMixin): +class TestLumina2Transformer2DModelSingleFile(SingleFileModelTesterMixin): model_class = Lumina2Transformer2DModel ckpt_path = "https://huggingface.co/Comfy-Org/Lumina_Image_2.0_Repackaged/blob/main/split_files/diffusion_models/lumina_2_model_bf16.safetensors" alternate_keys_ckpt_paths = [ diff --git a/tests/single_file/test_model_autoencoder_dc_single_file.py b/tests/single_file/test_model_autoencoder_dc_single_file.py index d57841c827c2..444ca4046977 100644 --- a/tests/single_file/test_model_autoencoder_dc_single_file.py +++ b/tests/single_file/test_model_autoencoder_dc_single_file.py @@ -32,7 +32,7 @@ enable_full_determinism() -class TestAutoencoderDCSingleFileTests(SingleFileModelTesterMixin): +class TestAutoencoderDCSingleFile(SingleFileModelTesterMixin): model_class = AutoencoderDC ckpt_path = "https://huggingface.co/mit-han-lab/dc-ae-f32c32-sana-1.0/blob/main/model.safetensors" repo_id = "mit-han-lab/dc-ae-f32c32-sana-1.0-diffusers" diff --git a/tests/single_file/test_model_controlnet_single_file.py b/tests/single_file/test_model_controlnet_single_file.py index 7c635326130e..2fa81fe3ae55 100644 --- a/tests/single_file/test_model_controlnet_single_file.py +++ b/tests/single_file/test_model_controlnet_single_file.py @@ -29,7 +29,7 @@ enable_full_determinism() -class TestControlNetModelSingleFileTests(SingleFileModelTesterMixin): +class TestControlNetModelSingleFile(SingleFileModelTesterMixin): model_class = ControlNetModel ckpt_path = "https://huggingface.co/lllyasviel/ControlNet-v1-1/blob/main/control_v11p_sd15_canny.pth" repo_id = "lllyasviel/control_v11p_sd15_canny" diff --git a/tests/single_file/test_model_flux_transformer_single_file.py b/tests/single_file/test_model_flux_transformer_single_file.py index 6331cdaf10f5..0642a71c5756 100644 --- a/tests/single_file/test_model_flux_transformer_single_file.py +++ b/tests/single_file/test_model_flux_transformer_single_file.py @@ -30,7 +30,7 @@ enable_full_determinism() -class TestFluxTransformer2DModelSingleFileTests(SingleFileModelTesterMixin): +class TestFluxTransformer2DModelSingleFile(SingleFileModelTesterMixin): model_class = FluxTransformer2DModel ckpt_path = "https://huggingface.co/black-forest-labs/FLUX.1-dev/blob/main/flux1-dev.safetensors" alternate_keys_ckpt_paths = ["https://huggingface.co/Comfy-Org/flux1-dev/blob/main/flux1-dev-fp8.safetensors"] diff --git a/tests/single_file/test_model_vae_single_file.py b/tests/single_file/test_model_vae_single_file.py index 9055d79e2f1b..9198d9b16337 100644 --- a/tests/single_file/test_model_vae_single_file.py +++ b/tests/single_file/test_model_vae_single_file.py @@ -32,7 +32,7 @@ enable_full_determinism() -class TestAutoencoderKLSingleFileTests(SingleFileModelTesterMixin): +class TestAutoencoderKLSingleFile(SingleFileModelTesterMixin): model_class = AutoencoderKL ckpt_path = ( "https://huggingface.co/stabilityai/sd-vae-ft-mse-original/blob/main/vae-ft-mse-840000-ema-pruned.safetensors" diff --git a/tests/single_file/test_model_wan_autoencoder_single_file.py b/tests/single_file/test_model_wan_autoencoder_single_file.py index 5f9fc97e203d..0babf302348f 100644 --- a/tests/single_file/test_model_wan_autoencoder_single_file.py +++ b/tests/single_file/test_model_wan_autoencoder_single_file.py @@ -27,7 +27,7 @@ enable_full_determinism() -class TestAutoencoderKLWanSingleFileTests(SingleFileModelTesterMixin): +class TestAutoencoderKLWanSingleFile(SingleFileModelTesterMixin): model_class = AutoencoderKLWan ckpt_path = ( "https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/blob/main/split_files/vae/wan_2.1_vae.safetensors" diff --git a/tests/single_file/test_model_wan_transformer3d_single_file.py b/tests/single_file/test_model_wan_transformer3d_single_file.py index 8dca2b6f0761..b76909206073 100644 --- a/tests/single_file/test_model_wan_transformer3d_single_file.py +++ b/tests/single_file/test_model_wan_transformer3d_single_file.py @@ -30,7 +30,7 @@ enable_full_determinism() -class TestWanTransformer3DModelText2VideoSingleFileTest(SingleFileModelTesterMixin): +class TestWanTransformer3DModelText2VideoSingleFile(SingleFileModelTesterMixin): model_class = WanTransformer3DModel ckpt_path = "https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/blob/main/split_files/diffusion_models/wan2.1_t2v_1.3B_bf16.safetensors" repo_id = "Wan-AI/Wan2.1-T2V-1.3B-Diffusers" @@ -38,7 +38,7 @@ class TestWanTransformer3DModelText2VideoSingleFileTest(SingleFileModelTesterMix @require_big_accelerator -class TestWanTransformer3DModelImage2VideoSingleFileTest(SingleFileModelTesterMixin): +class TestWanTransformer3DModelImage2VideoSingleFile(SingleFileModelTesterMixin): model_class = WanTransformer3DModel ckpt_path = "https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/blob/main/split_files/diffusion_models/wan2.1_i2v_480p_14B_fp8_e4m3fn.safetensors" repo_id = "Wan-AI/Wan2.1-I2V-14B-480P-Diffusers" diff --git a/tests/single_file/test_sana_transformer.py b/tests/single_file/test_sana_transformer.py index c810abbecb54..9e2adb93bf2b 100644 --- a/tests/single_file/test_sana_transformer.py +++ b/tests/single_file/test_sana_transformer.py @@ -11,7 +11,7 @@ enable_full_determinism() -class TestSanaTransformer2DModelSingleFileTests(SingleFileModelTesterMixin): +class TestSanaTransformer2DModelSingleFile(SingleFileModelTesterMixin): model_class = SanaTransformer2DModel ckpt_path = ( "https://huggingface.co/Efficient-Large-Model/Sana_1600M_1024px/blob/main/checkpoints/Sana_1600M_1024px.pth" diff --git a/tests/single_file/test_stable_diffusion_controlnet_img2img_single_file.py b/tests/single_file/test_stable_diffusion_controlnet_img2img_single_file.py index e4b2239f8b69..141748b084a0 100644 --- a/tests/single_file/test_stable_diffusion_controlnet_img2img_single_file.py +++ b/tests/single_file/test_stable_diffusion_controlnet_img2img_single_file.py @@ -28,7 +28,7 @@ @slow @require_torch_accelerator -class TestStableDiffusionControlNetPipelineSingleFileSlowTests(SDSingleFileTesterMixin): +class TestStableDiffusionControlNetPipelineSingleFileSlow(SDSingleFileTesterMixin): pipeline_class = StableDiffusionControlNetPipeline ckpt_path = ( "https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5/blob/main/v1-5-pruned-emaonly.safetensors" diff --git a/tests/single_file/test_stable_diffusion_controlnet_inpaint_single_file.py b/tests/single_file/test_stable_diffusion_controlnet_inpaint_single_file.py index d047af6899fb..8238866cbfb3 100644 --- a/tests/single_file/test_stable_diffusion_controlnet_inpaint_single_file.py +++ b/tests/single_file/test_stable_diffusion_controlnet_inpaint_single_file.py @@ -29,7 +29,7 @@ @slow @require_torch_accelerator -class TestStableDiffusionControlNetInpaintPipelineSingleFileSlowTests(SDSingleFileTesterMixin): +class TestStableDiffusionControlNetInpaintPipelineSingleFileSlow(SDSingleFileTesterMixin): pipeline_class = StableDiffusionControlNetInpaintPipeline ckpt_path = "https://huggingface.co/botp/stable-diffusion-v1-5-inpainting/blob/main/sd-v1-5-inpainting.ckpt" original_config = "https://raw.githubusercontent.com/runwayml/stable-diffusion/main/configs/stable-diffusion/v1-inpainting-inference.yaml" diff --git a/tests/single_file/test_stable_diffusion_controlnet_single_file.py b/tests/single_file/test_stable_diffusion_controlnet_single_file.py index 4bee4fa4a1b2..80ef6c2574c2 100644 --- a/tests/single_file/test_stable_diffusion_controlnet_single_file.py +++ b/tests/single_file/test_stable_diffusion_controlnet_single_file.py @@ -28,7 +28,7 @@ @slow @require_torch_accelerator -class TestStableDiffusionControlNetPipelineSingleFileSlowTests(SDSingleFileTesterMixin): +class TestStableDiffusionControlNetPipelineSingleFileSlow(SDSingleFileTesterMixin): pipeline_class = StableDiffusionControlNetPipeline ckpt_path = ( "https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5/blob/main/v1-5-pruned-emaonly.safetensors" diff --git a/tests/single_file/test_stable_diffusion_img2img_single_file.py b/tests/single_file/test_stable_diffusion_img2img_single_file.py index 1754c4d71652..e76846c800a8 100644 --- a/tests/single_file/test_stable_diffusion_img2img_single_file.py +++ b/tests/single_file/test_stable_diffusion_img2img_single_file.py @@ -22,7 +22,7 @@ @slow @require_torch_accelerator -class TestStableDiffusionImg2ImgPipelineSingleFileSlowTests(SDSingleFileTesterMixin): +class TestStableDiffusionImg2ImgPipelineSingleFileSlow(SDSingleFileTesterMixin): pipeline_class = StableDiffusionImg2ImgPipeline ckpt_path = ( "https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5/blob/main/v1-5-pruned-emaonly.safetensors" @@ -63,7 +63,7 @@ def test_single_file_format_inference_is_same_as_pretrained(self): @slow @require_torch_accelerator -class TestStableDiffusion21Img2ImgPipelineSingleFileSlowTests(SDSingleFileTesterMixin): +class TestStableDiffusion21Img2ImgPipelineSingleFileSlow(SDSingleFileTesterMixin): pipeline_class = StableDiffusionImg2ImgPipeline ckpt_path = "https://huggingface.co/stabilityai/stable-diffusion-2-1/blob/main/v2-1_768-ema-pruned.safetensors" original_config = "https://raw.githubusercontent.com/Stability-AI/stablediffusion/main/configs/stable-diffusion/v2-inference-v.yaml" diff --git a/tests/single_file/test_stable_diffusion_inpaint_single_file.py b/tests/single_file/test_stable_diffusion_inpaint_single_file.py index 71ff2a180a30..6e5d27cdffef 100644 --- a/tests/single_file/test_stable_diffusion_inpaint_single_file.py +++ b/tests/single_file/test_stable_diffusion_inpaint_single_file.py @@ -23,7 +23,7 @@ @slow @require_torch_accelerator -class TestStableDiffusionInpaintPipelineSingleFileSlowTests(SDSingleFileTesterMixin): +class TestStableDiffusionInpaintPipelineSingleFileSlow(SDSingleFileTesterMixin): pipeline_class = StableDiffusionInpaintPipeline ckpt_path = "https://huggingface.co/botp/stable-diffusion-v1-5-inpainting/blob/main/sd-v1-5-inpainting.ckpt" original_config = "https://raw.githubusercontent.com/runwayml/stable-diffusion/main/configs/stable-diffusion/v1-inpainting-inference.yaml" @@ -79,7 +79,7 @@ def test_single_file_components_with_original_config_local_files_only(self): @slow @require_torch_accelerator -class TestStableDiffusion21InpaintPipelineSingleFileSlowTests(SDSingleFileTesterMixin): +class TestStableDiffusion21InpaintPipelineSingleFileSlow(SDSingleFileTesterMixin): pipeline_class = StableDiffusionInpaintPipeline ckpt_path = ( "https://huggingface.co/stabilityai/stable-diffusion-2-inpainting/blob/main/512-inpainting-ema.safetensors" diff --git a/tests/single_file/test_stable_diffusion_single_file.py b/tests/single_file/test_stable_diffusion_single_file.py index 943f73e22c1c..377dedbc5731 100644 --- a/tests/single_file/test_stable_diffusion_single_file.py +++ b/tests/single_file/test_stable_diffusion_single_file.py @@ -27,7 +27,7 @@ @slow @require_torch_accelerator -class TestStableDiffusionPipelineSingleFileSlowTests(SDSingleFileTesterMixin): +class TestStableDiffusionPipelineSingleFileSlow(SDSingleFileTesterMixin): pipeline_class = StableDiffusionPipeline ckpt_path = ( "https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5/blob/main/v1-5-pruned-emaonly.safetensors" @@ -87,7 +87,7 @@ def test_single_file_legacy_scaling_factor(self): @slow -class TestStableDiffusion21PipelineSingleFileSlowTests(SDSingleFileTesterMixin): +class TestStableDiffusion21PipelineSingleFileSlow(SDSingleFileTesterMixin): pipeline_class = StableDiffusionPipeline ckpt_path = "https://huggingface.co/stabilityai/stable-diffusion-2-1/blob/main/v2-1_768-ema-pruned.safetensors" original_config = "https://raw.githubusercontent.com/Stability-AI/stablediffusion/main/configs/stable-diffusion/v2-inference-v.yaml" @@ -120,7 +120,7 @@ def test_single_file_format_inference_is_same_as_pretrained(self): @nightly @slow @require_torch_accelerator -class TestStableDiffusionInstructPix2PixPipelineSingleFileSlowTests(SDSingleFileTesterMixin): +class TestStableDiffusionInstructPix2PixPipelineSingleFileSlow(SDSingleFileTesterMixin): pipeline_class = StableDiffusionInstructPix2PixPipeline ckpt_path = "https://huggingface.co/timbrooks/instruct-pix2pix/blob/main/instruct-pix2pix-00-22000.safetensors" original_config = ( diff --git a/tests/single_file/test_stable_diffusion_upscale_single_file.py b/tests/single_file/test_stable_diffusion_upscale_single_file.py index c848f401c7b9..ba4819fadf85 100644 --- a/tests/single_file/test_stable_diffusion_upscale_single_file.py +++ b/tests/single_file/test_stable_diffusion_upscale_single_file.py @@ -24,7 +24,7 @@ @slow @require_torch_accelerator -class TestStableDiffusionUpscalePipelineSingleFileSlowTests(SDSingleFileTesterMixin): +class TestStableDiffusionUpscalePipelineSingleFileSlow(SDSingleFileTesterMixin): pipeline_class = StableDiffusionUpscalePipeline ckpt_path = "https://huggingface.co/stabilityai/stable-diffusion-x4-upscaler/blob/main/x4-upscaler-ema.safetensors" original_config = "https://raw.githubusercontent.com/Stability-AI/stablediffusion/main/configs/stable-diffusion/x4-upscaling.yaml" diff --git a/tests/single_file/test_stable_diffusion_xl_adapter_single_file.py b/tests/single_file/test_stable_diffusion_xl_adapter_single_file.py index 52a38dedf504..3d124fa8c23c 100644 --- a/tests/single_file/test_stable_diffusion_xl_adapter_single_file.py +++ b/tests/single_file/test_stable_diffusion_xl_adapter_single_file.py @@ -31,7 +31,7 @@ @slow @require_torch_accelerator -class TestStableDiffusionXLAdapterPipelineSingleFileSlowTests(SDXLSingleFileTesterMixin): +class TestStableDiffusionXLAdapterPipelineSingleFileSlow(SDXLSingleFileTesterMixin): pipeline_class = StableDiffusionXLAdapterPipeline ckpt_path = "https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/blob/main/sd_xl_base_1.0.safetensors" repo_id = "stabilityai/stable-diffusion-xl-base-1.0" diff --git a/tests/single_file/test_stable_diffusion_xl_controlnet_single_file.py b/tests/single_file/test_stable_diffusion_xl_controlnet_single_file.py index bb713ff00894..6f503702610a 100644 --- a/tests/single_file/test_stable_diffusion_xl_controlnet_single_file.py +++ b/tests/single_file/test_stable_diffusion_xl_controlnet_single_file.py @@ -27,7 +27,7 @@ @slow @require_torch_accelerator -class TestStableDiffusionXLControlNetPipelineSingleFileSlowTests(SDXLSingleFileTesterMixin): +class TestStableDiffusionXLControlNetPipelineSingleFileSlow(SDXLSingleFileTesterMixin): pipeline_class = StableDiffusionXLControlNetPipeline ckpt_path = "https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/blob/main/sd_xl_base_1.0.safetensors" repo_id = "stabilityai/stable-diffusion-xl-base-1.0" diff --git a/tests/single_file/test_stable_diffusion_xl_img2img_single_file.py b/tests/single_file/test_stable_diffusion_xl_img2img_single_file.py index c5d2f86376e2..56657f37d912 100644 --- a/tests/single_file/test_stable_diffusion_xl_img2img_single_file.py +++ b/tests/single_file/test_stable_diffusion_xl_img2img_single_file.py @@ -24,7 +24,7 @@ @slow @require_torch_accelerator -class TestStableDiffusionXLImg2ImgPipelineSingleFileSlowTests(SDXLSingleFileTesterMixin): +class TestStableDiffusionXLImg2ImgPipelineSingleFileSlow(SDXLSingleFileTesterMixin): pipeline_class = StableDiffusionXLImg2ImgPipeline ckpt_path = "https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/blob/main/sd_xl_base_1.0.safetensors" repo_id = "stabilityai/stable-diffusion-xl-base-1.0" diff --git a/tests/single_file/test_stable_diffusion_xl_single_file.py b/tests/single_file/test_stable_diffusion_xl_single_file.py index e221095467c6..4e5319ca25c7 100644 --- a/tests/single_file/test_stable_diffusion_xl_single_file.py +++ b/tests/single_file/test_stable_diffusion_xl_single_file.py @@ -21,7 +21,7 @@ @slow @require_torch_accelerator -class TestStableDiffusionXLPipelineSingleFileSlowTests(SDXLSingleFileTesterMixin): +class TestStableDiffusionXLPipelineSingleFileSlow(SDXLSingleFileTesterMixin): pipeline_class = StableDiffusionXLPipeline ckpt_path = "https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/blob/main/sd_xl_base_1.0.safetensors" repo_id = "stabilityai/stable-diffusion-xl-base-1.0"