Skip to content

Commit f0eccbd

Browse files
authored
[UC] fix _load_state_dict_into_model (#10645)
1 parent a38f7b7 commit f0eccbd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

paddlenlp/trainer/unified_checkpoint/load_dynamic.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,8 @@ def load_unified_checkpoint_dynamically(args, model, resume_from_checkpoint, saf
307307
)
308308
dist.barrier()
309309
logger.debug("Setting state dict into model ...")
310-
error_msgs = _load_state_dict_into_model(model, state_dict, "")
310+
model_to_load_state_dict = model.state_dict()
311+
error_msgs = _load_state_dict_into_model(model, state_dict, "", model_to_load_state_dict)
311312
if len(error_msgs) > 0:
312313
error_msg = "\n\t".join(error_msgs)
313314
raise RuntimeError(f"Error(s) in loading dynamic state_dict for {model.__class__.__name__}:\n\t{error_msg}")

0 commit comments

Comments
 (0)