Repository navigation
Prefetch: keep subfolder weights that a root safetensors index maps to - #15184
Merged
Merged
Conversation
Member
Author
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
danielhanchen
added a commit
that referenced
this pull request
Oct 26, 2026
Adds `nvidia/Cosmos3-Nano` and `nvidia/Cosmos3-Edge` as Studio video families, following #13376 and #13378: text-to-video and image-to-video through diffusers' `Cosmos3OmniPipeline` (diffusers >= 0.41.0: 0.40.0 resolves a group-offloaded transformer's device as the CPU). **What's different about Cosmos3** - Its transformer is also the text model, so the pipeline has a tokenizer and no text encoder. A family whose bf16 component table prices the text encoder at 0.0 is now read as having none: sizing needs only transformer and VAE, a snapshot without `text_encoder/` counts as complete, and an explicit `text_encoder_quant` is refused with the reason (relates to #14000). - Each card samples with scheduler and call settings its shipped configs don't hold. New `VideoFamily` fields `scheduler_overrides` and `call_kwargs` carry them. - The pipeline takes the first frame through its own `image=` and crops it itself. - Components come from the nvidia repos: no unsloth-hosted copies exist, both are public and ungated (OpenMDW-1.1), allowlist gains the same two lines Wan2.1 has (relates to #14003). **Fidelity**: Studio output is frame-for-frame identical to the plain diffusers pipeline for both models (Nano 189/189 frames, Edge 121/121, four clips each, seed 0). Three settings were needed: `cudnn.benchmark` off, the VAE encoder on stock kernels, and untiled decode when it fits, including at speed off and under model / group / streaming offload (the stock 16x tiles leave a 4-latent edge tile at 480/832 px). When untiled does not fit, and on CPU / MPS, the tiled decode uses per-canvas strides that keep every edge tile at 8 or more latents (stock strides wherever they already do). **Also in this PR** (separate commits, can be split out; the root-index prefetch fix moved to #15184) - The latest-transformers offer in the UI covers the `cosmos3` / `cosmos3_edge` model types (the `unsloth run` prompt for it is left to a separate PR). - Frontend: picker rows, Hub "Video gen" label, page defaults; bundle budget raised by the bytes the rows add. **Tests**: backend and frontend suites show no new failures against main (same failing ids on both trees, all environment-related); typecheck clean. Real-weight renders were checked against plain diffusers outside the test suite (Edge on a B200: bit-identical, t2v and i2v; Edge on a T4: valid fp32 output). **Not in this PR**: training support, and quantized Cosmos3 checkpoints (#12851); diffusers has no single-file converter for `Cosmos3OmniTransformer`, so a quant needs a hosted source and a key-map loader. `cosmos_guardrail` is not required: Nano's `model_index.json` enables the safety checker by default, so the load either passes the opt-out or refuses with a message naming the package. Edge ships with it off. **Download and offload**: a Nano download skips `sound_tokenizer/` (1.99 GB, passed as None), a local Nano folder without `sound_tokenizer/` or `vision_encoder/` validates, and under `low_vram` the VAE goes back to the CPU after the conditioning encode for both t2v and i2v (real Edge: VAE on `cuda:0` at every transformer step before, `cpu` after). ## Screenshots Video page model picker on the merge base (left) and this branch (right): the branch lists Cosmos3 Edge after the HunyuanVideo rows.  The Hub pair below is harness state, not this PR: the two sides read the live Hub listing at different times, so the trending rows differ (the masked shot is otherwise identical). macOS and Windows legs: 41 of 41 steps identical. <!-- studio-regress:start --> ### Studio UI regression check Base `c9e5d4ab0` vs head `4aa1f7b91`. Functional: **NO_REGRESSION**, UI coverage 89%, 1 visual change(s), 0 text-only change(s). Only steps whose screenshots differ are shown. **crawl/r_hub**: masks cover 37% of the shot | reproduced on confirm (VISUAL_DIFF) Facts: `missing`: {'before': ['button:DeepSeek-V#.#-Flash-#-GGUF', 'button:Model hub', 'button:NVIDIA-Nemotron-#.#-Super-VL-#B-A#B-GGUF', 'button:Qwen#.#-#B-A#B-GGUF', 'button:Search', 'button:Show workflows', 'button:gemma-#-#B-A#B-it-GGUF'], 'after': ['button:Filters', 'button:MiniMax-H#-GGUF', 'button:NVIDIA-Nemotron-#.#-Super-VL-#B-A#B-GGUF', 'button:Show workflows']}  <!-- studio-regress:end --> --------- Co-authored-by: Daniel Han <[email protected]>
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.
maybe_prefetch_hf_snapshotwarms the cache before a bare remote load. For repos with weights at the root it drops every*/...safetensorsfile, since the load only reads root weights. That breaks repos whose rootmodel.safetensors.index.jsonmaps shards into subfolders.nvidia/Cosmos3-Nanoandnvidia/Cosmos3-Edgekeep every transformer shard undertransformer/and list them in the root index. The prefetch skips those shards, soFastModel/FastVisionModelthen download them uncached, or fail offline, unlessHF_HUB_OFFLINE=1is set by hand.Change
_root_index_weight_subfoldersreads the rootmodel.safetensors.index.jsonand returns the subfolders itsweight_mappoints into. Any failure (no index, 404, bad JSON, non-dict map) returns(), so the prefetch keeps its old behaviour.subfolder=, not tokenizer-only / adapter-only / GGUF. When it finds subfolders, the subdir-weight prune is skipped, like the ST case.revision,tokenandcache_dirare forwarded to the probe.Who is affected: only repos whose root index names a path with a
/. Root-sharded models (model-00001-of-00002.safetensorsat the root) return()and prune exactly as before. Repos without a root index get a 404 and keep their current path.Tests:
tests/test_root_index_subfolder_weights.py(19 cases) drives the prefetch through a fake Hub with a Cosmos3-shaped listing, a root-sharded listing and no index. It checks the allow/ignore patternssnapshot_downloadreceives and the probe's forwarded arguments. 11 of the 19 fail on main and all pass here. The existing prefetch tests (test_prefetch_snapshot_scope.py,test_st_subfolder_weights_are_fetched.py,python/test_revision_forwarding.py,test_hf_login_keeps_saved_token.py) still pass: 166 passed in total.Split out of #14554, which adds the Cosmos3 Studio video families. The Studio path loads through diffusers and does not depend on this.