Image-to-Video
Cosmos
Diffusers
Safetensors
cosmos3_omni
nvidia
cosmos3
video-generation
fp8
quantized
modelopt
Instructions to use prometheusAIR/Cosmos3-Super-Image2Video-4Step-FP8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Cosmos
How to use prometheusAIR/Cosmos3-Super-Image2Video-4Step-FP8 with Cosmos:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Fix NVFP4 config-building crash (dict-vs-list format assumption) in build_quant_cfg
Browse files
serve_cosmos3_i2v4step_diffusers.py
CHANGED
|
@@ -100,15 +100,18 @@ def build_quant_cfg(fmt: str) -> dict:
|
|
| 100 |
}
|
| 101 |
if fmt == "nvfp4":
|
| 102 |
import copy
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
base = getattr(mtq, "W4A16_NVFP4_CFG", None) or mtq.NVFP4_DEFAULT_CFG
|
| 104 |
-
|
| 105 |
-
cfg.setdefault("quant_cfg", {})
|
| 106 |
-
cfg["quant_cfg"]["*input_quantizer"] = {"enable": False}
|
| 107 |
-
cfg["quant_cfg"]["*output_quantizer"] = {"enable": False}
|
| 108 |
-
cfg["quant_cfg"]["*softmax_quantizer"] = {"enable": False}
|
| 109 |
-
for s in SPARE_SUBSTRINGS:
|
| 110 |
-
cfg["quant_cfg"][f"*{s}*weight_quantizer"] = {"enable": False}
|
| 111 |
-
return cfg
|
| 112 |
raise ValueError(f"Unknown format: {fmt!r}")
|
| 113 |
|
| 114 |
|
|
|
|
| 100 |
}
|
| 101 |
if fmt == "nvfp4":
|
| 102 |
import copy
|
| 103 |
+
# Return the base preset UNMODIFIED -- on this installed modelopt version,
|
| 104 |
+
# W4A16_NVFP4_CFG's quant_cfg is a LIST (newer format), not the dict this
|
| 105 |
+
# function used to assume (confirmed empirically: "TypeError: list indices
|
| 106 |
+
# must be integers or slices, not str" trying dict-style key assignment
|
| 107 |
+
# here). enforce_weight_only_and_spare() below disables activations/spares
|
| 108 |
+
# on the model's actual inserted quantizer modules AFTER mtq.quantize(),
|
| 109 |
+
# which is config-form agnostic -- no need to pre-bake into the config dict.
|
| 110 |
+
# load_cosmos3_modelopt.py's loader re-applies the same disabling on every
|
| 111 |
+
# restore anyway (modelopt_state replays the config, not our imperative
|
| 112 |
+
# .disable() calls), so skipping the pre-bake here loses nothing.
|
| 113 |
base = getattr(mtq, "W4A16_NVFP4_CFG", None) or mtq.NVFP4_DEFAULT_CFG
|
| 114 |
+
return copy.deepcopy(base)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 115 |
raise ValueError(f"Unknown format: {fmt!r}")
|
| 116 |
|
| 117 |
|