Uh oh!
There was an error while loading. Please reload this page.
Add SeaCache support for Cosmos3 pipelines - #14663
Conversation
yzhautouskay
commented
Aug 31, 2026
Claude-Opus 4.8 Self-review: |
| location | status | reason |
|---|---|---|
sea_cache.py:555_prepare_cosmos3_vision_metadata + first_block branch in _build_indicator | Likely-dead under default | only runs when indicator_source="first_block"; default is raw_vision_latents |
SeaCacheConfig.metadata_callback / raw_vision_callback | Likely-dead | no caller passes them; Cosmos3 uses native adapters |
_helpers.pyhidden_states_norm_module_name | Used only by first_block | tied to the non-default indicator |
Process reminders (AI-contribution guidelines)
- Uncommitted/untracked files in your worktree are NOT in the pushed diff but shouldn't get added:
check_cosmos3_transfer_workflow.py,run_cosmos3_modular_transfer.sh,assets/,examples/cosmos3/inference_cosmos3_modular_distilled.py, and an unstagedencoders.pyedit. The dev scripts/assets are ephemeral (per review-rules "Ephemeral context") — keep them out of the PR. - Add a coordination link (issue where a maintainer acknowledged this work) to the PR description.
- Add test commands + pasted results to the PR. Suggested:
pytest tests/hooks/test_sea_cache.py tests/models/transformers/test_models_transformer_cosmos3.py tests/pipelines/cosmos/test_cosmos3.py tests/modular_pipelines/cosmos/ -q.
Verdict: NEEDS CHANGES
Primary asks: split the three features (#1), trim defensive/unused paths (#2, #3). Tests are strong — real Cosmos3 model at tiny config, per-context cache isolation, fail-open, and dtype coverage all exercised, consistent with testing.md
sayakpaul
left a comment
There was a problem hiding this comment.
Thanks! The design looks mostly good. My major comment is that we're adding utilities to enable caching at the pipeline-level which is not something we typically do in the library.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
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. Please note that PRs without a linked issue are likely to be automatically closed 10 days after this notice. Once the PR links an issue (or gets the |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
@yiyixuxu@sayakpaul Thanks for the review! I addressed moving caching to the transformer level instead of pipeline, and refactored tests Few thing I will address next:
|
sayakpaul
left a comment
There was a problem hiding this comment.
Thanks for the updates! This looks much better!
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| This model-level API works with [`Cosmos3OmniPipeline`], [`Cosmos3OmniModularPipeline`], and | ||
| [`Cosmos3DistilledModularPipeline`]. SeaCache is an approximate optimization and may change generated outputs. Call | ||
| `pipe.transformer.disable_cache()` when you need every denoising step to execute the full transformer. |
There was a problem hiding this comment.
Nice, thanks for the note! From a quick skim of the paper, it doesn't look like it needs to be Cosmos3 specific no?
There was a problem hiding this comment.
I will try running SeaCache with other models, and will update the docs accordingly
There was a problem hiding this comment.
I added Wan T2V support in 14bba9f as a minimal example of integrating another model. So docs now clarify that Cosmos3 remains the optimized and benchmarked integration, but is not intended to be the only supported model
Uh oh!
There was an error while loading. Please reload this page.
sayakpaul
commented
Sep 3, 2026
/diffusers-bot pytest tests/models -k "seacache" |
✅ |
9009730 to
211d1d1Compareyiyixuxu
commented
Sep 6, 2026
cc @DN6@sayakpaul@yzhautouskay I Want to propose a design change on our cache here (see the code change bc12ffd): I think it's not very nice that we have to attach pipeline state into the cache config like this. we alreaddy use the pattern for PAB and FasterCache etc, and I understand where it's coming from: to minimize changes we have to make to the pipeline. However, I think (1) the info cache needs from the pipeline state is something we can standardize: usually info related to scheduler such as (2) I think API wise, it sits well with the withself.transformer.cache_context("cond", step=i, sigma=sigma, num_steps=num_steps):
...(3) it works the same for standard and modular pipeline, I think it would work out better/cleaner for standard pipeline, and for modular, we can avoid recreating the same "state capture" mechanism just for the cache to work (i.e. attach private attribute to the pipeline object for closure to read) -> in modular we have better state management and it does not make sense to copy pipeline like this let me know what you think! |
…Cache pipeline state callbacks Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HCdbvRpL9fv3h3WwSUPpfS
What does this PR do?
0.25, and at most2consecutive cached steps. This provides 2-3x speedup depending on inference params with on-par quality.Before submitting
self-reviewskill on the diff?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.