Skip to content

[feat] Add FastKandinsky 6.0 NVFP4 inference - #2123

Merged
mergify[bot] merged 7 commits into
hao-ai-lab:mainfrom
KozlovKY:main
Nov 24, 2026
Merged

mergify[bot] merged 7 commits into
hao-ai-lab:mainfrom
KozlovKY:main

Conversation

@KozlovKY

Copy link
Copy Markdown
Contributor

Purpose

Add native NVFP4 inference for FastKandinsky 6.0. Users can convert the existing BF16 Diffusers checkpoint locally and generate video with synchronized audio using FastVideo.

Changes

  • Add a converter that writes the packed DiT weights, remaining dense shards, index, and config to nvfp4/transformer/. The pipeline loads the shared components from the model root.
  • Add the Kandinsky 6 profile to the existing packed NVFP4 loader. Inference uses FlashInfer for linear layers and the existing SM120 ATTN_QAT_INFER backend. The converter derives weight scales from each weight tensor, and inference uses a global activation scale of 1.0.
  • Add an eight-step inference example using VideoGenerator, with CFG 1.0, DiT compilation, and layerwise offload.
  • Document local conversion and inference in the FastKandinsky 6.0 guide.

Test Plan

Ran locally:

git diff --check 5af9897e..HEAD && echo 'Whitespace check passed.'
python3 -B scripts/checkpoint_conversion/convert_kandinsky6_nvfp4.py --help >/dev/null && echo 'Converter CLI help passed.'
python3 -B examples/inference/optimizations/nvfp4_qat_kandinsky6.py --help >/dev/null && echo 'Inference CLI help passed.'
Whitespace check passed.
Converter CLI help passed.
Inference CLI help passed.

A synthetic checkpoint with mocked CUDA packing verified the exported file layout and routing to the packed transformer. The local pre-commit run stopped during hook setup because it could not resolve github.com.

  • [ x ] Run the documented BF16 conversion and generation on an RTX 5090. Confirm that FastVideo loads the packed weights, selects ATTN_QAT_INFER, and saves an MP4 with audio.

@mergify

mergify Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Merge Protections

🟢 Merge protection satisfied — ready to merge.

Show 1 satisfied protection

🟢 PR merge requirements

  • #approved-reviews-by>=1
  • check-success=fastcheck-passed
  • check-success=full-suite-passed
  • check-success~=pre-commit
  • title~=(?i)^\[(feat|feature|bugfix|fix|refactor|perf|ci|doc|docs|misc|chore|kernel|new.?model|skill|skills|infra)\]

@mergify mergify Bot added scope: inference Inference pipeline, serving, CLI scope: docs Documentation scope: model Model architecture (DiTs, encoders, VAEs) labels Nov 23, 2026
@mergify

mergify Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

This pull request is merged.

@greptile-apps

greptile-apps Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The reviewed changes appear safe to merge.

Summary

Adds packed NVFP4 inference for FastKandinsky 6.0 with synchronized audio.

  • FastKandinsky loads packed transformer weights beside its shared model files.
  • The Kandinsky example generates an eight-step video with synchronized audio.
  • The serving preset runs FastKandinsky over HTTP with eight-step defaults.
  • Operators can find the FastKandinsky NVFP4 guide and cookbook recipe.

No new actionable issues were found in the changes since the previous review. The earlier unnumbered findings are addressed: conversion follows the shard index, the cookbook includes the model, and the previously flagged comments are removed. Checks were static; GPU generation and browser tests were not run.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
    BF16[BF16 checkpoint] --> Converter[Convert transformer weights]
    Converter --> Packed[nvfp4/transformer]
    Root[Shared model components] --> Pipeline[Kandinsky 6 pipeline]
    Packed --> Pipeline
    Python[Python example] --> Pipeline
    HTTP[HTTP serving preset] --> Pipeline
    Pipeline --> Output[MP4 with synchronized audio]
Loading

Reviews (5) · Last reviewed commit: "[bugfix] Update Cookbook card count asse..." · Reviewed by Greptile

@fv-superagent fv-superagent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

fv-superagent score: 3/5

The packed NVFP4 profile wiring is sound: is_kandinsky6_nvfp4_linear_prefix matches exactly the DiT linears the model tags, the converter writes the four buffers the loader expects with the same alpha/global-scale semantics as convert_model_to_nvfp4, and the new visual_blocks/audio_outLayer rules leave existing BF16 visual_transformer_blocks keys byte-identical. Thanks for a careful converter.

Must fix:

  • pre-commit is red (job). yapf rewrites fastvideo/configs/models/dits/kandinsky6.py, fastvideo/layers/quantization/nvfp4_config.py and fastvideo/pipelines/basic/kandinsky6/kandinsky6_ti2va_pipeline.py; mypy fails at kandinsky6_ti2va_pipeline.py:69 with Cannot determine type of "_extra_config_module_map". Run pre-commit run --files <those three> and commit; for mypy, type the assignment or build a typed local:

    self._extra_config_module_map: dict[str, str] = {
        **self._extra_config_module_map,
        "transformer": os.path.abspath(packed_transformer),
    }
  • Title tag. The title has no [type] tag, so the Mergify merge requirement fails. Rename to e.g. [feat] Add FastKandinsky 6.0 NVFP4 inference.

  • The documented source doesn't resolve. docs/inference/fastkandinsky6.md points at kandinskylab/FastKandinsky-6.0-Pro-NVPF4-QAD, which returns 401 to an anonymous HF API call (gated) and isn't in kandinskylab's public list; the name also transposes NVFP4 to NVPF4. The converter needs a dense BF16 Diffusers directory and rejects a repo that already carries nvfp4/transformer/nvfp4_weights.safetensors. Point the guide at the public BF16 source you converted, or confirm the new repo is public and spelled right.

  • No test, and no end-to-end evidence. The converter contributor guide (scripts/checkpoint_conversion/AGENTS.md) asks for a smoke test; fastvideo/tests/ops/quantization/test_minimax_h3_modelopt_nvfp4_converter.py is the precedent, and Fastcheck's unit lane auto-collects that directory. Please also cover is_kandinsky6_nvfp4_linear_prefix and NVFP4Config(layer_profile="kandinsky6"). The PR-body hardware box (- [ x ]) renders unchecked, so the 5090 path is unverified.

Also
  • Greptile's three P2s look fair (index-based shard read in the converter, drop the narrating comments, cookbook entry). The cookbook gap is the same missing entry point as the guide above: docs/cookbook/kandinsky6.md and docs/inference/optimizations.md (the QAD section) don't link the new page, and docs-site/navigation.json:134 puts it as a top-level Run-inference leaf where docs-site/INFORMATION_ARCHITECTURE.md wants family references under Cookbook > Kandinsky 6.
  • kandinsky6_ti2va_pipeline.py:59-74: the packed branch only fires for a local path. A Hub id never redirects transformer and then trips the new guard in fsdp_load.py:392, even though the export exists.
  • Reused H3 error text (nvfp4_config.py:1005, fsdp_load.py:398) tells Kandinsky users to set layer_profile='h3_dit'.

— fv-superagent · NVFP4 or NVPF4? The GPUs don't care; the downloader does. · run by aryan5v

@fv-superagent fv-superagent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

fv-superagent score: 3/5 (was 3/5)

visual_blocks / audio_outLayer were the only over-broad part of the mapping, so this narrowing is right.

Still blocking on da838ed:

  • pre-commit (job): yapf still rewrites fastvideo/layers/quantization/nvfp4_config.py (the three blank lines and the re.compile close) and fastvideo/pipelines/basic/kandinsky6/kandinsky6_ti2va_pipeline.py (the nvfp4_component_dirs tuple); mypy still fails at kandinsky6_ti2va_pipeline.py:69. kandinsky6.py now passes. One pre-commit run --files fastvideo/layers/quantization/nvfp4_config.py fastvideo/pipelines/basic/kandinsky6/kandinsky6_ti2va_pipeline.py should settle it.
  • The title still has no [type] tag, so Mergify keeps failing: [feat] Add FastKandinsky 6.0 NVFP4 inference.
  • Unchanged from the first review: docs/inference/fastkandinsky6.md still points at the gated/transposed Hub source and the converter still has no test.

— fv-superagent · Second verse, same as the first, minus one file. · run by aryan5v

@mergify mergify Bot added the scope: infra CI, tests, Docker, build label Nov 23, 2026
@KozlovKY KozlovKY changed the title FastKandinsky6.0 QAD [feat] Add FastKandinsky 6.0 NVFP4 inference Nov 23, 2026
@mergify mergify Bot added the type: feat New feature or capability label Nov 23, 2026

@fv-superagent fv-superagent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

fv-superagent score: 4/5 (was 3/5)

All review items are addressed on afaca451:

  • Title [feat] Add FastKandinsky 6.0 NVFP4 inference and pre-commit both pass.
  • The converter now reads diffusion_pytorch_model.safetensors.index.json (glob only as a fallback), and fastvideo/tests/ops/quantization/test_kandinsky6_nvfp4_converter.py covers the packed layout, NVFP4Config(layer_profile="kandinsky6") tagging and the packed loader. It passed the Fastcheck unit lane (10m15s).
  • Cookbook entry added; the narrating comments removed.

Remaining nits, none blocking: _load_config detects the packed export only for a local path, so a Hub-id direct from_pretrained falls back to the dense transformer/ and then trips the new guard; the nav entry sits at top level instead of under Cookbook > Kandinsky 6; and the reused H3 error text still tells Kandinsky users to set layer_profile='h3_dit'.

— fv-superagent · Shard index consulted, narrating comments retired, CI queue forgiven. · run by aryan5v

@fv-superagent
fv-superagent dismissed stale reviews from themself November 23, 2026 10:55

Addressed in afaca45.

@fv-superagent

Copy link
Copy Markdown
Collaborator

The Kandinsky 6 cookbook/serving surface still needs the NVFP4 weight-quantization option before this is serving-ready.

  • examples/serving/openai_kandinsky6_ti2va.yaml (+ _distilled): no engine.quantization block, so fastvideo serve can only load BF16.
  • docs/cookbook/recipes/kandinsky6-ti2va.yaml (+ distilled): options doesn't select generator.engine.quantization.transformer_quant, although the shared schema already defines it (docs/cookbook/options.yaml:100, enum null/NVFP4/FP8).
  • docs/assets/cookbook-recipes.json (what <RecipeFamily family="kandinsky6"> renders): the kandinsky6 entries carry no precision/quantization field.
  • Precedent: FastH3 Trim serves FastVideo/FastVideo-FastH3-Trim-8-Step-NVFP4 with transformer_quant: NVFP4 — see examples/serving/openai_fasth3_trim_spark.yaml, docs/cookbook/recipes/fasth3-trim.yaml and the FastH3 Trim entries in cookbook-recipes.json.
  • For Kandinsky 6 the engine also needs layer_profile: kandinsky6, which is not in the shared option catalog yet, and a serving baseline can only load a checkpoint that already contains nvfp4/transformer/ (the current guide requires a local conversion). Please state the intended public serving source.

— fv-superagent · A quantization option is just a checkbox with commitment issues. · run by aryan5v

@KozlovKY

Copy link
Copy Markdown
Contributor Author

Added an 8-step NVFP4 Cookbook preset and serving config. The workflow converts the BF16 checkpoint locally, and fastvideo serve loads the packed weights from nvfp4/transformer/.

@aryan5v aryan5v left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@aryan5v

aryan5v commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

/merge

@github-actions github-actions Bot added the ready PR is ready to merge label Nov 24, 2026
@mergify
mergify Bot merged commit a04639f into hao-ai-lab:main Nov 24, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready PR is ready to merge scope: docs Documentation scope: inference Inference pipeline, serving, CLI scope: infra CI, tests, Docker, build scope: model Model architecture (DiTs, encoders, VAEs) type: feat New feature or capability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants