Skip to content

Studio: video families default to a hosted quantized text encoder - #14000

Merged
danielhanchen merged 16 commits into
mainfrom
studio-video-te-quant-default
Oct 18, 2026
Merged

danielhanchen merged 16 commits into
mainfrom
studio-video-te-quant-default

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Studio: video families default to a hosted quantized text encoder

An unset text_encoder_quant on a video load now takes a hosted pre-quantized text encoder, the scheme ComfyUI's official workflow template uses for that family. none / off still pin the released dense encoder, and an explicit scheme pins itself.

Family Text encoder ComfyUI template Default Hosted file
Wan2.2 TI2V-5B, T2V-A14B, Wan2.1 T2V-1.3B, 14B UMT5-XXL umt5_xxl_fp8_e4m3fn_scaled fp8 unsloth/Wan2.2-TI2V-5B-FP8/Wan2.2-TI2V-5B-text_encoder-FP8.safetensors (new, one file for all four)
LTX-2 / LTX-2.3 Gemma 3 12B gemma_3_12B_it_fp4_mixed fp8 (nearest hosted) unsloth/LTX-2-FP8/LTX-2-text_encoder-FP8.safetensors (existing)
LTX-2.5 Gemma 4 12B (Lightricks) int8 ConvRot int8 ConvRot unsloth/LTX-2.5-FP8/LTX-2.5-text_encoder-INT8-ConvRot.safetensors (new)
HunyuanVideo-1.5 480p / 720p Qwen2.5-VL-7B text tower (+ ByT5, kept dense) qwen_2.5_vl_7b_fp8_scaled fp8 unsloth/HunyuanVideo-1.5-FP8/HunyuanVideo-1.5-text_encoder-FP8.safetensors (new)
MiniMax-H3 unchanged

What changed

  • VideoFamily.te_quant_auto, resolved once per load (video_te_quant_request) in load_pipeline, the load worker's plan and download_plan, so the memory budget, the staged files and the injection agree. An automatic pick the host cannot run (no CUDA bf16) or that does not engage (file not published, offline) keeps the dense encoder instead of refusing the load. The status badge reports the raw request with source auto.
  • UMT5: Wan2.2 5B / A14B ship byte-identical bf16 encoders, Wan2.1 1.3B / 14B byte-identical fp32 ones, and every Wan2.1 fp32 tensor rounds to the Wan2.2 bf16 tensor bit for bit, so the four bases form one equivalence group and share one file. An opt-in int8 ConvRot UMT5 file sits beside the fp8 one (text_encoder_quant=int8).
  • The int8 ConvRot loader builds encoder-only classes (T5 / UMT5 encoder.block, no lm_head, _keep_in_fp32_modules stay float32) and fills a tied alias the file stores once.
  • convert_prequant_to_safetensors.py --drop-tied-copies stores a tied embedding once; the UMT5 fp8 file is 7.74 GB instead of 9.84 GB.
  • build_te_int8_convrot_checkpoint.py handles UMT5.
  • VAEs stay dense on every family, as in every ComfyUI template.

Quality (encoder is the only variable; DiT, VAE, seeds and noise fixed; dense A/A in separate processes is bit-identical)

Family Scheme LPIPS-alex mean / max SSIM Encoder resident GiB
Wan2.2 TI2V-5B, 640x352, 33 frames, 20 steps fp8 0.140 / 0.446 0.813 10.58 -> 7.21
int8 ConvRot 0.139 / 0.380 0.806 10.58 -> 6.27
Wan2.1 T2V-1.3B, 480x272, 33 frames, 30 steps fp8 0.125 / 0.454 0.835 10.58 -> 7.21
int8 ConvRot 0.098 / 0.250 0.851 10.58 -> 6.27
HunyuanVideo-1.5 480p, 480x272, 33 frames, 20 steps fp8 0.275 / 0.417 0.632 13.17 -> 7.09
LTX-2, 768x512, 121 frames, 40 steps fp8 0.154 / 0.491 0.855 22.7 -> 12.3
LTX-2.5, 768x512, 121 frames, 8 steps int8 ConvRot 0.270 / 0.484 0.746 22.3 -> 12.1

Subject, scene and composition are preserved in every clip; the differences are sampled motion, pose and framing, with no artefacts. The hosted LTX-2.5 file is bit-identical to the existing at-load int8 path (all 1005 tensors and the packed hidden states).

Through VideoBackend on Wan2.2 TI2V-5B (640x352, 33 frames): unset loads the hosted fp8 encoder (7.21 GiB resident, status source auto), none loads the dense one (10.58 GiB); peak 20.8 vs 24.1 GiB.

VAE (fp8 layerwise vs dense, same latents)

VAE Resident GiB Decode s LPIPS mean / max SSIM
Wan2.2 TI2V-5B (fp32) 2.63 -> 0.66 1.50 -> 1.48 0.0020 / 0.0034 0.990
LTX-2.5 (bf16) 1.35 -> 0.68 0.056 -> 0.060 0.0015 / 0.0034 0.994

Kept dense: ComfyUI uses dense VAEs, the saving is small next to the DiT and encoder, and fp8 is not lossless.

Tests

tests/test_video_te_quant_default.py (defaults resolve to the hosted file, none/off pin dense, equivalence groups, UMT5 int8 ConvRot build, tied alias fill, converter), plus a load-path test that an automatic pick that does not engage loads dense without a refusal while an explicit fp8 is still refused.

… ComfyUI's templates

An unset text_encoder_quant on Wan2.1 / Wan2.2, LTX-2 / LTX-2.3 and HunyuanVideo-1.5 now resolves to the family's
te_quant_auto (fp8, the scheme each ComfyUI workflow template loads) and takes the hosted pre-cast file; none / off
still pin the released encoder, and an automatic pick the host cannot run or that does not engage loads dense
without a refusal. The download plan and memory budget resolve the same default.

UMT5-XXL: one fp8 and one int8 ConvRot file in unsloth/Wan2.2-TI2V-5B-FP8 serve all four Wan bases (one
equivalence group: Wan2.1's fp32 encoder rounds to Wan2.2's bf16 one bit for bit). The int8 ConvRot loader now
builds headless encoder-only classes (encoder.block stack, no lm_head, fp32-kept modules stay fp32) and fills a
tied alias the file stores once; the converter gains --drop-tied-copies so the UMT5 fp8 file does not carry the
2.1 GB embedding twice. HunyuanVideo-1.5's Qwen2.5-VL text tower gets unsloth/HunyuanVideo-1.5-FP8 (480p and 720p
share it); ByT5 stays dense.
UMT5 / T5 encoder blocks quantize q/k/v/o and wi_0 / wi_1 / wo; --keep-dense leaves named projections dense, and a
kept fp32 module (T5 wo) is stored float32. Metadata records the key pattern and the kept projections.
…as ComfyUI's LTX-2.5 templates

An unset text_encoder_quant on LTX-2.5 now runs the int8 ConvRot encoder; none / off pin bf16 and
UNSLOTH_LTX25_TE_INT8=0 turns the unset default off. The sidecar worker loads
unsloth/LTX-2.5-FP8/LTX-2.5-text_encoder-INT8-ConvRot.safetensors (13.03 GB), the saved state dict of
its own at-load build (scripts/build_ltx25_te_int8_convrot.py), instead of reading the 23.9 GB bf16
encoder and quantizing it: meta-init from the pack's text_encoder config, Int8ConvRotLinear swap, strict
assign, the tied lm_head re-tied. On the real encoder every one of the 1005 tensors and the packed
hidden states of 4 prompts are bit-identical to the at-load path. A file that is missing, from another
base or does not match falls back to quantizing the dense encoder at load; a scoped snapshot that
skipped the dense shards retries the pack's Hub id.
…its dense shards

_te_prequant_sources answers for LTX-2.5 from video_ltx25.ltx25_te_prequant_sources, so the estimate,
the download plan and the pre-fetch stage the hosted int8 ConvRot file and skip text_encoder/ weights
only when it resolves. The worker gets the upstream base id, and a skipped text_encoder is not topped
up into the pipeline snapshot (the worker owns it).
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-18T18:04:00.454789Z df66466 Manual request
🔒 Security Review ⚠️ Failed 2026-10-16T12:11:50.489750Z 64b1a36 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ef092f970f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

Comment on lines +210 to +212
from huggingface_hub import hf_hub_download

return hf_hub_download(spec["repo"], spec["filename"], **common)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Resolve the staged LTX encoder from alternate cache roots

When local_files_only is enabled after the Hub cache root has changed, _fetch_te_prequant can successfully stage the hosted file from an older cache root via reuse_other_cache_root=True and consequently omit the dense encoder from the scoped base snapshot. This plain hf_hub_download lookup is pinned to the current cache_dir, so the worker misses that already accepted artifact; _load_dense then refuses its hub_repo retry under local_files_only, leaving neither hosted nor dense weights and failing the load. Use the same alternate-root-aware resolver as the staging path.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Real: staging accepts a copy under huggingface_hub's own root, but the worker looked only in the configured cache_dir, so an offline load had neither the hosted file nor the dense shards. Fixed in 9b1563d: _hosted_path does the same switch to the other root as hf_hub_download_with_xet_fallback, and the configured root still wins when it has the file. Test: test_hosted_path_resolves_a_copy_under_the_other_cache_root.

Comment thread scripts/build_ltx25_te_int8_convrot.py Outdated
if config.get("_te_source") != "quantized_at_load":
raise SystemExit(f"expected the at-load build, got {config.get('_te_source')!r}")
quantized = sum(1 for m in model.modules() if isinstance(m, _int8_convrot_linear_class()))
tensors = {k: v.detach().to("cpu").contiguous() for k, v in model.state_dict().items()}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Remove the tied LM head before serializing

worker._load does not actually trim this model's head because trim_text_encoder only recognizes Qwen3VLForConditionalGeneration, while Gemma 4 declares lm_head.weight tied to the input embedding in the Transformers implementation. Calling raw model.state_dict() therefore returns both names, and this comprehension makes independent contiguous copies before the custom writer serializes them, so the hosted artifact contains the supposedly omitted 262k-vocabulary BF16 head and is inflated by roughly 2 GB, increasing download and peak host-memory requirements beyond the documented build. Explicitly drop lm_head.weight before constructing the tensor map.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The shipped file does not carry the head: the worker's dead-tail truncation (diffusion_te_truncate.apply_truncation, not trim_text_encoder) swaps the unread head for NoLogitsHead before state_dict(), and the artifact has 1005 keys with no lm_head. The builder relied on that implicitly though, so 9b1563d drops lm_head.weight whenever it shares storage with the embedding. Test: test_builder_drops_a_tied_lm_head.

danielhanchen and others added 2 commits October 16, 2026 05:53
…ker resolves the hosted encoder across cache roots, builder drops a tied head and builds on the CPU without a card

[skip ci]
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: 9b1563d958

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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 16, 2026
….cpp release cannot cover the scene (#14007)

## Summary

`studiobench CI / Real-path session, every action ran` failed on #13986
and #14000, which are unrelated. On the same base (a1d4daa) it passed
on two other PRs a few minutes later. Both failures are the same click
timeout:

```
cell FAILED: TimeoutError: ElementHandle.click: Timeout 8000ms exceeded.
  - <div class="mt-4 flex shrink-0 flex-wrap items-center gap-x-1 gap-y-2 justify-between">... from <div data-testid="overlay-rail" ...> subtree intercepts pointer events
```

That element is the action row of `LlamaUpdateBanner`, the "llama.cpp
update available" card in the bottom-right overlay rail.

| run | llama.cpp installed | start (UTC) | result |
|---|---|---|---|
| #14000 | b11669 | 13:07 | click intercepted |
| #13986 | b11669 | 13:06 | click intercepted |
| studio-video-unsloth-mirrors | b11681 | 13:09 | pass |
| studio-flux3-klein | b11681 | 13:13 | pass |

`unslothai/llama.cpp` published b11681 at 13:07:33, between the install
and the session. The two failing runs were then one release behind, so
Studio offered the update over the controls the scene clicks. Nothing in
Studio or in either PR is wrong: any run that straddles a llama.cpp
release hits it.

## Change

- The `liveness` job boots Studio with `UNSLOTH_DISABLE_UPDATE_CHECK=1`.
The backend's llama, whisper and audio update status already honours it
and reports `update_checks_disabled`, so no card is offered. The session
measures chat rendering against its own pacer, so update UI is not part
of what it checks.
- `tests/studio/test_studiobench_ci_update_checks_off.py` requires every
studiobench job that boots Studio to set it, and checks that the name
still matches what `utils/update_status.py` reads. It runs in
`workflow-trigger-lint`, as `test_workflow_guards_run_unfiltered.py`
requires of workflow-reading guards.

## Testing

- New guard: 2 passed. With the workflow change reverted it fails.
- `test_workflow_guards_run_unfiltered.py` plus the other tests that
read `workflow-trigger-lint.yml`: 176 passed.
@danielhanchen

Copy link
Copy Markdown
Member Author

Two reds on this branch, from the run on a1d4daa:

  1. (Python 3.13, rest): studio/backend/tests/test_video_te_quant_default.py::test_the_converter_can_store_a_tied_embedding_once, which this PR adds, fails with ModuleNotFoundError: No module named 'diffusers' from core/inference/diffusion_precision.py:482 (_cast_fp8). That shard has no diffusers, so the test needs pytest.importorskip("diffusers"), or the converter path it exercises needs to avoid importing it.
  2. Frontend build + bundle sanity: the startup bundle overage is main's, fixed by Studio: raise the startup bundle budget by #13998's growth #14004. It clears on a rebase.

_cast_fp8 imports diffusers' layerwise casting hooks, and the CPU rest
shard does not install diffusers, so the test failed with
ModuleNotFoundError there. Skip it like the sibling fp8 cast test does.
chatgpt-codex-connector[bot]

This comment was marked as resolved.

…miss, MPS Wan int8, exact LTX-2.5 base, claimed repo

- An automatic encoder pick whose hosted file is not injected keeps the released
  encoder instead of casting it at runtime (what video_te_quant_request documents).
- An explicit Wan int8 on MPS reaches the hosted ConvRot file instead of being
  rewritten to fp8 and refused.
- The hosted encoder repo is claimed in asset_repos while a load fetches it.
- LTX-2.5's hosted encoder replaces only the exact official base (or its HF cache
  snapshot), not a pack that shares the folder name.
- The ConvRot builder also quantizes a non-gated T5 feed-forward (wi).

[skip ci]
chatgpt-codex-connector[bot]

This comment was marked as resolved.

…e and stays off under Speed off

- Only an exactly identified official base (or its HF cache snapshot, or a verified
  equivalent) takes the hosted encoder by default; a custom pack that shares the folder
  name keeps its own weights.
- Speed="off" is bit-exact: an unset encoder request keeps the released encoder, LTX-2.5's
  int8 default included. Explicit schemes are unchanged.

[skip ci]
chatgpt-codex-connector[bot]

This comment was marked as resolved.

…r, keep tied heads

LTX-2.5 prices the int8 encoder only when the hosted file applies; the at-load
fallback materializes the dense encoder first. Wan's int8 UMT5 gets its own
measured budget factor. --drop-tied-copies keeps a tied lm_head, which the
loader never fills.

[skip ci]
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 18, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 18, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 18, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 18, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 18, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 18, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 18, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 18, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 18, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 18, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 18, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 18, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 7c5b68ad0c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

# Conflicts:
#	studio/backend/core/inference/diffusion.py
#	studio/backend/core/inference/diffusion_te_prequant.py
chatgpt-codex-connector[bot]

This comment was marked as resolved.

…back reads the cache

A load planned at the hosted int8 file's size now refuses the dense
quantize-at-load fallback when free memory cannot hold the dense encoder,
the offline dense fallback still tries the cached Hub id, and the scheme
error no longer suggests unset for bf16.

[skip ci]
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 18, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 18, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 18, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: df66466a3a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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
danielhanchen merged commit 9877243 into main Oct 18, 2026
@danielhanchen
danielhanchen deleted the studio-video-te-quant-default branch October 18, 2026 20:05
sbabamohamad added a commit to sbabamohamad/unsloth that referenced this pull request Oct 21, 2026
Adds nvidia/Cosmos3-Nano and nvidia/Cosmos3-Edge to the Video page through diffusers'
Cosmos3OmniPipeline (diffusers >= 0.40.0): text-to-video, and image-to-video from a first
frame, following the layout of the Wan2.1 families (unslothai#13376) and the image-to-video path
of unslothai#13378.

Cosmos3 differs from the other video families in three ways the generic path did not
handle, and each gets the smallest change that fits:

- Its transformer is also its 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 requires only transformer and vae, a cached snapshot without a
  text_encoder/ folder counts as complete, and an explicit text_encoder_quant is refused
  with the reason (relates to unslothai#14000).
- Each card samples with scheduler and call settings that its shipped configs do not hold.
  New VideoFamily fields scheduler_overrides and call_kwargs carry them; a scheduler that
  rejects an override keeps its config.
- The pipeline takes the first frame through its own image= argument and crops it itself
  (i2v_fits_first_frame = False; same pipeline class for both modes).

Fidelity, measured against the plain diffusers pipeline at the cards' settings, seed 0,
with Studio's own encoder on both sides: every frame identical for Nano (189 of 189, four
clips) and Edge (121 of 121, four clips). Three settings were needed to get there and are
set on both rows:
- cudnn.benchmark off: two server processes otherwise rendered one Edge seed 55 dB (t2v)
  and 30 dB (i2v) apart.
- The VAE encoder stays on the stock kernels: Edge image-to-video at the default speed was
  29.5 dB from the card's output through the fused encoder, 51.8 dB with the stock one.
- Cosmos3 decodes untiled when it fits, on every speed tier, with tiled decode as the
  out-of-memory fallback: the stock 16x tiles leave a 4-latent edge tile at 480 / 832 px
  and a faint seam. The seam is recorded as a strict expected failure in the tile-geometry
  test so a fix forces the entry out.

Also in this commit: the local layout check reads a diffusers-library *Tokenizer component
as a model, so Nano's sound_tokenizer/ no longer makes a complete local folder look broken;
the download planner recognises the text_tokenizer/-without-text_encoder/ listing as
Cosmos3's; the Reasoner, Policy, Sim, Transfer and FP8 builds are refused by name with the
repo to load instead; Cosmos3-Super gets no family; the Hub catalog reads Cosmos3 pipelines
as "Video gen"; a renamed local Cosmos3 folder is refused by the trainer instead of falling
to the SDXL path; and the guardrail opt-out is passed through when the cosmos_guardrail
package is absent.

Components are fetched from the nvidia repos: no unsloth-hosted copies exist, both repos
are public and ungated (OpenMDW-1.1), and the allowlist gains the same two lines Wan2.1
has (relates to unslothai#14003). Quantized Cosmos3 checkpoints are a follow-up (unslothai#12851): diffusers
has no single-file converter for Cosmos3OmniTransformer, so a quant needs a hosted source
and a key-map loader.

Tests: family registry and freeze fixtures, component sizing, flow-shift and scheduler
overrides, the i2v class invariant, refusals, local-folder detection, routes, mirrors,
and opt-in GPU checks that render both models and compare against the diffusers output.
danielhanchen added a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 25, 2026
…ai#14737)

## Problem

unslothai#14000 flipped an unset LTX-2.5 `text_encoder_quant` from the bf16 Gemma
4 encoder to int8 ConvRot (`video_ltx25.py` `ltx25_te_quant_scheme`).
Before that the code kept int8 opt-in on purpose: "LPIPS 0.310 vs bf16,
above the 0.256 compile floor". The PR's own re-measurement is 0.270
mean / 0.484 max, still above that floor, and no quality gate was added
for the new default.

The Studio UI sends nothing for "auto", so this is the default path for
every LTX-2.5 load. It also does not get the claimed download or load
saving yet: `unsloth/LTX-2.5-FP8` does not have
`LTX-2.5-text_encoder-INT8-ConvRot.safetensors` (checked today, repo
head `7b40724f`). So every unset load:

- tries to fetch the missing file in the plan, and again in the encoder
worker;
- reads the full 23.9 GB dense encoder anyway;
- quantizes it at load and runs int8.

## Change

- An unset or `auto` request on LTX-2.5 resolves to bf16 again.
- `text_encoder_quant=int8` still picks int8 (hosted file when it
resolves, else quantized at load).
- `UNSLOTH_LTX25_TE_INT8=1` makes an unset request int8, as before
unslothai#14000. `=0` keeps bf16, so anyone who set the unslothai#14000 kill switch is
unaffected.
- `none` / `off` and Speed=Off are unchanged. Other video families are
not touched.

## Tests

- `test_video_ltx25_te_int8.py::test_te_quant_tristate`,
`::test_budget_prices_the_int8_encoder`
-
`test_video_ltx25_te_hosted.py::test_unset_request_keeps_the_dense_encoder`,
`::test_int8_request_resolves_to_the_hosted_file`,
`::test_the_video_planner_stages_the_hosted_file`
-
`test_video_te_quant_default.py::test_ltx25_budgets_the_dense_peak_unless_the_hosted_encoder_applies`
-
`test_video_backend.py::test_plan_is_unchanged_when_no_text_encoder_quant_is_requested`
(it now prices LTX-2.5 at the bf16 table like every other family)

Against main, 5 of the updated tests fail and the explicit-int8 test
passes. On this branch all of them pass. Also passing on this branch:
`test_video_ltx25.py`, `test_video_ltx25_prequant.py`,
`test_video_unsloth_mirrors.py`, `test_diffusion_te_prequant.py`,
`test_video_backend.py` and the three LTX-2.5 encoder files (884 tests,
CPU).

## Not covered

- No GPU A/B was run here. The quality numbers above are the ones in the
code and in unslothai#14000.
- Encode speed and peak VRAM of int8 vs bf16 on a real card are not
measured.
- Once the hosted int8 encoder is published and gated on quality, the
default can be revisited.
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.

![Video picker before and after: Cosmos3 Edge row
appears](https://raw.githubusercontent.com/danielhanchen/unsloth-staging-2/pr-media/pr/14554/pr14554_pair_00-cbaced2e803a.png)

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']}

![crawl/r_hub](https://raw.githubusercontent.com/danielhanchen/unsloth-staging-2/pr-media/pr/14554/crawl_r_hub-aa425f260167.png)
<!-- studio-regress:end -->

---------

Co-authored-by: Daniel Han <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant