Fix downcasting for fp8_fast and add error to indicate you can't do scaled downcast currently

This commit is contained in:
kijai
2025-10-20 13:46:05 +03:00
parent 9ecb80a58b
commit 8081e1337c
+4 -2
View File
@@ -1112,6 +1112,8 @@ class WanVideoModelLoader:
if "scaled_fp8" in sd and "scaled" not in quantization:
raise ValueError("The model is a scaled fp8 model, please set quantization to '_scaled'")
elif "scaled_fp8" not in sd and "scaled" in quantization:
raise ValueError("The model is not a scaled fp8 model, please disable '_scaled' in quantization")
if "vace_blocks.0.after_proj.weight" in sd and not "patch_embedding.weight" in sd:
raise ValueError("You are attempting to load a VACE module as a WanVideo model, instead you should use the vace_model input and matching T2V base model")
@@ -1465,9 +1467,9 @@ class WanVideoModelLoader:
if k.endswith(".scale_weight"):
scale_weights[k] = v.to(device, base_dtype)
if quantization == "fp8_e4m3fn":
if quantization in ["fp8_e4m3fn", "fp8_e4m3fn_fast"]:
weight_dtype = torch.float8_e4m3fn
elif quantization == "fp8_e5m2":
elif quantization in ["fp8_e5m2", "fp8_e5m2_fast"]:
weight_dtype = torch.float8_e5m2
else:
weight_dtype = base_dtype