FastKandinsky-6.0-Pro-NVPF4-QAD

kandinskylab/FastKandinsky-6.0-Pro-NVPF4-QAD

作者
kandinskylab
任务
视频生成
下载量
231
点赞数
21
趋势分
13
许可证
mit
收录时间
2026/11/24

license: mit library_name: diffusers tags:

  • video
  • video-generation
  • text-to-video
  • image-to-video
  • audio-generation
  • kandinsky
  • diffusers
  • nvfp4

FastKandinsky 6.0 Pro generates five-second clips with synchronized 44 kHz audio in eight pi-Flow steps. It supports text and image conditioning. The model is a collaboration between FastVideo (Hao AI Lab, UC San Diego) and Kandinsky Lab. It uses FastVideo's quantization-aware distillation (QAD) recipe, as in FastWan-QAD and FastH3, with NVFP4 linear layers and 4-bit Attn-QAT.

The Hub repository stores the QAD transformer in BF16. FastVideo exports packed NVFP4 weights locally for native FP4 inference. Diffusers can quantize the linear layers in memory with TorchAO and run attention in BF16.

Inference speed

The chart shows FastVideo generation on RTX 5090 at 768 × 512, 121 frames, and 24 fps. The eight-step NVFP4 benchmark used layerwise DiT offload and video/audio scheduler shifts of 7.5/5. The PR example below uses the FastVideo pipeline's standard scheduler settings.

Run with FastVideo

Use Linux x86-64, Python 3.12, and an RTX 5090 or RTX PRO 6000 Blackwell (SM120) with CUDA 13. Install uv and use the CUDA 13 FastVideo installation with FlashInfer and the prebuilt fastvideo-kernel wheel containing ATTN_QAT_INFER. The following checkout pins the implementation in FastVideo PR #2123.

git clone https://github.com/KozlovKY/FastVideo.git
cd FastVideo
uv venv --python 3.12 --seed
source .venv/bin/activate
UV_TORCH_BACKEND=cu130 uv pip install -e .

Download the checkpoint, export the transformer once, and generate a clip.

MODEL_DIR="$PWD/FastKandinsky-6.0-Pro-NVPF4-QAD"
hf download kandinskylab/FastKandinsky-6.0-Pro-NVPF4-QAD --local-dir "$MODEL_DIR"

python scripts/checkpoint_conversion/convert_kandinsky6_nvfp4.py \
  --src "$MODEL_DIR"

python examples/inference/optimizations/nvfp4_qat_kandinsky6.py \
  --model-path "$MODEL_DIR" \
  --prompt "cinematic shot: a giant stone samurai on a stormy cliff above a neon city opens glowing golden eyes and raises a katana. Blue lightning strikes the blade, creating a massive shockwave through the clouds. The camera rapidly pulls back from a low angle. Photorealistic, epic scale, dark blue and gold lighting, rain, sparks, volumetric lightning, blockbuster quality. Audio: heavy rain, deep thunder, metallic sword hum, rising brass and choir, electrical crackle, perfectly synchronized lightning impact, sub-bass shockwave. No dialogue, text, or logos."

The one-time export writes packed weights and the remaining dense tensors to nvfp4/transformer/ under the model directory. Generation loads that transformer and the shared components at the model root. The example uses FlashInfer for NVFP4 linear layers, ATTN_QAT_INFER for FP4 attention, and DiT compilation with layerwise offload. It saves a 768 × 512 MP4 with synchronized audio under outputs_video/kandinsky6_nvfp4/.

Run with Diffusers

This experimental example starts from the same BF16 Hub checkpoint. It uses TorchAO on Blackwell to quantize the weights and activations of selected DiT linear layers. The attention operation runs in BF16. TorchAO uses a dynamic global activation scale, while the FastVideo example uses a fixed global scale of 1.0.

Use Diffusers 0.42.1 or later with Transformers, Accelerate, and PyAV (av) for MP4 export. Choose a CUDA-enabled PyTorch and TorchAO combination from the TorchAO compatibility table. Use eight steps and guidance 1.0. Diffusers applies the shift from scheduler/scheduler_config.json to both video and audio.

Experimental NVFP4 linear layers on Blackwell

import torch
from diffusers import Kandinsky6TI2VAPipeline
from diffusers.utils import encode_video
from torchao.prototype.mx_formats.inference_workflow import NVFP4DynamicActivationNVFP4WeightConfig
from torchao.quantization import quantize_

MODEL_ID = "kandinskylab/FastKandinsky-6.0-Pro-NVPF4-QAD"
SEED = 575431
DEFAULT_PROMPT = (
    "cinematic shot: a giant stone samurai on a stormy cliff above a neon city opens glowing golden eyes and "
    "raises a katana. Blue lightning strikes the blade, creating a massive shockwave through the clouds. The "
    "camera rapidly pulls back from a low angle. Photorealistic, epic scale, dark blue and gold lighting, rain, "
    "sparks, volumetric lightning, blockbuster quality. Audio: heavy rain, deep thunder, metallic sword hum, "
    "rising brass and choir, electrical crackle, perfectly synchronized lightning impact, sub-bass shockwave. "
    "No dialogue, text, or logos."
)

pipe = Kandinsky6TI2VAPipeline.from_pretrained(
    MODEL_ID, torch_dtype=torch.bfloat16
)


def is_qad_linear(module, fqn):
    return (
        isinstance(module, torch.nn.Linear)
        and "transformer_blocks." in fqn
        and "modulation" not in fqn
    )


quantize_(
    pipe.transformer,
    NVFP4DynamicActivationNVFP4WeightConfig(
        use_dynamic_per_tensor_scale=True, use_triton_kernel=False
    ),
    filter_fn=is_qad_linear,
    device="cuda",
)
pipe.enable_model_cpu_offload()

output = pipe(
    prompt=DEFAULT_PROMPT,
    height=512,
    width=768,
    num_frames=121,
    num_inference_steps=8,
    guidance_scale=1.0,
    generator=torch.Generator(device="cpu").manual_seed(SEED),
)
encode_video(
    output.frames[0],
    fps=24,
    output_path="output.mp4",
    audio=output.audio[0][None],
    audio_sample_rate=pipe.audio_sample_rate,
)

The filter selects 1,728 attention projection and feed-forward layers with 25.4B weights. NVFP4 uses blocks of 16 values with FP8 block scales. Modulation, embedding, and output layers stay outside the NVFP4 filter and keep their Diffusers load dtypes. About 24 GB is the estimated transformer weight storage assuming BF16 for the remaining weights.

quantize_(..., device="cuda") leaves the transformer on the GPU after conversion. enable_model_cpu_offload() then moves the transformer as a whole for denoising. Budget for the conversion peak and inference activations on top of the weights. Use the FastVideo path above for layerwise offload on RTX 5090.

Image-to-audio-video (TI2AV)

Pass a reference image with image=. It conditions the first frame, and the pipeline resizes and center-crops it to height × width. The prompt should describe what happens next in that image, so the example uses its own prompt rather than DEFAULT_PROMPT. It reuses pipe from the NVFP4 example.

from diffusers.utils import load_image

IMAGE_PROMPT = (
    "cinematic shot: a red dragon wakes on a mound of gold coins in a sunlit cave, slowly unfolds its wings "
    "and lowers its head toward the glowing stream below. Coins slide and clink down the pile as the dragon "
    "shifts its weight. The camera slowly pushes in toward the dragon's eyes. Photorealistic, fantasy, warm "
    "golden light, drifting dust motes, lush cave flowers. Audio: deep rumbling breath, leathery wing flaps, "
    "clinking coins, trickling water, distant echoing roar. No dialogue, text, or logos."
)

image = load_image(
    "https://huggingface.co/kandinskylab/FastKandinsky-6.0-Pro-NVPF4-QAD/resolve/main/assets/i2va_input.jpg"
)

output = pipe(
    prompt=IMAGE_PROMPT,
    image=image,
    height=512,
    width=768,
    num_frames=121,
    num_inference_steps=8,
    guidance_scale=1.0,
    generator=torch.Generator(device="cpu").manual_seed(SEED),
)
encode_video(
    output.frames[0],
    fps=24,
    output_path="output_ti2av.mp4",
    audio=output.audio[0][None],
    audio_sample_rate=pipe.audio_sample_rate,
)

Options

Pass sample_audio=False to generate video only, and expand_prompts=True to let the Qwen2.5-VL text encoder rewrite a short prompt into a detailed one before encoding. expand_prompts adds latency but no extra model weights.

Super Res guide

Kandinsky 6.0 video super-resolution is a separate pipeline, Kandinsky6SRPipeline. It takes the frames produced above and upscales them by ×2, ×2.25 or ×4 with tiled diffusion in K-VAE latent space, blending overlapping tiles back with Hann windows. The example uses the flow-matching checkpoint, which runs in 4 steps per tile.

import torch
from diffusers import Kandinsky6SRPipeline
from diffusers.utils import encode_video

torch._inductor.config.max_autotune = True  # required: lets inductor pick flex-attention tiles that fit the SR block mask

sr_pipe = Kandinsky6SRPipeline.from_pretrained(
    "kandinskylab/Kandinsky-6.0-VSR-5s-Diffusers", torch_dtype=torch.bfloat16
)
sr_pipe.transformer.set_attention_backend("flex")
sr_pipe.enable_model_cpu_offload()
sr_pipe.transformer.compile_repeated_blocks(fullgraph=True)

upscaled = sr_pipe(
    video=output.frames[0],
    resolution_scale=2.25,  # 2, 2.25 or 4
    num_inference_steps=4,  # 2 with Kandinsky-6.0-VSR-distilled2steps-5s-Diffusers
).frames[0]
encode_video(
    upscaled,
    fps=24,
    output_path="output_sr.mp4",
    audio=output.audio[0][None],
    audio_sample_rate=pipe.audio_sample_rate,
)

The example continues from Run with Diffusers: pipe and output come from it. The SR pipeline works on frames only, so the audio is passed to encode_video from the generation step.

  • resolution_scale=2.25 (the default, and the route used after Kandinsky 6 generation) is a ×1.125 bilinear pre-upscale followed by the ×2 path. 2 and 4 are the other options.
  • min_overlap (default 0.2) sets the minimum tile overlap. tiles_batch_size (default 1) sets how many tiles go through the model per call, trading VRAM for speed.

Components

FolderClassRole
transformer/Kandinsky6Transformer3DModelMultimodal video+audio diffusion transformer (Pro)
vae/AutoencoderKLHunyuanVideoVideo VAE: encodes the reference image, decodes the generated video
text_encoder/ + tokenizer/Qwen2_5_VLForConditionalGeneration + Qwen2_5_VLProcessorToken-level text embeddings; also used for expand_prompts=True
text_encoder_2/ + tokenizer_2/CLIPTextModel + CLIPTokenizerPooled text embedding
audio_vae/MMAudioVAEAudio latents ↔ mel spectrogram
vocoder/MMAudioVocoder (BigVGAN-style)Mel spectrogram → waveform
scheduler/PiflowSchedulerPiFlow schedule with eight denoising steps in the examples

model_index.json names the pipeline class Kandinsky6TI2VAPipeline.

Citation

@misc{kandinsky2026kandinsky60videofoundation,
      title={Kandinsky 6.0 Video: Foundation Models for Synchronized Video and Audio Generation}, 
      author={Team Kandinsky and Julia Agafonova and Bulat Akhmatov and Mikhail Aksyutin and Grigorii Alekseenko and Anastasia Aliaskina and Olga Androsova and Vladimir Arkhipkin and Anna Averchenkova and Alexander Belykh and Serafima Bocharova and Sofiya Bogakovskaya and Anton Bukashkin and Mark Bulygin and Kirill Buzygin and Irina Cheremnykh and Kirill Chernyshev and Mikhail Chernyshov and Vladimir Chernyy and David Chikovani and Georgy Daniltsev and Denis Dimitrov and Anna Dmitrienko and Vladimir Dokholyan and Sergey Emelyanov and Dmitry Ermilov and Georgii Fedorov and Polina Gavrilova and Nikolai Gerasimenko and Aleksandr Gordeev and Andrey Inozemtsev and Andrei Ivaniuta and Alexander Ivanov and Mikhail Karaev and Anastasiia Kargapoltseva and Ivan Kirillov and Nikita Kiselev and Valeria Kobenko and Yury Kolabushin and Denis Koposov and Anatoly Korobov and Vladimir Korviakov and Kirill Kozlov and Denis Krzhivokolskiy and Konstantin Kuklev and Alexander Kunitsyn and Sergey Kuzin and Vladislav Lakhtionov and Alexey Letunovskiy and Maxim Litvinov and Alexander Lyulkov and Georgy Makarov and Kirill Malakhov and Egor Malykh and Mikhail Mamaev and Dmitrii Mikhailov and Polina Mikhailova and Ivan Mikheev and Elizaveta Muromtseva and Nikolai Nazarkin and Tatiana Nikulina and Lev Novitskiy and Stanislav Onuchin and Nikita Osterov and Denis Parkhomenko and Anatoliy Parpara and Vladimir Polovnikov and Konstantin Reznikov and Azat Saginbaev and Nikita Samsonov and Alexander Sentsov and Nikita Shaimov and Artem Sherstyuk and Andrey Shutkin and Egor Silvestrov and Bulat Suleimanov and Matvey Suprunov and Sergey Taranov and Irina Tolstykh and Tatiana Trofimuk and Ilya Trushkin and Aleksandra Tsybina and Olga Varlashina and Viacheslav Vasilev and Ilya Vasiliev and Eugeny Vilisov and Sergey Yakubson and Konstantin Zakharov},
      year={2026},
      eprint={2610.05608},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2610.05608}, 
}

FastKandinsky uses FastVideo's QAD recipe and Attn-QAT. Please also cite:

@article{Zhang2026AttnQAT,
  title={Attn-QAT: 4-Bit Attention With Quantization-Aware Training},
  author={Zhang, Peiyuan and Noto, Matthew and Tan, Wenxuan and Jiang, Chengquan and Lin, Will and Zhou, Wei and Zhang, Hao},
  journal={arXiv preprint arXiv:2603.00040},
  year={2026}
}

内容来源:Hugging Face 模型卡

在 Hugging Face 查看