Cache-DiT CLI Reference¶
Cache-DiT exposes three command-line entry points:
| Command | Console script | Purpose |
|---|---|---|
python3 -m cache_dit.generate |
cache-dit-generate |
Run one registered model or model path for generation and benchmarking |
python3 -m cache_dit.serve |
cache-dit-serve |
Start the local OpenAI-compatible image/video server |
python3 -m cache_dit.convert |
cache-dit-convert |
Convert a floating-point pipeline to a self-contained TorchAO, native FP8/NVFP4, or SVDQ DQ checkpoint |
generate and serve share the same model selector and acceleration flags. serve adds HTTP
listener/transport options, and convert is an independent offline conversion tool.
Shared argument grammar¶
- Flags ending in
--xxx-configtake one comma-separatedk=vlist. Quote the whole value in a shell. - Every
--xxx-configflag also accepts the legacy--xxx-paramsspelling. It is kept only as an internal compatibility alias; prefer--xxx-configin scripts and documentation. - The first bare item is family-specific: a cache/calibrator/attention
type, the transformer quantization type, a compile component, or an offload mode. - Unknown keys inside an optimization family are rejected. Unknown scalar keys inside sampling are forwarded to the pipeline as input kwargs.
- The canonical launch YAML is shared by
generateandserveand is loaded with--launch-config FILE. An explicit CLI family replaces that whole YAML section. prompt, model paths, media paths, and server request payloads are not sampling settings. They stay in their dedicated flags or HTTP fields.
Config families at a glance¶
| Family | Concrete example |
|---|---|
| Sampling | --sampling-config 'height=1024,width=1024,steps=28,seed=0' |
| Compile | --compile-config 'transformer,vae' |
| Cache | --cache-config 'DBCache,rdt=0.12' |
| Calibrator | --calibrator-config 'taylorseer,order=1' |
| Quantization | --quantize-config 'float8_per_row,text:float8_wo' |
| SVDQuant | --quantize-config 'svdq_nvfp4_r32_dq' --svdq-config 'smooth_strategy=few_shot' --offload-config 'svdq' |
| Attention | --attn-config 'ffpa,bits=8' |
| Parallelism | --parallel-config 'ulysses=2,tp=2,text=true' |
| Communication quantization | --quant-communicate-config 'bits=6' |
| Offload | --offload-config 'layerwise,async_transfer=true,transfer_buckets=4' |
| Extra | --extra-config 'vae_tiling=true' |
| Launch YAML | --launch-config 'examples/configs/launch_flux.yaml' |
cache_dit.generate¶
Model and task selection¶
| Option | Meaning | Values (default) |
|---|---|---|
task (positional) |
list, a registered model name, or a model path / repo id |
list, model name, or path; default generate |
model (positional) |
Second positional for the generate <model> form |
Registered model name; default None |
--task |
Force the task when one checkpoint has several models | T2V, T2VA, I2V, T2I, IE2I, FLF2V, VACE, FL2VA, REF2VA, T2A, ANIMATE, S2V; default None (auto) |
--model-path |
Override the model path | Path or repo id; default None |
--transformer-path |
Override the transformer checkpoint | Path; default None |
--controlnet-path |
Override ControlNet weights | Path; default None |
--lora-path |
Override LoRA weights | Path; default None |
--model-summary, --msummary |
Log the model configuration before running; --example-summary / --esummary are deprecated aliases |
Flag; default False |
list prints every registered model. An exact registered name wins; otherwise the selector is
matched as a model path against registered default models. For a quantized pipeline directory, the
source_model recorded in quant_manifest.json selects the registered model even if the directory
has been renamed.
Input and media paths¶
| Option | Meaning | Values (default) |
|---|---|---|
--prompt |
Override the prompt | Text; default model prompt |
--prompt-enhancer |
Local prompt-enhancer repository for models that own that step | Path; default None |
--image-path |
Input image for I2V, editing, or VACE workflows | Path; default None |
--mask-image-path |
Inpainting mask | Path; default None |
--last-image-path |
Last frame for first/last-frame conditioning | Path; default None |
--driving-video-path |
Driving video for character animation | Path; default None |
--driving-video-fps |
Resample rate of the driving video | Float; default None |
--audio-path |
Driving waveform for speech-to-video | Path; default None |
--reference-image-path ... |
One or more image references, consumed in image → video → audio order | One or more paths; default None |
--reference-video-path ... |
One or more video references | One or more paths; default None |
--reference-audio-path ... |
One or more audio references | One or more paths; default None |
Sampling¶
--sampling-config accepts:
| Key | Meaning | Values (default) |
|---|---|---|
height, width (H, W) |
Output geometry | Integer pixels; default None (model decides) |
input_height, input_width |
Input geometry for editing/video workflows | Integer pixels; default None |
num_inference_steps (steps) |
Denoising steps | Integer; default None (model scheduler decides) |
num_frames (frames) |
Video frame count | Integer; default None |
seed |
Sampling seed | Integer; default None |
saved_fps (fps) |
Export FPS | Float; default 8 |
negative_prompt |
Negative prompt | Text; default None |
skip_negative_prompt |
Drop the model's negative prompt | Boolean; default False |
generator_device |
Device for torch.Generator; CPU sampling is not reproducible across torch versions |
cpu, cuda; default None (model device) |
| Other scalar keys | Pipeline-specific input kwargs | Any scalar/list; default none, e.g. guidance_scale, audio_duration_s |
Warmup, output, and diagnostics¶
| Option | Meaning | Values (default) |
|---|---|---|
--warmup |
Warmup runs before timing | Integer; default 1 |
--warmup-num-inference-steps, --warmup-steps |
Steps used only during warmup | Integer; default None (same as sampling) |
--warmup-seed |
Seed used only during warmup | Integer; default None |
--warmup-prompt |
Prompt used only during warmup | Text; default None |
--repeat |
Timed repeats | Integer; default 1 |
--save-path |
Output image/video path | Path; default None |
--cache-summary, --summary |
Log cache statistics | Flag; default False |
--track-memory, --mem |
Report peak GPU memory | Flag; default False |
--profile |
Enable torch.profiler |
Flag; default False |
--profile-name |
Profiling session name | Text; default None |
--profile-dir |
Profiling output directory | Path; default None |
--profile-activities |
Profiler activities | One or more of CPU, GPU, MEM; default CPU GPU |
--profile-with-stack |
Record stacks | Boolean; default True |
--profile-record-shapes |
Record tensor shapes | Boolean; default True |
--disable-fuse-lora |
Skip fuse_lora even when LoRA weights are supplied |
Boolean; default None (fuse when provided) |
Cache and calibrator¶
--cache-config selects DBCache (default), SeaCache, or SoftCache.
| Key | Meaning | Values (default) |
|---|---|---|
Fn / Fn_compute_blocks |
First N blocks always computed | Integer; default 1 |
Bn / Bn_compute_blocks |
Last N blocks always computed | Integer; default 0 |
rdt / residual_diff_threshold |
Cache reuse threshold | Float; default 0.12 |
ws / max_warmup_steps |
Steps always computed at the start | Integer; default 8 |
wi / warmup_interval |
Warmup interval | Integer; default 1 |
mc / max_cached_steps |
Maximum cached steps; -1 is unlimited | Integer; default -1 |
mcc / max_continuous_cached_steps |
Maximum consecutive cached steps | Integer; default 3 |
scm / mask_policy |
Steps-mask policy | slow, medium, fast, ultra; default None |
steps_mask |
Enable the steps computation mask | Boolean; default False |
seacache |
Enable the SeaCache probe | Boolean; default False |
seacache_mode |
SeaCache mode | flow, vp; default flow |
seacache_feature_shape |
SEA feature geometry | HxW for images, FxHxW for video; default None |
seacache_power_exp |
SEA probe exponent | Float; default 2 |
softcache |
Enable SoftCache | Boolean; default False |
softcache_tau |
SoftCache threshold | Float; default 0.5 |
softcache_jf_max |
SoftCache JF cap | Integer; default 8 |
--calibrator-config requires cache and selects one type:
| Type | Meaning | Values (default) |
|---|---|---|
taylorseer |
TaylorSeer extrapolation | order (default 1; valid 1,2,...) |
dmd |
DMD predictor | history (6), rank (0; 0,16,32,...), ridge (1e-8), svd_precision (medium; low, medium, high) |
foca |
FoCa feature calibration | No type-specific keys |
svd |
SVD residual predictor | tau (0.9; (0,1]), beta (0.9; [0,1)), max_rank (0), predictor (ema; ema, taylor), order (1; 1,2,...) |
hicache |
Hermite cache extrapolation | order (2; 1,2,...), sigma (0.5; (0,1]) |
brace |
BRACE window calibration | capacity (3; 1,2,...), gamma (0.7; (0,1]) |
bezicast |
BeziCast calibration | history (6), control_points (4), ridge (0.5), guardrail (False), u_max (1.5), beta_max (1.0), rho (None), gamma (1.0) |
residual_motion |
Residual-motion correction | beta (1.0) |
Every calibrator also accepts calibrator_cache_type=residual|hidden_states and
encoder=true|false.
Quantization¶
--quantize-config: the first bare entry or quant_type selects the
transformer type; text:<type> or text_encoder:<type> selects the primary text encoder. VAE
quantization is not supported. When the input is already a quantized pipeline checkpoint, omit this
option: the manifest restores its stored components and a second quantization pass is rejected. For
an SVDQ checkpoint, --svdq-config accepts only the runtime-only runtime_kernel and lora_layout
overrides.
Common convenience aliases:
| Alias | Expands to |
|---|---|
float8, fp8 |
float8_per_row |
float8,torchao / float8,cache_dit |
FP8 per-row with an explicit backend |
nvfp4 |
nvfp4 (AUTO routes to TorchAO) |
nvfp4,cache_dit |
Native cache-dit NVFP4 |
SVDQ,rank=32 |
svdq_nvfp4_r32_dq on sm120, svdq_int4_r32_dq otherwise |
text:float8_wo |
float8_weight_only text encoder |
SVDQ defaults to rank 32 when rank is omitted; the allowed ranks are 32, 64, 128 and 256.
The SVDQ,rank=N shorthand is CLI-only; in launch YAML write the full quant_type instead.
| Key | Meaning | Values (default) |
|---|---|---|
quant_type |
Transformer quantization type | float8_per_row (default), float8_per_tensor, float8_per_block, int8_per_row, int8_per_tensor, nvfp4, mxfp4_weight_only, svdq_int4_r{32,64,128,256}_dq, svdq_nvfp4_r{32,64,128,256}_dq, svdq_fp8_r{32,64,128}_dq, svdq_w4a8_*, svdq_w6a6_*, svdq_fp6_*, svdq_w1a4_*, svdq_w2a4_*, svdq_w3a4_* |
backend |
Quantization backend | auto, torchao, cache_dit; default auto |
regional_quantize |
Quantize only repeated regions | Boolean; default True |
per_tensor_fallback |
Fall back unsupported layers to FP8 per-tensor | Boolean; default True |
exclude_layers |
Substrings appended to the built-in exclusion list | +-separated strings; default built-ins embedder, embed, modulation, mod |
text, text_encoder |
Quantize the primary text encoder | Boolean, or a text-encoder type; default absent (no TE quantization) |
verbose |
Per-layer quantization logging | Boolean; default False |
fp8_fused_mlp |
Fuse native FP8 MLP epilogues | Boolean; default False; requires backend=cache_dit and an FP8 quant_type |
fp4_fused_mlp |
Fuse native NVFP4 MLP epilogues | Boolean; default False; requires backend=cache_dit and quant_type=nvfp4 |
mxfp4_quantize_device |
Device for one-time MXFP4 packing | auto, cpu, cuda; default auto |
--svdq-config requires an svdq_* transformer type:
--quantize-config 'svdq_nvfp4_r32_dq' --svdq-config 'smooth_strategy=few_shot' \
--offload-config 'svdq'
| Key | Meaning | Values (default) |
|---|---|---|
runtime_kernel |
SVDQ runtime GEMM | native, cute, flashinfer, flashinfer+cute-dsl, flashinfer+cutlass-sm120; default None (auto → native) |
lora_layout |
LoRA layout | native, row_major; default None (auto; row_major requires runtime_kernel=cute) |
smooth_strategy |
Activation smoothing strategy | identity, activation, weight, weight_inv, few_shot; default identity |
calibrate_precision |
Calibration precision | low, medium, high; default low |
few_shot_steps |
Forward samples collected for few-shot smoothing | Integer; default 1 |
few_shot_relax_factor |
Few-shot relaxation multiplier | Float; default 1.5 |
few_shot_relax_top_ratio |
Fraction of channels considered by relaxation | Float in [0,1]; default 0.25 |
few_shot_relax_strategy |
Few-shot relaxation search | fixed, stable_auto, auto, top, power, log, rank; default auto |
few_shot_auto_compile |
Let few-shot DQ trigger compilation | Boolean; default False (derived True when the CLI is already compiling) |
fused_mlp |
Fuse GELU/SwiGLU epilogues | Boolean; default False |
quantize_device |
Device for SVD and packing math | auto, cpu, cuda; CLI default cuda |
streaming |
Stream calibration activations | Boolean; default True |
activation_buffer_flush_sample_count |
Samples per activation flush | Integer; default 1 |
activation_buffer_flush_cpu_bytes |
CPU activation-buffer budget | Byte size such as 4GiB; default None (unbounded) |
svd_refine_iters |
SVD refinement iterations | Integer; default 0 |
packed_a4_stages |
Packed-A4 stage count | Integer; default 2 (auto 3 for W1A4/W2A4) |
packed_a4_inner_group |
Packed-A4 inner group | Integer; default 4 |
Layerwise enable/placement/transfer keys belong to --offload-config 'svdq,...', not here.
Attention and communication¶
--attn-config selects a backend and its options:
flash, flash_varlen, flashinfer, _flash_3, native, _native_cudnn, _sdpa_cudnn, sage, sage3,
sol_attn, ffpa, ffpa_fp8, ffpa_fp4, ffpa_fp8_per_block, _native_npu, _npu_fia,
_mindiesd_laser.
The ffpa family accepts bits=16|8|4 instead of the concrete backend. Backend-specific keys:
| Backend | Keys |
|---|---|
sol_attn |
tau, thresh_type=diag\|exact, strict, sink_tokens |
ffpa / bits=16 |
hybrid, hybrid_n_early |
ffpa_fp8 / bits=8, ffpa_fp8_per_block |
hybrid, hybrid_n_early, fp8_hadamard, fp8_smooth_v |
ffpa_fp4 / bits=4 |
hybrid, hybrid_n_early, fp4_hadamard, fp4_pv_mm_type=fp4\|fp8, fp4_smooth_v |
--quant-communicate-config (short alias --quant-comm-config; the legacy
--quant-communicate-params / --quant-comm-params spellings are hidden compatibility aliases)
requires Ulysses > 1:
| Key | Meaning | Values (default) |
|---|---|---|
bits |
Communication quantization width | 8, 6, 4; default 8 |
quant_type |
Compression layout | per_token, per_group_16, per_group_32; default per_group_16; FP4 uses G16 |
quantize_k |
Quantize K in addition to Q/V/O | Boolean; default True |
Parallelism and launcher¶
--parallel-config:
| Key | Meaning | Values (default) |
|---|---|---|
ulysses |
Ulysses context-parallel degree | Integer >= 1; default 1 |
ring |
Ring context-parallel degree | Integer >= 1; default 1 |
tp |
Tensor-parallel degree | Integer >= 1; default 1 |
vae |
Add the VAE to the parallel modules | Boolean; default False |
text |
Add the primary text encoder (TE-P) | Boolean; default False |
controlnet |
Add ControlNet | Boolean; default False |
ulysses_anything |
Uneven Ulysses split (UAA) | Boolean; default False |
ulysses_async |
Async Ulysses QKV overlap (model-specific; incompatible with ulysses_head_chunk) |
Boolean; default False |
ulysses_head_chunk |
Generalize Async Ulysses with Head Chunk (FFPA recommended; no per-model async patch) | Boolean; default False |
ulysses_head_chunk_groups |
Head groups in flight at once | Integer >= 0; default 0 (auto) |
ring_rotate_method |
Ring rotation implementation | p2p, allgather; default p2p |
ring_convert_to_fp32 |
Keep Ring rotation in fp32 | Boolean; default True |
The product of ulysses × ring × tp must equal the number of processes. Component modifiers require
an active degree greater than one.
--launcher {auto,ray,local} selects how extra workers are started. auto uses Ray when installed
and local subprocesses otherwise.
Offload¶
--offload-config selects exactly one mode:
# Generic cache-dit layerwise offload
--offload-config 'layerwise,async_transfer=true,transfer_buckets=4'
# SVDQ controller-owned placement; pair with an svdq_* quantization type
--quantize-config 'svdq_nvfp4_r32_dq' \
--svdq-config 'smooth_strategy=few_shot' \
--offload-config 'svdq'
# diffusers model / sequential CPU offload
--offload-config 'cpu_offload'
--offload-config 'sequential_cpu_offload'
# AdaLN table streaming / precomputed plans
--offload-config 'adaln_host'
--offload-config 'adaln_online'
# Balanced multi-GPU placement
--offload-config 'device_map'
| Mode | Meaning | Values (default) |
|---|---|---|
layerwise |
cache-dit generic component layerwise offload | Mode string; no default (select one) |
svdq |
SVDQ few-shot layerwise collection and placement | Mode string; requires an svdq_* type |
cpu_offload |
diffusers model CPU offload | Mode string |
sequential_cpu_offload |
diffusers sequential CPU offload | Mode string |
adaln_host, adaln_host_residency |
Keep the transformer resident and stream AdaLN tables | Mode string |
adaln_online |
Precompute AdaLN tables for a fixed grid and park projections on the host | Mode string |
device_map |
Balanced multi-GPU device map | Mode string |
svdq is not a generic offload backend. SVDQ few-shot quantization materializes quantized weights at
runtime, so its controller must decide which layers stay on CPU, when they move to the execution
device, and which temporary layerwise offload covers the current forward. --offload-config svdq
therefore hands that lifecycle to the SVDQ controller; it implies layerwise_offload=true and
offload_quantized_layers_to_cpu=true, with optional transfer-placement keys such as
defer_move_to_execution_device. Algorithm choices (smooth_strategy, runtime_kernel,
lora_layout, few_shot_*) remain in --svdq-config. It requires an svdq_* transformer type and
cannot be combined with layerwise, cpu_offload, or another offload mode.
Layerwise and SVDQ default to async_transfer=true, transfer_buckets=4.
| Key | Meaning | Values (default) |
|---|---|---|
async_transfer |
Stream-based async transfer | Boolean; default True for layerwise/svdq |
transfer_buckets |
Prefetch depth hint | Integer; default 4 for layerwise/svdq |
prefetch_limit |
Conservative future-prefetch cap | Boolean; default False |
max_copy_streams |
Async copy-stream cap | Integer; default None (auto) |
max_inflight_prefetch_bytes |
Residency budget | Byte size such as 4GiB; default None (unlimited) |
persistent_buckets |
Targets kept resident for the handle lifetime | Integer; default 0 |
persistent_bins |
Distribution bins for persistent targets | Integer; default 1 |
text, text_async_transfer, text_transfer_buckets, ... |
Text-encoder overrides for layerwise |
Boolean/integer; default None (inherit target values) |
offload_quantized_layers_to_cpu |
Keep SVDQ quantized layers on CPU | Boolean; default True when mode is svdq |
defer_move_to_execution_device |
Defer the final move until the forward returns | Boolean; default False (derived True for few-shot SVDQ) |
Compile¶
Use --compile-config. Components are transformer, text, text_encoder,
vae, controlnet; options are repeated_blocks, dynamic, cuda_graph, full_graph,
max_autotune.
--compile-config 'transformer'
--compile-config 'transformer,vae'
--compile-config 'transformer,text,vae,repeated_blocks=false,dynamic=false'
Options without a component default to the transformer. The VAE defaults to static graphs and locally disables Inductor coordinate-descent tuning.
Extra VAE options¶
--extra-config:
| Key | Meaning | Values (default) |
|---|---|---|
vae_tiling, vae_slicing |
Low-memory VAE decoding; rejected with VAE parallelism | Boolean; default False |
Launch YAML¶
--launch-config accepts these top-level sections:
parallel, quant_communicate, cache, calibrator, quantize, svdq, attn, compile,
sampling, offload, extra.
Legacy cache_config / parallelism_config / quantize_config sections are rejected. The Python
cache_dit.load_configs() schema is separate and is not accepted by --launch-config.
cache_dit.serve¶
python3 -m cache_dit.serve [task] [model] [generate options] [server options]
cache-dit-serve [task] [model] [generate options] [server options]
serve accepts every generate option above and adds the server options below. Model loading, Ray
workers, warmup, and SVDQ few-shot materialization complete before the HTTP listener opens.
Server options¶
| Option | Meaning | Values (default) |
|---|---|---|
--host |
HTTP listen address | Host string; default 127.0.0.1 |
--port |
HTTP listen port | Integer; default 8000 |
--served-model-name |
Model id returned by /v1/models |
String; default registered model name |
--output-dir |
Generated image/video directory | Path; default ./outputs/serve |
--api-key |
Optional bearer token; /health remains public |
String; default $CACHE_DIT_API_KEY |
--max-image-mb |
Maximum upload size per image | Integer MiB; default 20 |
--public-url |
URL prefix used behind a reverse proxy | URL; default request base URL |
--executor |
Execution backend; the local server currently supports Ray only | ray; default ray |
--ray-address |
Existing Ray cluster address | Address string; default None |
--ray-runtime-env |
JSON object forwarded to ray.init |
JSON object; default None |
--ray-transfer-backend |
Worker checkpoint transfer backend | auto, save_pretrained, from_pretrained, object_store; default auto |
Single-GPU serving uses one Ray actor. Multi-GPU serving uses one actor per rank; the parallel degrees
come from --parallel-config.
Image endpoints¶
| Endpoint | Meaning |
|---|---|
POST /v1/images/generations |
Text-to-image JSON request |
POST /v1/images/edits |
Multipart editing request; one or multiple image fields |
GET /v1/images/{id}/content |
Download an image returned with response_format=url |
GET /v1/models, GET /v1/models/{id} |
Loaded model metadata |
GET /health |
Driver and Ray actor health |
GET /docs |
FastAPI schema |
Image request fields: prompt, size, seed, num_inference_steps, guidance_scale,
true_cfg_scale, negative_prompt, response_format=b64_json|url,
output_format=jpeg|png|webp, n. Editing adds image (repeatable) and optional mask.
n must be 1. stream=true, partial_images>0, and background=transparent return 400.
Video endpoints¶
| Endpoint | Meaning |
|---|---|
POST /v1/videos |
Create a T2V/T2VA job and return it as queued |
GET /v1/videos |
List jobs with after, limit, order |
GET /v1/videos/{id} |
Poll queued, in_progress, completed, failed |
GET /v1/videos/{id}/content?variant=video |
Download the completed MP4 |
DELETE /v1/videos/{id} |
Delete a terminal job; running jobs return 409 |
Video request fields: prompt, seconds or num_frames, size, fps, seed,
num_inference_steps, guidance_scale, true_cfg_scale, negative_prompt. seconds and
num_frames are mutually exclusive. Wan aligns frames to 4*n+1; H3 aligns up to 17*n+5, uses
24 fps, and accepts aligned durations from 5 to 15 seconds.
Serve-only constraints¶
- Request-level cache, quantization, parallel degrees, and LoRA are immutable.
- CUDA Graph, full graph, dynamic compile for transformer/text/controlnet, max-autotune, and disabling regional compile are rejected at startup.
- Generic CPU/sequential/layerwise offload, primary text-encoder quantization, component compile, VAE tiling/slicing, SVDQ few-shot, and AdaLN host/online are applied inside Ray workers.
- VAE tiling/slicing is incompatible with VAE parallelism.
- AdaLN is incompatible with SVDQ few-shot layerwise offload.
cache_dit.convert¶
python3 -m cache_dit.convert /path/to/FLUX.1-dev \
--save-dir ./FLUX.1-dev-fp8 \
--quantize-config 'float8_per_row,text:float8_weight_only'
| Option | Meaning | Values (default/required) |
|---|---|---|
MODEL_DIR |
Source floating-point pipeline directory or Hub id | Positional; required |
--save-dir |
Empty output directory for a complete copy, or MODEL_DIR for in-place quantization |
Path; required; directories must not contain one another |
--quantize-config |
Transformer and optional primary text-encoder quantization | Same grammar as generate; required |
--workflow |
Workflow used to load a ModularPipeline |
For example t2va; required for modular sources, rejected otherwise |
--torch-dtype |
Pipeline load dtype | float16, bfloat16, float32; default bfloat16 |
--device |
Device used for quantization | Any torch device string; default cuda |
--parallel-config |
Bake a tensor-parallel layout into the checkpoint | tp=N; CP/VAE/text-encoder degrees are runtime-only and rejected |
--launcher |
How TP workers start when the command is not under torchrun | auto, local; default auto |
--svdq-config |
SVDQ algorithm options | k=v,k=v; default None |
--verbose |
Print detailed quantization information | Flag; default False |
--model-path and --quant-type are deprecated aliases for positional MODEL_DIR and
--quantize-config. The converter supports six TorchAO FP8/NVFP4 types, native FP8/NVFP4, and SVDQ
_dq types. TorchAO INT8/INT4, MXFP4, SVDQ PTQ, and SVDQ few-shot are not accepted by this offline
workflow. SVDQ FP8, W4A8, W1A4, W2A4, and W3A4 require --torch-dtype bfloat16.
With a different --save-dir, the converter checks disk space and copies the complete MODEL_DIR
before quantization. It verifies every copied source file byte-for-byte, removes the copied float
weights of quantized components, and writes their configs and checkpoints under
cache_dit_quant/<component>/. The root quant_manifest.json is written last. If the copy does not
fit, conversion exits before copying and suggests an in-place command.
With --save-dir MODEL_DIR, no original file is copied, deleted, or rewritten. The converter adds
only cache_dit_quant/ and quant_manifest.json, then verifies that source file size and mtime
signatures are unchanged. In-place mode keeps the float weights, so total disk usage increases even
though runtime memory uses the quantized components. Hub inputs are resolved to a complete local
snapshot after a disk precheck. See Quantized Pipeline Converter CLI
for examples and the complete layout.
Generate from or serve the converted directory directly, without another --quantize-config:
python3 -m cache_dit.generate ./FLUX.1-dev-fp8 --compile-config 'transformer'
python3 -m cache_dit.serve ./FLUX.1-dev-fp8 --compile-config 'transformer'
--parallel-config 'tp=2' shards the transformer before quantization and stores one checkpoint slice
per rank under cache_dit_quant/<component>/tp2/rank{0,1}/. Workers start automatically; no manual
torchrun is needed. Such a checkpoint is bound to its TP degree and must be served with the same
tp=N (CP can be added at serve time):
python3 -m cache_dit.convert /path/to/FLUX.1-dev --save-dir ./FLUX.1-dev-nvfp4-tp2 \
--quantize-config 'nvfp4' --parallel-config 'tp=2'
python3 -m cache_dit.serve ./FLUX.1-dev-nvfp4-tp2 --parallel-config 'ulysses=2,tp=2'
The manifest's source_model drives model selection regardless of the output directory name.
Pre-quantized checkpoints reject a second quantization pass, LoRA fusion, and device_map=balanced.
TorchAO and native FP8/NVFP4 checkpoints support TP and CP+TP by re-quantizing each local shard
after the TP plan. Only SVDQ runtime_kernel and lora_layout
may be overridden with --svdq-config; other algorithm settings are fixed by the checkpoint. On a
serialized SVDQ checkpoint, --offload-config svdq means generic layerwise module offload, not a
new few-shot quantization pass. Custom float component overrides cannot replace quantized components.
cache_dit.load accepts an individual cache_dit_quant/<component>/ directory containing
component_manifest.json, as well as the legacy SVDQ file/directory forms.
Compatibility notes¶
--compileremains accepted only as a source-compatibility switch for transformer-only compilation. New commands and documentation use--compile-config 'transformer'.- The Python
cache_dit.load_configs()YAML schema is unchanged, but only the new launch schema is accepted by--launch-config. cache-dit-convertaccepts--model-pathand--quant-typeas deprecated aliases for positionalMODEL_DIRand--quantize-config; prefer the new spellings in new commands.
Removed generate/serve options¶
Do not use the removed per-feature switches: --cache, --Fn, --Bn, --rdt, --parallel,
--parallel-type, --parallel-vae, --parallel-text, --parallel-controlnet,
--ulysses-anything, --uaa, --ulysses-async, --uaqkv, --ring-rotate-method, --rotate,
--ring-no-convert-to-fp32, --no-fp32, --quantize, --q, --quantize-type,
--quantize-backend, --attn, --calibrator, --taylorseer, --dmd, --foca, --svd,
--hicache, --steps-mask, --mask-policy, --steps, --height, --width, --num-frames,
--seed, --negative-prompt, --extra-input-kwargs, --generator-device, --cpu-offload,
--sequential-cpu-offload, --module-layerwise-cpu-offload, --layerwise-offload,
--adaln-host-residency, --adaln-online, --device-map-balance, --compile-vae,
--compile-text-encoder, --compile-controlnet, --cuda-graph, --compile-full-graph,
--force-compile-dynamic, --max-autotune, --disable-compile-repeated-blocks, --vae-tiling,
--vae-slicing, --ray-use-compile, --disable-per-row, and --config.