Caching implementation to speedup video diffusion - #207
Merged
Conversation
Cherry-pick of imaginaire4 7e54d99e (MR !10482) onto the release/2026-08-18-ee5f5a61 base. The model-side implementation (diffusion_cache.py) and the taylorseer removal from unified_mot.py already landed via the 2026-08-18 i4 release sync. This picks up the remaining pieces: - Expose --diffusion-cache / --diffusion-cache-thresh / --diffusion-cache-residual-order on SetupArgs / SetupOverrides. - Install SeaCache from OmniInference._create rather than from scripts/inference.py, so any caller that opts in (CLI, Ray serve, cosmos-benchmarks EvalModel) goes through the same path. - Default the cache on for the inference CLI; it stays off for the shared library setup, so non-CLI callers are unchanged. - Drop the now-unused taylorseer.py and its NOTICE entry. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
lfengad
force-pushed
the
liangf/pick-diffusion-cache
branch
from
August 20, 2026 06:55
23fe76c to
785eabf
Compare
Dinghow
approved these changes
Aug 20, 2026
lfengad
enabled auto-merge (squash)
August 20, 2026 07:46
foreverlms
approved these changes
Aug 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cherry-pick of imaginaire4
7e54d99e(MR !10482) ontomain.Originally opened against
release/2026-08-18-ee5f5a61; rebased ontomain(cb76f47, the 2026-08-19 i4 release) after that release branch was superseded. The picked hunks are byte-identical to the previous revision of this PR.Why this is smaller than the upstream MR
The model-side implementation and the TaylorSeer removal from
unified_mot.pyalready landed onmainvia the i4 release syncs. Of the 8 files the MR touched, only these still needed picking:packages/cosmos3/cosmos3/common/args.pycosmos_framework/inference/common/args.pypackages/cosmos3/cosmos3/inference.pycosmos_framework/inference/inference.pypackages/cosmos3/cosmos3/scripts/inference.pycosmos_framework/scripts/inference.pyprojects/.../models/utils/taylorseer.py(deleted)NOTICEentry)projects/.../models/mot/diffusion_cache.pycosmos_framework/model/generator/mot/diffusion_cache.pyprojects/.../models/mot/unified_mot.pyprojects/cosmos3/cosmos3/CONTRIBUTING.mdCONTRIBUTING.mdprojects/.../models/mot/diffusion_cache_test.pyWhat it does
Exposes SeaCache (the diffusion-time inference cache) through the inference args:
--diffusion-cache/--no-diffusion-cache--diffusion-cache-thresh(default 0.35)--diffusion-cache-residual-order(default 1)Installed from
OmniInference._createrather than fromscripts/inference.py, so any caller that opts in — CLI, Ray serve, action policy servers, cosmos-benchmarksEvalModel— goes through the same path.Behavior change
The inference CLI now has the cache on by default. This is a lossy approximation, not just a speedup: when the accumulated relative-L1 SEA indicator stays under the threshold, the
language_modelevaluation is skipped and the generation residual is extrapolated via Newton divided differences. Generated video will differ from before.--no-diffusion-cacherestores the previous behavior exactly.Everything else is unchanged.
SetupOverrides.diffusion_cachedefaults toFalse, so Ray serve, the action policy servers,examples/, andupsample_promptsbehave identically unless they opt in — and with the flag off,_maybe_install_diffusion_cachereturns before importing the module or patching anything. AR / KV-cache (reasoner) paths bypass the cache automatically even when it is on.Notes
OmniInference._create) with the same surrounding context.taylorseer.pyhas zero importers onmain(theunified_mot.pyimport is already gone); itsNOTICEentry is removed alongside it so the file list stays accurate.Testing
mainapplied with no conflicts;git showof the rebased commit is identical to the pre-rebase diff.ruff checkpasses on all touched files, re-run after the rebase.inference/args_test.py,inference/common/args_test.py,inference/inference_test.py,inference/common/inference_test.py→ 51 passed, 2 failed. Both failures reproduced identically on the unmodified base and are CUDA-driver-too-old errors on the test node, not regressions. Not re-run on the new base.True, library defaultFalse, fields propagate through_build'smodel_dump(), and the override keys are accepted byDiffusionCache.Config.🤖 Generated with Claude Code