|
1 | | -import pytest |
2 | 1 | import torch |
3 | 2 | from PIL import Image |
4 | 3 | from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer |
|
9 | 8 | DDIMScheduler, |
10 | 9 | MotionAdapter, |
11 | 10 | SparseControlNetModel, |
12 | | - StableDiffusionPipeline, |
13 | 11 | UNet2DConditionModel, |
14 | 12 | ) |
15 | 13 |
|
16 | 14 | from ...testing_utils import assert_tensors_close, torch_device |
17 | 15 | from ..pipeline_params import TEXT_TO_IMAGE_BATCH_PARAMS, TEXT_TO_IMAGE_PARAMS |
18 | | -from ..test_pipelines_common import PipelineFromPipeTesterMixin |
19 | 16 | from ..testing_utils import ( |
| 17 | + FromPipeTesterMixin, |
20 | 18 | IPAdapterTesterMixin, |
21 | 19 | LoraMemoryTesterMixin, |
22 | 20 | LoraTesterMixin, |
23 | 21 | MemoryTesterMixin, |
24 | 22 | UNetLoraTesterMixin, |
25 | 23 | ) |
26 | 24 | from .testing_utils import ( |
27 | | - FROM_PIPE_SKIP_REASON, |
28 | 25 | FreeInitTesterMixin, |
29 | 26 | MotionPipelineTesterConfig, |
30 | 27 | MotionPipelineTesterMixin, |
@@ -138,32 +135,6 @@ class TestAnimateDiffSparseControlNetPipeline( |
138 | 135 | MotionPipelineTesterMixin, |
139 | 136 | FreeInitTesterMixin, |
140 | 137 | ): |
141 | | - def test_from_pipe_consistent_config(self): |
142 | | - original_repo = "hf-internal-testing/tinier-stable-diffusion-pipe" |
143 | | - |
144 | | - # create StableDiffusionPipeline |
145 | | - pipe_original = StableDiffusionPipeline.from_pretrained(original_repo, requires_safety_checker=False) |
146 | | - |
147 | | - # StableDiffusionPipeline -> AnimateDiffSparseControlNetPipeline |
148 | | - pipe_components = self.get_dummy_components() |
149 | | - pipe_additional_components = { |
150 | | - name: component for name, component in pipe_components.items() if name not in pipe_original.components |
151 | | - } |
152 | | - pipe = self.pipeline_class.from_pipe(pipe_original, **pipe_additional_components) |
153 | | - |
154 | | - # AnimateDiffSparseControlNetPipeline -> StableDiffusionPipeline |
155 | | - original_pipe_additional_components = {} |
156 | | - for name, component in pipe_original.components.items(): |
157 | | - if name not in pipe.components or not isinstance(component, pipe.components[name].__class__): |
158 | | - original_pipe_additional_components[name] = component |
159 | | - |
160 | | - pipe_original_2 = StableDiffusionPipeline.from_pipe(pipe, **original_pipe_additional_components) |
161 | | - |
162 | | - # compare the config |
163 | | - original_config = {k: v for k, v in pipe_original.config.items() if not k.startswith("_")} |
164 | | - original_config_2 = {k: v for k, v in pipe_original_2.config.items() if not k.startswith("_")} |
165 | | - assert original_config_2 == original_config |
166 | | - |
167 | 138 | def test_dict_tuple_outputs_equivalent(self, expected_slice=None, expected_max_difference=1e-4): |
168 | 139 | if torch_device == "cpu" and expected_slice is None: |
169 | 140 | # fmt: off |
@@ -229,12 +200,9 @@ class TestAnimateDiffSparseControlNetPipelineLoRAMemory( |
229 | 200 | """LoRA x memory-optimization tests (group offload, CPU offload) for the pipeline.""" |
230 | 201 |
|
231 | 202 |
|
232 | | -@pytest.mark.skip(FROM_PIPE_SKIP_REASON) |
233 | 203 | class TestAnimateDiffSparseControlNetPipelineFromPipe( |
234 | | - AnimateDiffSparseControlNetPipelineTesterConfig, PipelineFromPipeTesterMixin |
| 204 | + AnimateDiffSparseControlNetPipelineTesterConfig, FromPipeTesterMixin |
235 | 205 | ): |
236 | | - """`from_pipe` forward-pass parity and offload round trip for the AnimateDiff SparseControlNet pipeline. |
| 206 | + """`from_pipe` round-trip tests against `StableDiffusionPipeline` for the AnimateDiff SparseControlNet pipeline.""" |
237 | 207 |
|
238 | | - Parked, not deleted: `test_from_pipe_consistent_config` runs for real as a method on the main test class above, |
239 | | - but the forward-pass checks in `PipelineFromPipeTesterMixin` have no pytest-style equivalent yet. |
240 | | - """ |
| 208 | + original_pipeline_repo = "hf-internal-testing/tinier-stable-diffusion-pipe" |
0 commit comments