[tests] A tester mixin for running modular blocks on their own
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 35/100
Rechercherichtung
Read the existing mixins in tests/modular_pipelines/testing_utils/ and the standalone block tests under tests/modular_pipelines/, including the MiniMax H3 Image example in the issue. Compare how those tests initialize blocks, load components, and check inputs and outputs; define what the shared checks should cover across workflows. Done means the proposed mixin can run those checks for each top-level block, while model-specific assertions remain in each pipeline's test class.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
A modular pipeline is meant to be used in pieces: you can take the text encoder block, turn it into its own pipeline, and run it separately from the rest. We want that to keep working for every pipeline, and we want it to be intuitive to use that way. Today each test file checks the first by hand, if at all, and nothing checks the second.
What we want to test
For each top-level block of a pipeline (text encoder, VAE encoder, denoise, decode, ...):
- it builds into its own pipeline with
init_pipeline() - that pipeline loads only the components the block declares, e.g. just
vaefor a VAE encoder - it runs on the inputs it declares and returns the outputs it declares
- running the blocks one after another, each fed the outputs of the ones before it, gives the same result as the assembled pipeline
- it is intuitive to use on its own: what you pass in and what you get back make sense without knowing the rest of the pipeline
Is it intuitive to use this way?
Running image -> encoder -> denoise -> decoder by hand shows interface problems that the assembled pipeline hides. Patterns we have run into so far:
- Components it does not own. It would be weird for a VAE encoder block to require the transformer just because it reads a value from its config. A block run on its own should load only what it actually runs.
- Too much crossing a boundary. A decoder that takes packed latents also needs
latent_heightandlatent_widthto unpack them, so the user has to carry those over from the denoise step. We fixed this for flux, krea2 and ltx by making unpack part of the denoise group (#14730, #14737). What one block hands to the next should be a short, canonical list (prompt_embeds,image_latents,latents). - Optional in, something out. A text encoder block should not require the guider: the user should not have to configure guidance in two separate places, once for the text encoder and once for the denoiser. Run on its own, it gives back negative embeddings when you pass a
negative_promptand none when you don't. Getting anegative_prompt=Noneencoded anyway is unintuitive (#14469). - Redundant inputs. A denoise block that takes
image_latentsshould not also needheightandwidth, unless the pipeline supports an output size different from the reference's.
In this test we want to check for these specific patterns. We catch new ones over time during reviews, so the mixin should make adding one cheap.
What it looks like today
Fifteen test files under tests/modular_pipelines/ build a one-block pipeline by hand, each with its own setup. For example, from the MiniMax H3 Image tests:
class TestMiniMaxH3ImageModularBlocks(MiniMaxH3ImageModularPipelineTesterConfig):
def test_vae_encoder_block_standalone(self):
pipe = MiniMaxH3ImageEditVaeEncoderStep().init_pipeline(self.pretrained_model_name_or_path)
pipe.load_components(dtype=torch.float32)
reference_latents = pipe(
reference_images=[Image.new("RGB", (64, 32))],
generator=self.get_generator(0),
output="reference_latents",
)
assert set(pipe.components) == {"vae"}
assert len(reference_latents) == 1
assert reference_latents[0].shape == (1, 4, 8, 16)
The build, the load, the component check and the "does it return its output" check are the same for every block in every pipeline. Only the last assertion is specific to this model.
Proposal
A tester mixin next to the existing ones in tests/modular_pipelines/testing_utils/, composed with the same config class as the others. It walks the top-level blocks of each workflow and runs the checks above, so a new pipeline gets them without writing anything. Model-specific assertions stay as methods on the pipeline's own test class.
How to contribute
This issue carries the idea-contribution-welcome label. We are not currently looking for a PR here, we are looking for your feedback, especially if you use modular blocks on their own:
- other patterns you think this test should check for
- places where running a block standalone is unintuitive today: an input you did not expect to need, an output you did not expect to get, a value you had to carry from one block to the next
we may invite you to work with us on this once we agree on the implementation. If we decide to write the PR ourselves, anyone whose feedback shaped it will be added as a co-author.
Posted by Claude on behalf of @yiyixuxu. The text was drafted together and approved by yiyixuxu.
- Vorherrschende Sprache
- Python
- Sterne
- 35k
- Forks
- 7.5k
- Ø Merge
- 2 T. 22 Std.
- Gemergte PRs (30 T.)
- 58
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus huggingface/diffusers
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
huggingface/diffusers#15436 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
InpaintProcessor crashes when padding_mask_crop is set and a dimension is omittedEvtl. vergeben Ein verknüpfter Pull Request ist offen oder bereits gemergt. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
huggingface/diffusers#15433 ·
Maintainer antworten meist innerhalb von 1 Tag
-
LTXEulerAncestralRFScheduler skips signal scaling with s_noise=0Evtl. vergeben @hparik11 hat das vor 3 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
huggingface/diffusers#15423 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
Docs: 13 docstrings document parameters their functions don't haveEvtl. vergeben @M-Colley hat das vor 3 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
huggingface/diffusers#15363 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
`ZImageImg2ImgPipeline` / `ZImageInpaintPipeline`: explicit height/width different from the input image raises RuntimeErrorEvtl. vergeben @chessing234 hat das vor 11 Tagen übernommen. Offenbug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
huggingface/diffusers#15337 · 3 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in huggingface/diffusers
Ähnliche Issues
-
[19.0] pos_sale: settling an order with a 0 down payment line crashes (reading 'reward_id') and leaves a wrong amount dueEvtl. vergeben Ein verknüpfter Pull Request ist offen oder bereits gemergt. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 79/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 79/100
developmentseed/titiler-covjson#164 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
awslabs/visual-asset-management-system#2164 ·
Maintainer antworten meist innerhalb von 1 Tag
-
needs-triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 86/100
MakazhanAlpamys/Soup#3589 ·
Maintainer antworten meist innerhalb von 1 Tag
-
channels status reports the wrong Enabled value for Feishu instances and default-enabled WebSocketOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 86/100
Maintainer antworten meist innerhalb von 1 Tag