Skip to content

Commit 4759a86

Browse files
authored
fix name (#312)
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
1 parent 59f02b5 commit 4759a86

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/compressed_tensors/utils/safetensors_load.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -234,11 +234,11 @@ def get_nested_weight_mappings(
234234
for key, file_location in weight_mappings.items():
235235
matched = False
236236
for param_name in params_to_nest:
237-
dense_param = match_param_name(key, param_name)
238-
if dense_param:
239-
if dense_param not in nested_weight_mappings:
240-
nested_weight_mappings[dense_param] = {}
241-
nested_weight_mappings[dense_param][param_name] = file_location
237+
module_path = match_param_name(key, param_name)
238+
if module_path:
239+
if module_path not in nested_weight_mappings:
240+
nested_weight_mappings[module_path] = {}
241+
nested_weight_mappings[module_path][param_name] = file_location
242242
matched = True
243243
if return_unmatched_params and not matched:
244244
unmatched_params[key] = file_location
@@ -271,11 +271,11 @@ def get_nested_mappings_from_state_dict(
271271
nested_weight_mappings = {}
272272
for key in state_dict.keys():
273273
for param_name in params_to_nest:
274-
dense_param = match_param_name(key, param_name)
275-
if dense_param:
276-
if dense_param not in nested_weight_mappings:
277-
nested_weight_mappings[dense_param] = {}
278-
nested_weight_mappings[dense_param][param_name] = state_dict[key]
274+
module_path = match_param_name(key, param_name)
275+
if module_path:
276+
if module_path not in nested_weight_mappings:
277+
nested_weight_mappings[module_path] = {}
278+
nested_weight_mappings[module_path][param_name] = state_dict[key]
279279
return nested_weight_mappings
280280

281281

0 commit comments

Comments
 (0)