[Bugfix][weight loader] Stop warning when a parameter only widens the weight (#60020)

Signed-off-by: lesj0610 <lesj0610@gmail.com>
Co-authored-by: Ning Xie <andy.xning@gmail.com>
This commit is contained in:
SeongJun Lee
2026-10-12 14:33:31 -04:00
committed by GitHub
co-authored by Ning Xie
parent 8055293353
commit 56e3b081ae
+9 -1
View File
@@ -322,7 +322,15 @@ class AutoWeightsLoader:
)
if param.dtype != weight_data.dtype:
logger.warning(
# An exact widening -- an fp32 accumulator reading a bf16
# table, say -- keeps every stored value, so it is a debug
# line. Every other mismatch still warns.
exact_widening = weight_data.dtype in (
torch.float16,
torch.bfloat16,
torch.float32,
) and param.dtype in (torch.float32, torch.float64)
(logger.debug if exact_widening else logger.warning)(
"Attempted to load weight %s with dtype %s into "
"parameter with dtype %s",
weight_qualname,