Fixing _pre_quantization_dtype when torch_dtype is None (#36930)

fix
This commit is contained in:
Mohamed Mekkouri
2025-03-25 10:43:27 +01:00
committed by GitHub
parent 4303d88c09
commit be2c0e7bff

View File

@@ -4454,7 +4454,7 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin, PushToHubMix
# once the weights have been quantized # once the weights have been quantized
# Note that once you have loaded a quantized model, you can't change its dtype so this will # Note that once you have loaded a quantized model, you can't change its dtype so this will
# remain a single source of truth # remain a single source of truth
config._pre_quantization_dtype = torch_dtype config._pre_quantization_dtype = torch_dtype if torch_dtype is not None else torch.get_default_dtype()
# Prepare the full device map # Prepare the full device map
if device_map is not None: if device_map is not None: