[diffusion] feat: add composable component weight path cli (#36078)

This commit is contained in:
Mick
2026-08-24 09:31:08 +08:00
committed by GitHub
parent 1c1c9d9b4e
commit fee00a41db
3 changed files with 105 additions and 38 deletions
+26 -13
View File
@@ -122,20 +122,33 @@ For frame interpolation and upscaling, see [Post-Processing](./post_processing).
### Quantization
For a pre-quantized main transformer checkpoint, prefer:
- `--model-path` for the base pipeline
- `--transformer-path` for a quantized `transformers` transformer component folder
- `--transformer-weights-path` for a quantized safetensors file, directory,
repo, or a supported GGUF transformer file
- `--quantization` to override the quantization method used by the transformer loader
- `--quantization-ignored-layers` transformer layer name patterns to keep unquantized during online quantization (e.g. `attention.to_`)
Component checkpoint paths are selected separately, so changing DiT precision
never silently changes prompt embeddings. Use
`--component-paths.<component> {MODEL}` or its shorter
`--<component>-path {MODEL}` form for any component key from `model_index.json`
or a native pipeline's registered module name.
never silently changes prompt embeddings. The component-scoped forms are the
canonical interface for any component key from `model_index.json` or a native
pipeline's registered module name:
| Intent | Canonical option | Convenience alias | Behavior |
| --- | --- | --- | --- |
| Replace a component | `--component-paths.<component> {MODEL}` | `--<component>-path {MODEL}` | Load the replacement component's configuration and weights |
| Replace only its weights | `--component-weights-paths.<component> {WEIGHTS}` | `--<component>-weights-path {WEIGHTS}` | Retain the base component configuration and replace its weights |
For example, pair a replacement text-encoder configuration with a separate
single-file checkpoint as follows:
```bash
--component-paths.text_encoder Qwen/Qwen3-VL-4B-Instruct \
--component-weights-paths.text_encoder \
Comfy-Org/Krea-2/text_encoders/qwen3vl_4b_fp8_scaled.safetensors
```
The transformer-specific `--transformer-weights-path` spelling remains
supported for the primary DiT. Do not mechanically replace it with
`--component-weights-paths.transformer`: the component-scoped form requires an
actual component name, which is pipeline-specific. Use `--quantization` only
to override the method inferred by the transformer loader, and
`--quantization-ignored-layers` to keep matching transformer layers
unquantized during online quantization.
For a native text encoder:
- `--component-paths.text_encoder {MODEL}` replaces the text-encoder checkpoint; `--text-encoder-path {MODEL}` is its shorter alias