diff --git a/vllm/model_executor/model_loader/weight_utils.py b/vllm/model_executor/model_loader/weight_utils.py index 4cb8249e48..abe24fa06e 100644 --- a/vllm/model_executor/model_loader/weight_utils.py +++ b/vllm/model_executor/model_loader/weight_utils.py @@ -1380,10 +1380,9 @@ def initialize_single_dummy_weight( generator.manual_seed(seed) if torch.finfo(param.data.dtype).bits < 16: # uniform_ doesn't support < 16-bit datatypes (FP8) - dtype = param.data.dtype - tmp_param = param.data.to(torch.float16) - tmp_param = tmp_param.uniform_(low, high, generator=generator).to(dtype) - param.data.copy_(tmp_param) + tmp_param = torch.empty_like(param, dtype=torch.float16) + tmp_param.uniform_(low, high, generator=generator) + param.copy_(tmp_param) else: param.uniform_(low, high, generator=generator)