Skip to content

Commit 9a0675a

Browse files
committed
post rebase
1 parent deedbdf commit 9a0675a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/transformers/core_model_loading.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -739,9 +739,9 @@ def convert_and_load_state_dict_in_model(
739739
)
740740
# Offloading support
741741
if param_device == "disk":
742-
missing_keys.discard(k)
743-
# If not already offloaded, or if we applied any special Operation, we need to re-save
744-
if k not in disk_offload_index or len(operations) > 0:
742+
missing_keys.discard(target_name)
743+
# If not already offloaded, or if we applied any special Operation except Renaming, we need to re-save
744+
if target_name not in disk_offload_index or isinstance(mapping, WeightConverter):
745745
disk_offload_index = offload_weight(
746746
param, target_name, disk_offload_folder, disk_offload_index
747747
)
@@ -759,6 +759,7 @@ def convert_and_load_state_dict_in_model(
759759
)
760760
except SkipLayer:
761761
continue
762+
762763
thread_pool.shutdown(wait=False)
763764
return missing_keys, unexpected_keys, mismatch_keys, disk_offload_index, misc
764765

0 commit comments

Comments
 (0)