From a37c402f32a7ef035c4b9d3ddcb629f8b8abedb5 Mon Sep 17 00:00:00 2001 From: Ning Xie Date: Thu, 1 Oct 2026 11:07:31 +0800 Subject: [PATCH] [weight loader] add dtype equality validation between parameter and weight (#51792) Signed-off-by: Andy Xie --- vllm/model_executor/models/utils.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/vllm/model_executor/models/utils.py b/vllm/model_executor/models/utils.py index c6498319cd..bbb7a54b55 100644 --- a/vllm/model_executor/models/utils.py +++ b/vllm/model_executor/models/utils.py @@ -321,6 +321,14 @@ class AutoWeightsLoader: f"into a single parameter {base_prefix!r}" ) + if param.dtype != weight_data.dtype: + logger.warning( + "Attempted to load weight %s with dtype %s into " + "parameter with dtype %s", + weight_qualname, + weight_data.dtype, + param.dtype, + ) weight_loader = getattr(param, "weight_loader", default_weight_loader) weight_loader(param, weight_data)