Skip to content

[UC] fix _load_state_dict_into_model #10645

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 26, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion paddlenlp/trainer/unified_checkpoint/load_dynamic.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,8 @@ def load_unified_checkpoint_dynamically(args, model, resume_from_checkpoint, saf
)
dist.barrier()
logger.debug("Setting state dict into model ...")
error_msgs = _load_state_dict_into_model(model, state_dict, "")
model_to_load_state_dict = model.state_dict()
error_msgs = _load_state_dict_into_model(model, state_dict, "", model_to_load_state_dict)
if len(error_msgs) > 0:
error_msg = "\n\t".join(error_msgs)
raise RuntimeError(f"Error(s) in loading dynamic state_dict for {model.__class__.__name__}:\n\t{error_msg}")
Expand Down