Transfer support for Cosmos3 ModularPipeline#14150
Conversation
yiyixuxu
left a comment
There was a problem hiding this comment.
thanks a lot, i left some feedbacks
| ] | ||
|
|
||
| @torch.no_grad() | ||
| def __call__(self, components: Cosmos3OmniModularPipeline, state: PipelineState) -> PipelineState: |
There was a problem hiding this comment.
Can you consider using the same pattern as Helio for its chunk loop? https://github.com/huggingface/diffusers/blob/main/src/diffusers/modular_pipelines/helios/denoise.py
Basically, we make the outer chunk loop a proper LoopSequentialPipelineBlocks (see https://github.com/huggingface/diffusers/blob/main/src/diffusers/modular_pipelines/helios/denoise.py#L706) and write the inner denoiser loop as a plain block (see https://github.com/huggingface/diffusers/blob/main/src/diffusers/modular_pipelines/helios/denoise.py#L355)
There was a problem hiding this comment.
Yeah, I have looked at Helios pipeline, and the constraint was that LoopSequentialPipelineBlocks rejects non-leaf sub-blocks, and our inner timestep loop (Cosmos3TransferDenoiseStep -> Cosmos3DenoiseLoopWrapper) is itself a LoopSequentialPipelineBlocks, so the two loops can't both be loop-wrappers
And I went with keeping the inner loop as the decomposed LoopSequentialPipelineBlocks because that's the structure every other cosmos modality uses (vision/sound/action all subclass Cosmos3DenoiseLoopWrapper), leaving the chunk loop as the only transfer-specific piece, doing it with __call__ override of SequentialPipelineBlocks
Your proposal also works, but the transfer's inner denoise becomes a monolithic leaf block, diverging from the other modalities (cross-pipeline consistency with Helios vs. intra-cosmos consistency)
Let me know if I am missing something, and you would prefer the refactor
|
Hi @yzhautouskay, thanks for the PR! It does not appear to link an issue it fixes. If this PR addresses an existing issue, please add a closing keyword (e.g. |
What does this PR do?
Adds the transfer (structure-controlled) path to the Cosmos3 Modular pipeline (
Cosmos3OmniModularPipeline/Cosmos3OmniBlocks), letting users condition video generation on one or more control videos (segmentation, depth, edge/canny, blur, world-scenario map) in addition to the text prompt. This mirrors the transfer path in the task-basedCosmos3OmniPipelineand is element-wise consistent with itWhat this adds
transferworkflow for the modular pipeline, triggered automatically whencontrol_videosis passed -- no new pipeline class, it coexists with the existing modular modes (text2image,text2video,image2video,video2video, action, sound).Cosmos3TransferTextStepCosmos3TransferSetupStep,Cosmos3TransferPrepareLatentsStep,Cosmos3TransferPackSequenceStep,Cosmos3TransferSetTimestepsStepCosmos3TransferChunkVaeEncoderStep-> prepare -> denoise -> scheduler), with the denoiser consuming the packed static contexts through the shareddenoiser_input_fieldsmechanismCosmos3TransferDecodeChunkStep,Cosmos3TransferStitchStepmodular_blocks_cosmos3.pyvia theAuto*blocks (selected oncontrol_videos), with"transfer"added toavailable_workflows.Before submitting
.ai/review-rules.md?documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.