1
0
mirror of https://github.com/huggingface/diffusers.git synced 2026-10-24 20:59:27 +03:00
Files
diffusers/tests/modular_pipelines/echo/testing_utils.py
Akshan Krithick 6184688f71 move unpack out of the flux, krea2 and ltx decoders into the core denoise groups (#14737)
* add a modular test that pins the canonical latents form each family leaves in the state

* move unpack out of the flux, krea2 and ltx decoders into the core denoise groups

* pop the unpack step from a copy of the blocks in the deprecation tests

* let families that decode inside the denoise loop opt out of the latents-form test

* document the canonical latents form in the modular reference

* [docs] canonical latents form: name normalize, patchify and pack separately

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* require geometry on the unpack steps and test the deprecated decode path directly

* skip the canonical latents test explicitly for ltx 2.5 too

* remove the packed latents path in 0.47.0, five releases after 0.42

* update the latents_output_name comment for the explicit skips

* move the packed test latents to the test device

---------

Co-authored-by: YiYi Xu <yixu310@gmail.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-19 22:16:18 -10:00

66 lines
2.2 KiB
Python

# coding=utf-8
# Copyright 2026 HuggingFace Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import torch
from diffusers.modular_pipelines import EchoBlocks, EchoModularPipeline
from ..testing_utils import BaseModularPipelineTesterConfig
class EchoModularPipelineTesterConfig(BaseModularPipelineTesterConfig):
pipeline_class = EchoModularPipeline
pipeline_blocks_class = EchoBlocks
pretrained_model_name_or_path = "Echo-Team/tiny-echo-modular-pipe"
expected_latents_shape = (1, 4, 3, 16, 16)
params = frozenset(
[
"prompt",
"image",
"memory_images",
"memory_audio_waveforms",
"height",
"width",
"num_frames",
"frame_rate",
"model_frame_rate",
"sigmas",
]
)
batch_params = frozenset(["prompt"])
optional_params = frozenset(["num_videos_per_prompt", "latents", "audio_latents", "output_type"])
not_params = frozenset(["negative_prompt", "guidance_scale", "num_inference_steps"])
expected_workflow_blocks = {}
output_name = "videos"
def get_dummy_inputs(self, seed=0):
generator = self.get_generator(seed)
return {
"prompt": "a robot dancing",
"image": torch.rand((1, 3, 32, 32), generator=generator),
"memory_images": [
torch.rand((1, 3, 32, 32), generator=generator),
torch.rand((1, 3, 32, 32), generator=generator),
],
"generator": self.get_generator(seed),
"sigmas": [1.0, 0.0],
"height": 32,
"width": 32,
"num_frames": 5,
"frame_rate": 25.0,
"max_sequence_length": 16,
"output_type": "pt",
}