|
============================= test session starts ============================== |
|
platform linux -- Python 3.8.10, pytest-8.2.0, pluggy-1.5.0 |
|
rootdir: /diffusers |
|
configfile: pyproject.toml |
|
plugins: xdist-3.6.1, timeout-2.3.1, requests-mock-1.10.0 |
|
collected 15 items |
|
|
|
tests/single_file/test_stable_diffusion_inpaint_single_file.py ....FF... [ 60%] |
|
...... [100%] |
|
|
|
=================================== FAILURES =================================== |
|
_ StableDiffusionInpaintPipelineSingleFileSlowTests.test_single_file_components_with_original_config _ |
|
|
|
self = <tests.single_file.test_stable_diffusion_inpaint_single_file.StableDiffusionInpaintPipelineSingleFileSlowTests testMethod=test_single_file_components_with_original_config> |
|
pipe = StableDiffusionInpaintPipeline { |
|
"_class_name": "StableDiffusionInpaintPipeline", |
|
"_diffusers_version": "0.28.0.de... ], |
|
"unet": [ |
|
"diffusers", |
|
"UNet2DConditionModel" |
|
], |
|
"vae": [ |
|
"diffusers", |
|
"AutoencoderKL" |
|
] |
|
} |
|
|
|
single_file_pipe = StableDiffusionInpaintPipeline { |
|
"_class_name": "StableDiffusionInpaintPipeline", |
|
"_diffusers_version": "0.28.0.de... ], |
|
"unet": [ |
|
"diffusers", |
|
"UNet2DConditionModel" |
|
], |
|
"vae": [ |
|
"diffusers", |
|
"AutoencoderKL" |
|
] |
|
} |
|
|
|
|
|
def test_single_file_components_with_original_config( |
|
self, |
|
pipe=None, |
|
single_file_pipe=None, |
|
): |
|
pipe = pipe or self.pipeline_class.from_pretrained(self.repo_id, safety_checker=None) |
|
# Not possible to infer this value when original config is provided |
|
# we just pass it in here otherwise this test will fail |
|
upcast_attention = pipe.unet.config.upcast_attention |
|
|
|
single_file_pipe = single_file_pipe or self.pipeline_class.from_single_file( |
|
self.ckpt_path, |
|
original_config=self.original_config, |
|
safety_checker=None, |
|
upcast_attention=upcast_attention, |
|
) |
|
|
|
> self._compare_component_configs(pipe, single_file_pipe) |
|
|
|
tests/single_file/single_file_testing_utils.py:127: |
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
|
|
|
self = <tests.single_file.test_stable_diffusion_inpaint_single_file.StableDiffusionInpaintPipelineSingleFileSlowTests testMethod=test_single_file_components_with_original_config> |
|
pipe = StableDiffusionInpaintPipeline { |
|
"_class_name": "StableDiffusionInpaintPipeline", |
|
"_diffusers_version": "0.28.0.de... ], |
|
"unet": [ |
|
"diffusers", |
|
"UNet2DConditionModel" |
|
], |
|
"vae": [ |
|
"diffusers", |
|
"AutoencoderKL" |
|
] |
|
} |
|
|
|
single_file_pipe = StableDiffusionInpaintPipeline { |
|
"_class_name": "StableDiffusionInpaintPipeline", |
|
"_diffusers_version": "0.28.0.de... ], |
|
"unet": [ |
|
"diffusers", |
|
"UNet2DConditionModel" |
|
], |
|
"vae": [ |
|
"diffusers", |
|
"AutoencoderKL" |
|
] |
|
} |
|
|
|
|
|
def _compare_component_configs(self, pipe, single_file_pipe): |
|
for param_name, param_value in single_file_pipe.text_encoder.config.to_dict().items(): |
|
if param_name in ["torch_dtype", "architectures", "_name_or_path"]: |
|
continue |
|
assert pipe.text_encoder.config.to_dict()[param_name] == param_value |
|
|
|
PARAMS_TO_IGNORE = [ |
|
"torch_dtype", |
|
"_name_or_path", |
|
"architectures", |
|
"_use_default_values", |
|
"_diffusers_version", |
|
] |
|
for component_name, component in single_file_pipe.components.items(): |
|
if component_name in single_file_pipe._optional_components: |
|
continue |
|
|
|
# skip testing transformer based components here |
|
# skip text encoders / safety checkers since they have already been tested |
|
if component_name in ["text_encoder", "tokenizer", "safety_checker", "feature_extractor"]: |
|
continue |
|
|
|
assert component_name in pipe.components, f"single file {component_name} not found in pretrained pipeline" |
|
assert isinstance( |
|
component, pipe.components[component_name].__class__ |
|
), f"single file {component.__class__.__name__} and pretrained {pipe.components[component_name].__class__.__name__} are not the same" |
|
|
|
for param_name, param_value in component.config.items(): |
|
if param_name in PARAMS_TO_IGNORE: |
|
continue |
|
|
|
# Some pretrained configs will set upcast attention to None |
|
# In single file loading it defaults to the value in the class __init__ which is False |
|
if param_name == "upcast_attention" and pipe.components[component_name].config[param_name] is None: |
|
pipe.components[component_name].config[param_name] = param_value |
|
|
|
> assert ( |
|
pipe.components[component_name].config[param_name] == param_value |
|
), f"single file {param_name}: {param_value} differs from pretrained {pipe.components[component_name].config[param_name]}" |
|
E AssertionError: single file sample_size: 512 differs from pretrained 256 |
|
|
|
tests/single_file/single_file_testing_utils.py:85: AssertionError |
|
----------------------------- Captured stderr call ----------------------------- |
|
unet/diffusion_pytorch_model.safetensors not found |
|
|
|
Loading pipeline components...: 0%| | 0/6 [00:00<?, ?it/s] |
|
Loading pipeline components...: 17%|ββ | 1/6 [00:00<00:01, 4.94it/s] |
|
Loading pipeline components...: 33%|ββββ | 2/6 [00:01<00:03, 1.24it/s] |
|
Loading pipeline components...: 50%|βββββ | 3/6 [00:01<00:01, 1.81it/s] |
|
Loading pipeline components...: 100%|ββββββββββ| 6/6 [00:01<00:00, 3.40it/s] |
|
You have disabled the safety checker for <class 'diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion_inpaint.StableDiffusionInpaintPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances, disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 . |
|
|
|
Fetching 12 files: 0%| | 0/12 [00:00<?, ?it/s] |
|
Fetching 12 files: 100%|ββββββββββ| 12/12 [00:00<00:00, 103991.01it/s] |
|
|
|
Loading pipeline components...: 0%| | 0/6 [00:00<?, ?it/s]Some weights of the model checkpoint were not used when initializing CLIPTextModel: |
|
['text_model.embeddings.position_ids'] |
|
|
|
Loading pipeline components...: 50%|βββββ | 3/6 [00:00<00:00, 19.38it/s] |
|
Loading pipeline components...: 83%|βββββββββ | 5/6 [00:00<00:00, 7.49it/s] |
|
Loading pipeline components...: 100%|ββββββββββ| 6/6 [00:00<00:00, 9.08it/s] |
|
You have disabled the safety checker for <class 'diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion_inpaint.StableDiffusionInpaintPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances, disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 . |
|
_ StableDiffusionInpaintPipelineSingleFileSlowTests.test_single_file_components_with_original_config_local_files_only _ |
|
|
|
self = <tests.single_file.test_stable_diffusion_inpaint_single_file.StableDiffusionInpaintPipelineSingleFileSlowTests testMethod=test_single_file_components_with_original_config_local_files_only> |
|
pipe = StableDiffusionInpaintPipeline { |
|
"_class_name": "StableDiffusionInpaintPipeline", |
|
"_diffusers_version": "0.28.0.de... ], |
|
"unet": [ |
|
"diffusers", |
|
"UNet2DConditionModel" |
|
], |
|
"vae": [ |
|
"diffusers", |
|
"AutoencoderKL" |
|
] |
|
} |
|
|
|
single_file_pipe = StableDiffusionInpaintPipeline { |
|
"_class_name": "StableDiffusionInpaintPipeline", |
|
"_diffusers_version": "0.28.0.de... ], |
|
"unet": [ |
|
"diffusers", |
|
"UNet2DConditionModel" |
|
], |
|
"vae": [ |
|
"diffusers", |
|
"AutoencoderKL" |
|
] |
|
} |
|
|
|
|
|
def test_single_file_components_with_original_config_local_files_only( |
|
self, |
|
pipe=None, |
|
single_file_pipe=None, |
|
): |
|
pipe = pipe or self.pipeline_class.from_pretrained(self.repo_id, safety_checker=None) |
|
|
|
# Not possible to infer this value when original config is provided |
|
# we just pass it in here otherwise this test will fail |
|
upcast_attention = pipe.unet.config.upcast_attention |
|
|
|
with tempfile.TemporaryDirectory() as tmpdir: |
|
ckpt_filename = self.ckpt_path.split("/")[-1] |
|
local_ckpt_path = download_single_file_checkpoint(self.repo_id, ckpt_filename, tmpdir) |
|
local_original_config = download_original_config(self.original_config, tmpdir) |
|
|
|
single_file_pipe = single_file_pipe or self.pipeline_class.from_single_file( |
|
local_ckpt_path, |
|
original_config=local_original_config, |
|
safety_checker=None, |
|
upcast_attention=upcast_attention, |
|
local_files_only=True, |
|
) |
|
|
|
> self._compare_component_configs(pipe, single_file_pipe) |
|
|
|
tests/single_file/single_file_testing_utils.py:153: |
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
|
|
|
self = <tests.single_file.test_stable_diffusion_inpaint_single_file.StableDiffusionInpaintPipelineSingleFileSlowTests testMethod=test_single_file_components_with_original_config_local_files_only> |
|
pipe = StableDiffusionInpaintPipeline { |
|
"_class_name": "StableDiffusionInpaintPipeline", |
|
"_diffusers_version": "0.28.0.de... ], |
|
"unet": [ |
|
"diffusers", |
|
"UNet2DConditionModel" |
|
], |
|
"vae": [ |
|
"diffusers", |
|
"AutoencoderKL" |
|
] |
|
} |
|
|
|
single_file_pipe = StableDiffusionInpaintPipeline { |
|
"_class_name": "StableDiffusionInpaintPipeline", |
|
"_diffusers_version": "0.28.0.de... ], |
|
"unet": [ |
|
"diffusers", |
|
"UNet2DConditionModel" |
|
], |
|
"vae": [ |
|
"diffusers", |
|
"AutoencoderKL" |
|
] |
|
} |
|
|
|
|
|
def _compare_component_configs(self, pipe, single_file_pipe): |
|
for param_name, param_value in single_file_pipe.text_encoder.config.to_dict().items(): |
|
if param_name in ["torch_dtype", "architectures", "_name_or_path"]: |
|
continue |
|
assert pipe.text_encoder.config.to_dict()[param_name] == param_value |
|
|
|
PARAMS_TO_IGNORE = [ |
|
"torch_dtype", |
|
"_name_or_path", |
|
"architectures", |
|
"_use_default_values", |
|
"_diffusers_version", |
|
] |
|
for component_name, component in single_file_pipe.components.items(): |
|
if component_name in single_file_pipe._optional_components: |
|
continue |
|
|
|
# skip testing transformer based components here |
|
# skip text encoders / safety checkers since they have already been tested |
|
if component_name in ["text_encoder", "tokenizer", "safety_checker", "feature_extractor"]: |
|
continue |
|
|
|
assert component_name in pipe.components, f"single file {component_name} not found in pretrained pipeline" |
|
assert isinstance( |
|
component, pipe.components[component_name].__class__ |
|
), f"single file {component.__class__.__name__} and pretrained {pipe.components[component_name].__class__.__name__} are not the same" |
|
|
|
for param_name, param_value in component.config.items(): |
|
if param_name in PARAMS_TO_IGNORE: |
|
continue |
|
|
|
# Some pretrained configs will set upcast attention to None |
|
# In single file loading it defaults to the value in the class __init__ which is False |
|
if param_name == "upcast_attention" and pipe.components[component_name].config[param_name] is None: |
|
pipe.components[component_name].config[param_name] = param_value |
|
|
|
> assert ( |
|
pipe.components[component_name].config[param_name] == param_value |
|
), f"single file {param_name}: {param_value} differs from pretrained {pipe.components[component_name].config[param_name]}" |
|
E AssertionError: single file sample_size: 512 differs from pretrained 256 |
|
|
|
tests/single_file/single_file_testing_utils.py:85: AssertionError |
|
----------------------------- Captured stderr call ----------------------------- |
|
unet/diffusion_pytorch_model.safetensors not found |
|
|
|
Loading pipeline components...: 0%| | 0/6 [00:00<?, ?it/s] |
|
Loading pipeline components...: 17%|ββ | 1/6 [00:00<00:00, 5.11it/s] |
|
Loading pipeline components...: 33%|ββββ | 2/6 [00:01<00:03, 1.27it/s] |
|
Loading pipeline components...: 50%|βββββ | 3/6 [00:01<00:01, 1.84it/s] |
|
Loading pipeline components...: 100%|ββββββββββ| 6/6 [00:01<00:00, 3.47it/s] |
|
You have disabled the safety checker for <class 'diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion_inpaint.StableDiffusionInpaintPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances, disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 . |
|
|
|
Loading pipeline components...: 0%| | 0/6 [00:00<?, ?it/s]Some weights of the model checkpoint were not used when initializing CLIPTextModel: |
|
['text_model.embeddings.position_ids'] |
|
|
|
Loading pipeline components...: 67%|βββββββ | 4/6 [00:00<00:00, 23.56it/s] |
|
Loading pipeline components...: 100%|ββββββββββ| 6/6 [00:00<00:00, 10.16it/s] |
|
You have disabled the safety checker for <class 'diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion_inpaint.StableDiffusionInpaintPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances, disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 . |
|
=============================== warnings summary =============================== |
|
tests/single_file/test_stable_diffusion_inpaint_single_file.py::StableDiffusionInpaintPipelineSingleFileSlowTests::test_single_file_components_with_original_config |
|
tests/single_file/test_stable_diffusion_inpaint_single_file.py::StableDiffusionInpaintPipelineSingleFileSlowTests::test_single_file_components_with_original_config_local_files_only |
|
tests/single_file/test_stable_diffusion_inpaint_single_file.py::StableDiffusion21InpaintPipelineSingleFileSlowTests::test_single_file_components_with_original_config |
|
tests/single_file/test_stable_diffusion_inpaint_single_file.py::StableDiffusion21InpaintPipelineSingleFileSlowTests::test_single_file_components_with_original_config_local_files_only |
|
/diffusers/src/diffusers/loaders/single_file_utils.py:604: FutureWarning: `image_size` is deprecated and will be removed in version 1.0.0. Configuring UNet2DConditionModel with the `upcast_attention` argument to `from_single_file`is deprecated and will be ignored in future versions. |
|
deprecate("image_size", "1.0.0", deprecation_message) |
|
|
|
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html |
|
=========================== short test summary info ============================ |
|
FAILED tests/single_file/test_stable_diffusion_inpaint_single_file.py::StableDiffusionInpaintPipelineSingleFileSlowTests::test_single_file_components_with_original_config |
|
FAILED tests/single_file/test_stable_diffusion_inpaint_single_file.py::StableDiffusionInpaintPipelineSingleFileSlowTests::test_single_file_components_with_original_config_local_files_only |
|
============= 2 failed, 13 passed, 4 warnings in 133.82s (0:02:13) ============= |
|
|