This commit is contained in:
Florian Agsteiner 2026-08-16 08:20:08 +08:00 committed by GitHub
commit 20b9f6665f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 0 deletions

View File

@ -1209,6 +1209,11 @@ def _load_quantized_module(module, super_load, state_dict, prefix, local_metadat
raise ValueError(f"Missing W4A8 group scale (weight_s_rel) for layer {layer_name}")
if scale.dtype == torch.uint8:
scale = scale.view(torch.float8_e4m3fn)
if device.type == "mps":
# MPS has no fp8 casts at all, so the eager dequant path dies on
# s_rel.float(). fp32 is the only other dtype the eager backend
# declares for s_rel, so fp16 is not an option here.
scale = scale.float()
params_conf = layer_conf.get("params", {})
if not isinstance(params_conf, dict):
params_conf = {}