From a86dad56bcc001fecc3f9d38c52f9117a1093818 Mon Sep 17 00:00:00 2001 From: Cyril Vallez Date: Fri, 28 Mar 2025 17:57:16 +0100 Subject: [PATCH] Fix state_dict map location when quantized (#37086) * Update modeling_utils.py * Update modeling_utils.py --- src/transformers/modeling_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/transformers/modeling_utils.py b/src/transformers/modeling_utils.py index ac84297280..b14626cc65 100644 --- a/src/transformers/modeling_utils.py +++ b/src/transformers/modeling_utils.py @@ -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