Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

Merge branch 'feat/fp8_anima' into feat/fp8_quantized_guard

Alexander Eichhorn1f54512682aa
diff --cc invokeai/backend/model_manager/load/load_default.py
index 4d5a315f34,cd85699833..170f111787
--- a/invokeai/backend/model_manager/load/load_default.py
+++ b/invokeai/backend/model_manager/load/load_default.py
@@@ -384,11 -406,13 +442,18 @@@ class ModelLoader(ModelLoaderBase)
`_skip_layerwise_casting_patterns`), which are model-specific and cannot be inferred from
layer types or generic name patterns.
+ Modules holding already-quantized weights are skipped regardless of their class. This is a
+ backstop behind the format check in `_should_use_fp8`, which cannot see quantization that
+ is not reflected in the model's format (e.g. a `diffusers`-format checkpoint whose weights
+ were quantized by an external tool).
++
+ Records the compute dtype on the model. After the cast, `model.dtype` reports the float8
+ storage dtype, which must never be used to create or cast tensors — torch has no arithmetic
+ kernels for it (see `get_model_compute_dtype`). The marker is set here rather than at the
+ call sites so a new caller cannot forget it.
"""
+ set_fp8_compute_dtype(model, compute_dtype)
+
skip_patterns = _FP8_DEFAULT_SKIP_PATTERNS + tuple(extra_skip_patterns)
for module_name, module in model.named_modules():
if not isinstance(module, _FP8_SUPPORTED_PYTORCH_LAYERS):