diff --git a/docs_new/cookbook/diffusion/Qwen-Image/Qwen-Image.mdx b/docs_new/cookbook/diffusion/Qwen-Image/Qwen-Image.mdx index 2f92c67d7..630da7056 100644 --- a/docs_new/cookbook/diffusion/Qwen-Image/Qwen-Image.mdx +++ b/docs_new/cookbook/diffusion/Qwen-Image/Qwen-Image.mdx @@ -30,6 +30,28 @@ Qwen-Image is a text-to-image model. The recommended launch configurations vary +For the validated ModelOpt NVFP4 checkpoint on Blackwell, load the published +Qwen-Image-2512 NVFP4 repo directly: + +```bash Command +sglang serve \ + --model-path lmsys/qwen-image-2512-modelopt-nvfp4-sglang \ + --ulysses-degree=1 \ + --ring-degree=1 +``` + +For high-resolution B200 generations, the FlashInfer CUTLASS FP4 GEMM backend +can be faster than the default TensorRT-LLM FP4 GEMM backend: + +```bash Command +SGLANG_DIFFUSION_FLASHINFER_FP4_GEMM_BACKEND=cutlass \ +sglang generate \ + --model-path lmsys/qwen-image-2512-modelopt-nvfp4-sglang \ + --width 2048 --height 2048 \ + --prompt "A tiny astronaut reading a book under a glass greenhouse" \ + --save-output +``` + ### 3.2 Configuration Tips Currently supported optimizations are listed [here](/docs/sglang-diffusion/compatibility_matrix). diff --git a/docs_new/docs/sglang-diffusion/quantization.mdx b/docs_new/docs/sglang-diffusion/quantization.mdx index 9ec8a70e0..e2a51680b 100644 --- a/docs_new/docs/sglang-diffusion/quantization.mdx +++ b/docs_new/docs/sglang-diffusion/quantization.mdx @@ -93,11 +93,11 @@ backend. modelopt-nvfp4 - Mixed transformer directory/repo with config.json, or raw NVFP4 safetensors export/repo - --transformer-path for mixed overrides; --transformer-weights-path for raw exports - FLUX.1, FLUX.2, Wan2.2 + Mixed transformer directory/repo with config.json, raw NVFP4 safetensors export/repo, or full ModelOpt Diffusers repo + --transformer-path for mixed overrides; --transformer-weights-path for raw exports; --model-path for full repos + FLUX.1, FLUX.2, Wan2.2, Qwen Image, Qwen Image 2512, Qwen Image Edit, Qwen Image Edit 2511 None - Mixed override repos keep the base model separate; raw exports such as black-forest-labs/FLUX.2-dev-NVFP4 still use the weights-path flow + Mixed override repos keep the base model separate; full Qwen Image exports can be loaded directly as --model-path; raw exports such as black-forest-labs/FLUX.2-dev-NVFP4 still use the weights-path flow nunchaku-svdq @@ -172,16 +172,16 @@ Each pattern is matched against the full layer prefix (e.g. `layers.0.attention. ## Validated ModelOpt Checkpoints -This section is the canonical support matrix for the nine diffusion ModelOpt -checkpoints currently wired up in SGLang docs and validation coverage. +This section is the canonical support matrix for the thirteen published +diffusion ModelOpt checkpoints currently wired up in SGLang docs and validation +coverage. Published checkpoints keep the serialized quantization config as `quant_method=modelopt`; the FP8 vs NVFP4 split below is a documentation label derived from `quant_algo`. -Six of the nine repos live under `lmsys/*`. The Wan2.2 entries use NVIDIA's -official full Diffusers repos, and the FLUX.2 NVFP4 entry keeps the official -`black-forest-labs/FLUX.2-dev-NVFP4` repo. +Twelve of the thirteen repos live under `lmsys/*`. The FLUX.2 NVFP4 entry keeps +the official `black-forest-labs/FLUX.2-dev-NVFP4` repo. @@ -222,10 +222,10 @@ official full Diffusers repos, and the FLUX.2 NVFP4 entry keeps the official - - - - + + + + @@ -270,16 +270,50 @@ official full Diffusers repos, and the FLUX.2 NVFP4 entry keeps the official + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + +
FP8 Wan-AI/Wan2.2-T2V-A14B-Diffusers--model-pathnvidia/Wan2.2-T2V-A14B-Diffusers-FP8full Diffusers repo with ModelOpt FP8 Wan2.2 componentsvalidated through direct --model-path loading--transformer-pathlmsys/wan22-t2v-a14b-modelopt-fp8-sglang-transformerprimary transformer quantized, transformer_2 kept BF16primary-transformer-only path; keep transformer_2 on the base checkpoint, and do not describe this as dual-transformer full-model FP8 unless that path is validated separately
FP8
NVFP4 Wan-AI/Wan2.2-T2V-A14B-Diffusers--transformer-pathlmsys/wan22-t2v-a14b-modelopt-nvfp4-sglang-transformerprimary transformer quantized with ModelOpt NVFP4, transformer_2 kept BF16primary-transformer-only path; keep transformer_2 on the base checkpoint; the default FP4 GEMM backend is flashinfer_trtllm
NVFP4Qwen/Qwen-Image --model-pathnvidia/Wan2.2-T2V-A14B-Diffusers-NVFP4full Diffusers repo with ModelOpt NVFP4 Wan2.2 componentsdefault FP4 GEMM backend is flashinfer_trtllmlmsys/qwen-image-modelopt-nvfp4-sglangfull ModelOpt NVFP4 Diffusers repo, BF16-vs-NVFP4 B200 image comparisonfull repo loaded directly; exported with ModelOpt PR #1706 SVDQuant NVFP4 (--format fp4, max calibration, block size 16) and BF16 fallbacks for attention-sensitive modules plus first/last transformer blocks
NVFP4Qwen/Qwen-Image-2512--model-pathlmsys/qwen-image-2512-modelopt-nvfp4-sglangfull ModelOpt NVFP4 Diffusers repo, BF16-vs-NVFP4 B200 image comparison, B200 CI casesame full-repo loader path as Qwen Image; this is the Qwen Image NVFP4 representative in multimodal-gen-test-1-b200
NVFP4Qwen/Qwen-Image-Edit--model-pathlmsys/qwen-image-edit-modelopt-nvfp4-sglangTI2I edit full ModelOpt NVFP4 Diffusers repo, BF16-vs-NVFP4 B200 image comparisonfull repo loaded directly with normal image-edit inputs; exported with the same ModelOpt PR #1706 NVFP4 recipe
NVFP4Qwen/Qwen-Image-Edit-2511--model-pathlmsys/qwen-image-edit-2511-modelopt-nvfp4-sglangTI2I edit full ModelOpt NVFP4 Diffusers repo, BF16-vs-NVFP4 B200 image comparisonfull repo loaded directly with normal image-edit inputs; exported with the same ModelOpt PR #1706 NVFP4 recipe
-The FP8 rows run in the regular H100 1-GPU diffusion CI shard; the NVFP4 rows -run in the B200 diffusion CI shard (`multimodal-gen-test-1-b200`). +These thirteen checkpoints are the intended ModelOpt documentation support +set. The B200 diffusion CI job (`multimodal-gen-test-1-b200`) uses a +representative NVFP4 subset and includes +`lmsys/qwen-image-2512-modelopt-nvfp4-sglang` for Qwen Image coverage. ## ModelOpt FP8 @@ -300,7 +334,8 @@ sglang generate \ ```bash sglang generate \ - --model-path nvidia/Wan2.2-T2V-A14B-Diffusers-FP8 \ + --model-path Wan-AI/Wan2.2-T2V-A14B-Diffusers \ + --transformer-path lmsys/wan22-t2v-a14b-modelopt-fp8-sglang-transformer \ --prompt "a fox walking through neon rain" \ --save-output ``` @@ -387,15 +422,38 @@ sglang generate \ --save-output ``` -For Wan2.2 NVFP4: +For a dual-transformer Wan2.2 export where only the primary `transformer` +was quantized: ```bash sglang generate \ - --model-path nvidia/Wan2.2-T2V-A14B-Diffusers-NVFP4 \ + --model-path Wan-AI/Wan2.2-T2V-A14B-Diffusers \ + --transformer-path lmsys/wan22-t2v-a14b-modelopt-nvfp4-sglang-transformer \ --prompt "a fox walking through neon rain" \ --save-output ``` +For full Qwen Image NVFP4 exports, load the published repo directly: + +```bash +sglang generate \ + --model-path lmsys/qwen-image-2512-modelopt-nvfp4-sglang \ + --prompt "A tiny astronaut reading a book under a glass greenhouse" \ + --save-output +``` + +For high-resolution Qwen-Image-family generations on B200, the FlashInfer +CUTLASS FP4 GEMM backend can be faster than the default TensorRT-LLM backend: + +```bash +SGLANG_DIFFUSION_FLASHINFER_FP4_GEMM_BACKEND=cutlass \ +sglang generate \ + --model-path lmsys/qwen-image-2512-modelopt-nvfp4-sglang \ + --width 2048 --height 2048 \ + --prompt "A tiny astronaut reading a book under a glass greenhouse" \ + --save-output +``` + ### Notes - Use `--transformer-path` for mixed ModelOpt NVFP4 transformer repos or local @@ -408,8 +466,15 @@ sglang generate \ intentionally want a non-default `transformer_2`. - On Blackwell, the diffusion ModelOpt NVFP4 path defaults to FlashInfer TensorRT-LLM FP4 GEMM (`flashinfer_trtllm`). -- Direct `--model-path` loading is a compatibility path for FLUX.2 NVFP4-style - repos or local directories. +- The published Qwen Image NVFP4 exports keep the `img_mod`/`txt_mod` + modulation projections and first/last transformer blocks in BF16. +- Qwen-Image NVFP4 does not always improve latency at 1024x1024. On B200, the + validated ModelOpt exports were faster than BF16 at 2048x2048 with + `SGLANG_DIFFUSION_FLASHINFER_FP4_GEMM_BACKEND=cutlass`, while 1024x1024 + remained BF16-faster. +- Direct `--model-path` loading is the canonical path for full Qwen Image + ModelOpt NVFP4 repos and a compatibility path for FLUX.2 NVFP4-style repos + or local directories. - If `--transformer-weights-path` is provided explicitly, it takes precedence over the compatibility `--model-path` flow. - For local directories, SGLang first looks for `*-mixed.safetensors`, then diff --git a/docs_new/src/snippets/diffusion/qwen-image-deployment.jsx b/docs_new/src/snippets/diffusion/qwen-image-deployment.jsx index 1328c819d..2dbf6c4b6 100644 --- a/docs_new/src/snippets/diffusion/qwen-image-deployment.jsx +++ b/docs_new/src/snippets/diffusion/qwen-image-deployment.jsx @@ -7,16 +7,40 @@ export const QwenImageDeployment = () => { name: 'hardware', title: 'Hardware Platform', items: [ - { id: 'mi300x', label: 'MI300X', default: true }, + { id: 'b200', label: 'B200', default: true }, + { id: 'b300', label: 'B300', default: false }, + { id: 'h200', label: 'H200', default: false }, + { id: 'h100', label: 'H100', default: false }, + { id: 'mi300x', label: 'MI300X', default: false }, { id: 'mi325x', label: 'MI325X', default: false }, { id: 'mi355x', label: 'MI355X', default: false } ] + }, + precision: { + name: 'precision', + title: 'Precision', + items: [ + { id: 'bf16', label: 'BF16', default: true }, + { + id: 'nvfp4', + label: 'NVFP4', + default: false, + disabledWhen: (values) => !['b200', 'b300'].includes(values.hardware), + disabledReason: 'ModelOpt NVFP4 requires Blackwell hardware such as B200 or B300' + } + ] } }, generateCommand: function(values) { + const isBlackwell = ['b200', 'b300'].includes(values.hardware); + const isNvfp4 = values.precision === 'nvfp4' && isBlackwell; + const modelPath = isNvfp4 + ? 'lmsys/qwen-image-2512-modelopt-nvfp4-sglang' + : 'Qwen/Qwen-Image'; + return `sglang serve \\ - --model-path Qwen/Qwen-Image \\ + --model-path ${modelPath} \\ --ulysses-degree=1 \\ --ring-degree=1`; } @@ -89,7 +113,17 @@ export const QwenImageDeployment = () => { }, []); const handleRadioChange = (optionName, value) => { - setValues((prev) => ({ ...prev, [optionName]: value })); + setValues((prev) => { + const next = { ...prev, [optionName]: value }; + if ( + optionName === 'hardware' && + !['b200', 'b300'].includes(value) && + next.precision === 'nvfp4' + ) { + next.precision = 'bf16'; + } + return next; + }); }; const handleCheckboxChange = (optionName, itemId, isChecked) => { @@ -266,7 +300,9 @@ export const QwenImageDeployment = () => { ) : ( items.map((item) => { const isChecked = values[option.name] === item.id; - const isDisabled = Boolean(item.disabled); + const isDisabled = + item.disabled || + (typeof item.disabledWhen === 'function' && item.disabledWhen(values)); return (