Fix state_dict map location when quantized (#37086)

* Update modeling_utils.py

* Update modeling_utils.py
This commit is contained in:
Cyril Vallez 2025-03-28 17:57:16 +01:00 committed by GitHub
parent d6064754ea
commit a86dad56bc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4897,7 +4897,7 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin, PushToHubMix
map_location = "cpu"
if low_cpu_mem_usage:
if shard_file.endswith(".safetensors") and not is_quantized:
if shard_file.endswith(".safetensors"):
map_location = "meta"
elif (
device_map is not None