Repository navigation
Studio: whole-model NVFP4 for the video families with hosted pre-quantized denoisers - #10729
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
Security findingsFinding details are still loading. Check the individual review comments. ℹ️ 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 |
|
@codex security review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ed34fe5e68
ℹ️ 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".
| if ckpt_component is None and logger is not None: | ||
| logger.debug( | ||
| "diffusion.prequant: checkpoint records no component; accepting it for %r", | ||
| component, | ||
| ) |
There was a problem hiding this comment.
Reject unstamped checkpoints for non-default denoisers
When loading a non-default component such as transformer_2, accepting a checkpoint with no component stamp defeats the new expert-identity check: a legacy/default-expert artifact placed under the declared second-expert filename still matches the family, base, scheme, keys, and shapes, so it loads cleanly and produces silently incorrect denoising. The new explicit ckpt_component is None branch is fresh evidence that component-specific filename resolution alone does not close the earlier wrong-expert failure; require the stamp whenever the requested component is not transformer.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not reachable: a task-specific filename has no fallback in resolve_prequant_source, the family declares a per-task row for transformer_2 only, and the builder stamps the component on every artifact it produces; both hosted transformer_2 files carry the stamp. An unstamped file under that name would have to be uploaded by hand. The tolerant branch covers legacy default-component artifacts, where it is correct.
| try: | ||
| same = os.path.realpath(out_path) == os.path.realpath(verify_path) | ||
| except Exception: # noqa: BLE001 -- an unresolvable path is not provably the same file |
There was a problem hiding this comment.
Detect hard-linked verification targets
When --out and --verify-against are different hard links to the same inode, their realpath strings differ, so this guard accepts them; the subsequent torch.save through --out overwrites the shared inode, and verification compares the new artifact with itself before allowing upload. Use os.path.samefile or compare device/inode identities when both paths exist so the required independent-build gate cannot be bypassed by hard-linked paths.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
The check compares realpaths, which covers every way the tool itself can produce the same file. Two hard links to one inode have to be created by hand between builds; that is hardening rather than a defect on well-formed input.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 01368efe24
ℹ️ 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".
| sources[component] = resolve_prequant_source( | ||
| fam, | ||
| wanted, | ||
| base_repo = base_repo, | ||
| task = task, |
There was a problem hiding this comment.
Require exact base identity before seeding forks
When an explicit NVFP4 load targets a hosted fork that preserves the upstream repository name, such as other-org/Wan2.2-TI2V-5B-Diffusers, this unconditionally resolves the family-default upstream artifact. _validate_checkpoint then accepts it because _same_base_model treats equal final path segments as equivalent, so the fork's modified denoiser is silently replaced with the upstream weights and produces results from the wrong model. Only offer the default hosted source for an exact/canonical base match, while retaining the tail-name exception for verified local mirrors.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
This PR follows the shipped convention: denoiser_prequant_sources calls resolve_prequant_source with the base exactly as the H3 video path and the image path do, and neither family_prequant_repo nor _same_base_model changes here. A fork that keeps the upstream tail name is offered the family artifact by the shipped fp8 and int8 paths today; prequant_excluded_bases is the existing escape hatch for a divergent fork.
| for key, tensor in items: | ||
| if key != "weight" and not str(key).endswith(".weight"): | ||
| continue |
There was a problem hiding this comment.
Fingerprint dense tensors as well
When a reproducibility fault or checkpoint mutation affects a bias, buffer, or one of the dense weights deliberately left unquantized, this loop either skips the key entirely or records only its name under skipped; neither --verify-against nor the load-time recomputation compares its bytes. A validly serialized artifact with a corrupted output bias or normalization weight can therefore pass the new publication gate and load without warning while changing every render. Include all serialized tensor payloads in a whole-state fingerprint, even if packed quantized tensors retain their specialized hashing.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
The fingerprint is defined over the packed quantised payloads, which is the corruption class it was added for; extending it to biases, buffers and deliberately dense weights is scope growth on the verify gate with no shipped path observed to corrupt a dense tensor.
| print( | ||
| f" gptq idempotency: {gptq_idempotency['checked']} layers, max abs deviation " | ||
| f"{gptq_idempotency['max_abs']:.3e} ({gptq_idempotency['max_abs_fqn']}), " | ||
| f"{gptq_idempotency['frac_diff'] * 100:.3f}% of elements moved", | ||
| flush = True, | ||
| ) |
There was a problem hiding this comment.
A nonzero deviation is the normal outcome here, not a fault: torchao's quantize_ re-rounds part of the stored weights on every hosted artifact, reproducibly, and the build's per-layer scores were measured through that same quantiser, so they describe the packed result. An abort on nonzero would refuse every shipped artifact. The report stays a report; the docstring premise is worth tightening separately.
| print( | ||
| f" gptq idempotency: {gptq_idempotency['checked']} layers, max abs deviation " | ||
| f"{gptq_idempotency['max_abs']:.3e} ({gptq_idempotency['max_abs_fqn']}), " | ||
| f"{gptq_idempotency['frac_diff'] * 100:.3f}% of elements moved", | ||
| flush = True, | ||
| ) |
There was a problem hiding this comment.
A nonzero deviation is the normal outcome here, not a fault: torchao's quantize_ re-rounds part of the stored weights on every hosted artifact, reproducibly, and the build's per-layer scores were measured through that same quantiser, so they describe the packed result. An abort on nonzero would refuse every shipped artifact. The report stays a report; the docstring premise is worth tightening separately.
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. What shall we delve into next? 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". |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7e9f88acba
ℹ️ 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".
| # The subfolder built above: the loader refuses it as another denoiser (e.g. transformer_2). | ||
| "component": DEFAULT_PREQUANT_COMPONENT, |
There was a problem hiding this comment.
Support building non-default denoiser components
When producing the newly registered Wan A14B transformer_2 artifact, this script cannot create a loadable checkpoint: it always reads the transformer subfolder and stamps component='transformer', with no CLI option to select another component. Even if --upload-filename targets Wan2.2-T2V-A14B-transformer_2-NVFP4.pt, the loader requests component='transformer_2' and rejects the resulting artifact, so the shipped builder cannot reproduce the two-expert checkpoint set. Add a component/subfolder argument and use it for loading, metadata, and component-specific filename resolution.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 1819ead: the builder now takes --component (default transformer), uses it for the subfolder, the recorded component and the upload name (transformer_2 resolves to Wan2.2-T2V-A14B-transformer_2-NVFP4.pt, and refuses a component the family declares no row for), and falls back to the video registry so the Wan families resolve at all.
Add --component (default transformer) for the subfolder, metadata and upload name, and resolve video families so the Wan and HunyuanVideo denoisers can be built.
|
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. 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". |
|
pre-commit.ci run |
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. Delightful! 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". |
…tized denoisers (unslothai#10729) * studio: whole-model NVFP4 for the video families with hosted pre-quantized denoisers Wan2.2-TI2V-5B, Wan2.2-T2V-A14B (both experts), HunyuanVideo-1.5 480p and 720p run NVFP4 on the torchao backend from hosted pre-quantized denoisers, so a load never quantises 5 to 28 GB of dense weights on the fly. Every admitted linear (min 512 features, in and out divisible by 16) is NVFP4; nothing is per-layer here. - one shared auto walk with a per-family head in front of it, and divisible_for_scheme - ZeroRowSafeLinear, a live bug: torchao's nvfp4 activation path raises on HunyuanVideo-1.5's empty image stream on every text-to-video render - loader gates on the packed-weight fingerprint, the component and require_divisible - conventional video pre-quant seeding, all components or none, with the memory plan taking the artifact's resident size rather than the dense build peak - registry rows for the four hosted NVFP4 repos nvfp4 stays an explicit opt-in here; no family gets an auto row on this branch. The tooling that builds and fingerprints these artifacts is not in this repo. It lives in the private scripts repo with the rest of the quant generation tooling. * Tighten the comments and docstrings on the video prequant path Collapse the long single-line comments this branch added to the repo's wrap width, shorten the prose docstrings to the parts that say why, and drop the test docstrings that only restate the test name. Comments, docstrings and whitespace only: no code changes. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Credit the resident video pipeline's memory in the seed plan * Pin the residency check in the two-expert download plan test * Credit only the target card's resident bytes and fingerprint built checkpoints The residency plan counted every accelerator storage of the old pipeline as reclaimable on the card the new load targets, so switching GPUs could skip the dense denoiser shards on a card that never held them. Count only the target's. The builder never wrote metadata["fingerprint"], so the loader's packed-weight check had nothing to compare against for artifacts it produced. * Fingerprint torchao 0.18 Int8Tensor prequant weights torchao >= 0.18 int8 quantization produces Int8Tensor, which the packed fingerprint payload map did not list, so every int8 weight was skipped and the recorded fingerprint verified nothing. Hash its qdata, scale and optional zero point / activation slots, with a stub test and a real torchao round trip that catches a flipped byte. * Apply the GEMM alignment floor in the offline prequant builder and record it The runtime quantize_ skips Linears whose in/out features miss the scheme's tiling floor, but build_prequant_checkpoint.py did not, so a ragged layer could be baked as a quantized GEMM the runtime leaves dense. The builder now passes divisible_for_scheme(scheme) to make_filter_fn and stamps require_divisible so the loader can verify it. * Trim comments * Studio: NVFP4 kill switch for image and video, default off The hosted unsloth/*-NVFP4 checkpoints are still private, so NVFP4 is disabled in general until UNSLOTH_NVFP4_DIFFUSION is set to a truthy value (1, true, yes, on). The default lives in one constant, NVFP4_DIFFUSION_DEFAULT in core/inference/diffusion_nvfp4_flag.py, so turning it on for everyone later is a one-line change. With the switch on, behaviour is unchanged. While it is off: - auto never picks nvfp4 for the dense transformer (ladder and family prefer rows), and no smoke probe is spent on it; - an explicit transformer_quant or text_encoder_quant of nvfp4 gets a 400 "NVFP4 is disabled in this build" from every image and video load and download-plan route, ahead of the precision fallback; - no hosted NVFP4 denoiser or encoder is resolved, seeded, planned or sized, and the Hub helpers never ask about a *-NVFP4 repo; - /images/info estimates and the /api/system dense ladder omit nvfp4, and /api/system reports nvfp4_diffusion so the Precision and Text encoder selects hide NVFP4. The offline builder does not consult the switch. Existing NVFP4 test modules run with it on through a conftest fixture; the default-off behaviour, and that the enabled path is still reachable end to end, are covered in test_nvfp4_diffusion_flag.py. * Studio: keep the diffusion bench NVFP4-capable under the kill switch An explicit --transformer-quant or --text-encoder-quant nvfp4 turns the switch on for the bench itself, like the other developer tools. The switch tests ask auto the way a load does, with a hosted checkpoint where the selector requires one, so the enabled-path check stays meaningful on the branches that add that requirement. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Studio: reset a hidden NVFP4 pick to Auto when the backend switch is off A Precision or Text encoder select reseeded to nvfp4 by an earlier load kept that value after a restart turned UNSLOTH_NVFP4_DIFFUSION off: the option was filtered out, so the select rendered blank and the next load or Reapply sent nvfp4 and got a 400. Once /api/system reports the switch off, a held nvfp4 now falls back to auto on the image and video pages. Nothing is reset before system info arrives, since the switch reads off by default until then. * Studio: keep the hosted video denoiser seed for an explicit scheme under Speed off Only an auto precision is rewritten to off under Speed off; an explicit scheme is still quantized (and upgrades the speed), so suppressing the seed staged the dense denoiser for a runtime quantize. Matches diffusion.py. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Studio: update the Speed off video plan test for the kept explicit seed * Studio: refuse an NVFP4 checkpoint loaded directly as the model while NVFP4 is off With UNSLOTH_NVFP4_DIFFUSION off, a hosted NVFP4 repo (or any repo or local path whose pre-quant metadata records scheme nvfp4) picked as the model itself named no precision, so none of the scheme gates saw it. The image and video load and download-plan routes now 400 such a pick with the same disabled message style. Detection reads the recorded scheme of a local file, a local directory or a cached Hub snapshot, then the family NVFP4 repo tables, then the -NVFP4 name. Switched on, the pick proceeds as before. * Studio: format the NVFP4 checkpoint refusal tests * Studio: skip pipeline roots and the thread hop in the NVFP4 checkpoint refusal A diffusers pipeline loads from its component folders, so a stray root artifact no longer makes its directory read as an NVFP4 checkpoint. With the switch on the route helper returns before handing anything to a thread. * Studio: stamp the built denoiser component and drop an unused metadata reader * Studio: keep the NVFP4 flag and speed-off video plan tests off the runner's own GPU * Studio: trim comments in the NVFP4 video layer * Studio: check the hosted video seed rows before spending a quant smoke probe * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Studio: let the prequant builder target the second Wan A14B expert Add --component (default transformer) for the subfolder, metadata and upload name, and resolve video families so the Wan and HunyuanVideo denoisers can be built. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Summary
Whole-model NVFP4 for the video families (Wan2.2-TI2V-5B, Wan2.2-T2V-A14B with its two experts, HunyuanVideo-1.5 at 480p and 720p) on the existing torchao backend, with hosted pre-quantized denoisers so a load never has to quantise 5 to 28 GB of dense weights on the fly. Every admitted linear (min 512 features, in and out divisible by 16) is NVFP4; nothing is per-layer here. The per-layer image policies and the flashinfer kernel backend come in the two PRs stacked on this one.
nvfp4 stays an explicit opt-in for three of the four families: the promotion gates below pass speed and memory on the flashinfer backend but not accuracy for Wan 5B and both HunyuanVideo variants. Wan2.2-T2V-A14B passes all four and gets its auto row in the stacked backend PR, where the condition it needs (the flashinfer backend being selected) lives. The numbers are in the PR so each decision is measured rather than a default.
What changes
diffusion_transformer_quant.py).select_transformer_quant_schemeandauto_scheme_candidatescomputed their orders separately; they now share_auto_scheme_order, and_FAMILY_AUTO_PREFERlets a family whose shapes were measured put its own head in front of the arch-wide tier (dropped below a capability floor and on consumer parts). The table ships empty for video; a parametrised test pins the two callers to one answer.divisible_for_schemereplaces an inline map.diffusion_quant_pad.py,ZeroRowSafeLinear). torchao's nvfp4 activation path callstorch.maxon the input and raises on an empty batch. HunyuanVideo-1.5's attention trim handsimage_embedder.linear_1/2an empty image stream on every text-to-video render, andcontext_embedder_2can see an empty second text stream. The guard returnszeros + biasfor an empty input, bit-exact withF.linear, and is inert otherwise; it wraps the two listed modules on the HunyuanVideo families only, installed afterapply_small_m_paddingon both the runtime and the pre-quantized paths. Micro-repro:nn.Linear(1152, 3072)under the runtime nvfp4 config with a(1, 0, 1152)input raises without it.transformer_2for the second A14B expert, stamped into metadata and into the filename), therequire_divisiblethe filter ran with, the base repo a local mirror declares itself a mirror of, and a packed-weight fingerprint block (md5-packed-v1, per module overqdata,scale,per_tensor_scale). Publishing is gated on a second, independent build reproducing that fingerprint, which is why the table below can say every file was built twice.diffusion_prequant.py). The fingerprint is verified on load (UNSLOTH_PREQUANT_FINGERPRINT=full|sample|off, full by default: 5 s for the 5B, 14 s per A14B expert), a mismatch falls back to the dense path with the first five differing modules logged; artifacts without a block (the existing fp8 and int8 files) are accepted. Coverage includes torchao 0.18'sInt8Tensor, so a newly baked int8 artifact is verified rather than recorded with an empty block.componentandrequire_divisiblein the metadata are checked against what the load asked for, so the second expert's file can never be loaded as the first.-nvfp4and-mxfp8join the suffix strip.video_denoiser_prequant.py,video.py). The pipeline is built with every hosted denoiser component pre-loaded throughpipe_kwargs, all components or none (a dual-expert model with one artifact is uncovered, not half covered). The plan-time scheme (_video_auto_denoiser_scheme) requires an artifact for every component and is pinned into the load so plan and load cannot disagree; the memory plan uses the artifact's resident size instead of the dense build peak, resolved before the unified-memory check and re-planned at bf16 if seeding returns nothing; the download plan drops both experts' dense shards and keeps both configs.h3_denoiser_pinnedbecomesdenoiser_pinned. Offload plus pre-quant stays refused.video_families.py) forunsloth/Wan2.2-TI2V-5B-NVFP4,unsloth/Wan2.2-T2V-A14B-NVFP4(two files, the second through the task slot so it gets no filename fallback) andunsloth/HunyuanVideo-1.5-NVFP4(480p and 720p files). Repos are private pending review.Hosted artifacts
Every file was built twice in separate processes and published only on an identical fingerprint. The primaries are the tuned builds with baked activation scales (used by the stacked flashinfer PR, ignored by torchao); the plain RTN builds sit alongside as
-RTN.ptfor A/B.Measurements
B200, torch 2.12.1+cu130, torchao 0.18, default speed tier (compile on, step cache off, attention trim on), interleaved rotations paired on prompt and seed, LPIPS against the bf16 arm on held-out prompts, four seeds. The flashinfer rows come from the stacked backend PR run against these artifacts; they are included because they are what decides promotion.
Wan2.2-TI2V-5B, 1280x704x121, 50 steps:
Wan2.2-TI2V-5B at a small grid, 832x480x49, 50 steps (Studio
VideoBackend, default speed tier, 3 prompts x 3 seeds, one load per arm, flashinfer backend for NVFP4, per-frame LPIPS against bf16 of the same prompt and seed):At this size the per-call overhead of the NVFP4 path outweighs the smaller GEMMs, so NVFP4 is about 1.8x slower than bf16 while still drifting further than fp8. It stays explicit-only for this family; auto never picks it.
HunyuanVideo-1.5 480p, 832x480x121, 50 steps:
Wan2.2-T2V-A14B, 1280x720x81, 50 steps, and HunyuanVideo-1.5 720p, 1280x720x121, 50 steps:
Promotion gates (all four must hold for an auto row): speed p50 <= fp8 with >= 80% rotation wins; accuracy, paired LPIPS gap vs fp8 <= +0.02 with 95% upper bound <= +0.05 (the absolute 0.10 bar assumed the incumbent clears it, which fp8 does not on a 50-step video, so the paired form is the discriminating one and both are reported); health, no black or non-finite frames and SSIM within 0.02 of fp8's; steady resident <= fp8. Every family passes speed and memory on flashinfer; A14B passes accuracy and health as well (it is closer to bf16 under NVFP4 than under fp8) and gets the auto row in the stacked backend PR, conditioned on flashinfer being the selected backend since the same artifact on torchao is 0.86x fp8. The three smaller families fail accuracy and stay explicit opt-ins. Video LPIPS is not image LPIPS: fp8 itself sits at 0.19 to 0.53 against bf16 on these families because a 50-step trajectory diverges under any perturbation, so the paired gap against fp8 (0.12 to 0.17 here) is the meaningful accuracy number. The tuned build is a large lever on HunyuanVideo (0.765 to 0.581) and almost none on Wan (0.350 to 0.345); the baked static activation scale the fast kernel needs costs about 0.017 on Wan.
First-use costs: the hosted artifacts load in 19 to 26 s on every family, under fp8's own load; the runtime nvfp4 arm quantises on the fly and loads in 47 s (5B), 73 s (HV15) and 213 s (A14B). Compile on the torchao nvfp4 path is 1.5x to 2.8x fp8's; on flashinfer it is slightly under fp8's.
Tests
test_diffusion_transformer_quant.py(auto head per family, floor, consumer, deny, probe, anti-drift between the two callers,divisible_for_scheme, zero-row tokens),test_diffusion_quant_pad.py(guard shape, inert on non-empty, keys unchanged),test_video_families.py(rows resolve, no fallback for the second expert, 480p and 720p differ),test_video_prequant.py(seeding both experts, second-expert failure seeds nothing, skipped under offload, memory plan and revert, pinned scheme),test_video_backend.py(pre-quant twin of the dual-DiT quant test, runtime quant skipped for seeded components, shard drop keeps configs, byte totals, resolved record, HV15 guard installed),test_diffusion_prequant.py(one flipped byte refused with the fqn logged, absent block accepted, sample and off modes, component andrequire_divisiblemismatches, suffix strip,Int8Tensorstub and real torchao round trip).Full
studio/backend/testson this branch (test_blender_managed.pyexcluded), 821 files in 10 batches: 41355 passed, 124 failed, 223 skipped, 15 errors. That run predates the build tooling moving to the private scripts repo, so it also counted the builder's own test ids, which are no longer in this tree; nothing else in the count moved. Every failing id reproduces on the merge base (95feb6979) file by file, in 19 files this PR does not touch (chat generation lease and supervisor, llama admission, mcp_*, native audio, openai catalog, gpu arch gate, offload planner seam, sandbox files, studio_api).hub/tests: 683 passed.Not changed
_FAMILY_AUTO_PREFERrow in this PR; the A14B row needs the backend condition and lands with the flashinfer backend PR. The registry rows here carry the measured resident sizes (denoiser term in decimal GB: 2.9, 16.2 for the expert pair, 4.8, 4.8; 0.28 to 0.29 of the bf16 term on every family) so the memory plan for a seeded load is right.UI evidence
No before/after pair is attached, because nothing a user sees changes. Two identical screens under a BEFORE and an AFTER label would read as evidence, and it would be evidence of nothing. What was checked, on the current head against this branch's own merge base:
/api/system. This PR touches neither: the diff understudio/frontendis empty andstudio/backend/main.pyis untouched. No route serves a family'sprequant_reposto the client, so a new row in the family table cannot reach the picker.NVFP4 (Blackwell), so the new rows add no option and rename none.nvfp4, andnvfp4is not in_AUTO_LADDER._FAMILY_AUTO_PREFERships EMPTY on this branch, so_auto_scheme_orderreturns exactly the tier it returned before and an unset orautoprecision resolves to the same scheme on every host._video_auto_denoiser_schemetherefore answers None on the default path for all four families, before and after.nvfp4pick the resolved record'sreasonnames the checkpoint it seeded from, butresolvedBadgereturns null for an honored explicit request, so that string never reaches the screen. The two paths that DO render a reason, auto and a declined request, are asserted free of a repo id intest_video_backend.py.nvfp4pipeline pick, and only where the hosted denoiser is reachable. Those checkpoints are not published, so there is nothing here a reviewer could reproduce and nothing worth photographing.The speed, memory and accuracy this PR is actually for are in the tables above, which is where a number belongs; a screenshot cannot carry them.
NVFP4 kill switch
NVFP4 for image and video generation is off by default until the hosted
unsloth/*-NVFP4repos are public.UNSLOTH_NVFP4_DIFFUSION=1(alsotrue,yes,on) restores the full NVFP4 behaviour of this stack, including private-repo access through the user's HF token; anything else, or unset, disables it. The default lives in one constant,NVFP4_DIFFUSION_DEFAULTinstudio/backend/core/inference/diffusion_nvfp4_flag.py, so turning it on for everyone later is a one-line change. The switch is read at call time throughnvfp4_diffusion_enabled().Added on this branch (covers the surfaces on main and in this PR), with the switch off:
autonever picks nvfp4 for the dense transformer (ladder and family prefer rows), and no smoke probe is spent on it.transformer_quantortext_encoder_quantofnvfp4gets a 400 "NVFP4 is disabled in this build" from/images/load,/images/download-plan,/video/loadand/video/download-plan, ahead of the precision fallback, so it is refused rather than swapped.family_prequant_repo,resolve_prequant_source,denoiser_prequant_sources,video_family_prequant_*), and the Hub helpers never ask about a*-NVFP4repo. Dense shards are planned as on main./images/infoestimates and the/api/systemdense ladder omit nvfp4./api/systemreportsnvfp4_diffusion, and the Precision and Text encoder selects hide NVFP4 when it is false.verify_prequant_backend.pyand an explicit nvfp4diffusion_bench.pyrun turn it on for themselves.Existing NVFP4 test modules run with the switch on through a conftest fixture.
test_nvfp4_diffusion_flag.pycovers the default-off behaviour, and checks that the enabled path (auto, explicit, prequant lookup, the download plan) is still reachable end to end.UI evidence
Images page, Advanced settings, with
UNSLOTH_NVFP4_DIFFUSIONunset (the default). BEFORE ismainat 8d15d04, AFTER is this branch at a055823, each a separateinstall.sh --localStudio on a B200.Precision select: BEFORE lists NVFP4 (Blackwell), AFTER omits it.
Text encoder precision select: BEFORE lists NVFP4 (Blackwell), AFTER omits it.
/api/systemreportsnvfp4_diffusion: falseon AFTER; the field is absent on BEFORE.