Skip to content

Commit 95dbb9e

Browse files
committed
fix
1 parent 1b060f0 commit 95dbb9e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/transformers/core_model_loading.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,6 @@ def set_param_for_module(
394394
with log_to_misc(full_param_name, misc, full_param_name):
395395
module_path, _, param_name = full_param_name.rpartition(".")
396396
module_obj = model.get_submodule(module_path) if module_path else model
397-
param_value = param_value[0] if isinstance(param_value, list) else param_value[...]
398397
ref = getattr(module_obj, param_name)
399398

400399
use_dtensor = hasattr(distributed_operation, "use_dtensor") and distributed_operation.use_dtensor
@@ -584,6 +583,7 @@ def convert_and_load_state_dict_in_model(
584583
)
585584

586585
for k, output_value in realized_value.items():
586+
output_value = output_value[0] if isinstance(output_value, list) else output_value
587587
for src in converter.source_keys: # what should happen to k when we meet k at saving
588588
inverse_converters[k] = {src: converter}
589589

tests/test_modeling_common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2371,7 +2371,7 @@ def test_disk_offload_bin(self):
23712371
max_size = int(self.model_split_percents[1] * model_size)
23722372
max_memory = {0: max_size, "cpu": max_size}
23732373
new_model = model_class.from_pretrained(
2374-
tmp_dir, device_map="auto", max_memory=max_memory, offload_folder=tmp_dir
2374+
tmp_dir, device_map="auto", max_memory=max_memory, offload_folder=tmp_dir, use_safetensors=False
23752375
)
23762376

23772377
self.check_device_map_is_respected(new_model, new_model.hf_device_map)

0 commit comments

Comments
 (0)