[tests] A tester mixin for running modular blocks on their own
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 35/100
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Python
- スター
- 35k
- フォーク
- 7.5k
- 平均マージ
- 2日 22時間
- マージ済み PR(30日)
- 58
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
huggingface/diffusers のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
huggingface/diffusers#15436 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
InpaintProcessor crashes when padding_mask_crop is set and a dimension is omitted対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
huggingface/diffusers#15433 ·
メンテナーはふだん 1 日以内に返信
-
LTXEulerAncestralRFScheduler skips signal scaling with s_noise=0対応中かも @hparik11 が 3 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
huggingface/diffusers#15423 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
Docs: 13 docstrings document parameters their functions don't have対応中かも @M-Colley が 3 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
huggingface/diffusers#15363 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
`ZImageImg2ImgPipeline` / `ZImageInpaintPipeline`: explicit height/width different from the input image raises RuntimeError対応中かも @chessing234 が 11 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
huggingface/diffusers#15337 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
huggingface/diffusers の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 79/100
developmentseed/titiler-covjson#164 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
awslabs/visual-asset-management-system#2164 ·
メンテナーはふだん 1 日以内に返信
-
needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
MakazhanAlpamys/Soup#3589 ·
メンテナーはふだん 1 日以内に返信
-
channels status reports the wrong Enabled value for Feishu instances and default-enabled WebSocketオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
メンテナーはふだん 1 日以内に返信