Skip to content
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

[Unified Checkpoint] Fix tie_weights save and load #8137

Merged
merged 7 commits into from
Mar 19, 2024

Conversation

DesmonDay
Copy link
Contributor

PR types

Bug fixes

PR changes

Others

Description

Fix tie_weights save and load.

Copy link

paddle-bot bot commented Mar 18, 2024

Thanks for your contribution!

Copy link

codecov bot commented Mar 18, 2024

Codecov Report

Attention: Patch coverage is 7.69231% with 12 lines in your changes are missing coverage. Please review.

Project coverage is 55.37%. Comparing base (d83bd5e) to head (9d87445).
Report is 5 commits behind head on develop.

❗ Current head 9d87445 differs from pull request most recent head 57476c9. Consider uploading reports for the commit 57476c9 to get more accurate results

Files Patch % Lines
paddlenlp/trainer/plugins/unified_checkpoint.py 0.00% 11 Missing ⚠️
paddlenlp/trainer/trainer.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #8137      +/-   ##
===========================================
- Coverage    56.45%   55.37%   -1.08%     
===========================================
  Files          596      596              
  Lines        91602    91622      +20     
===========================================
- Hits         51711    50739     -972     
- Misses       39891    40883     +992     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

JunnYu
JunnYu previously approved these changes Mar 18, 2024
Copy link
Member

@JunnYu JunnYu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment on lines 229 to 231
if hasattr(model, "_tied_weights_keys") and model._tied_weights_keys is not None:
for key in model._tied_weights_keys:
expected_keys.remove(key)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if hasattr(model, "_tied_weights_keys") and model._tied_weights_keys is not None:
for key in model._tied_weights_keys:
expected_keys.remove(key)
if model._keys_to_ignore_on_save is not None:
for key in model._keys_to_ignore_on_save:
expected_keys.remove(key)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_keys_to_ignore_on_save = None
_tied_weights_keys = None

我们的模型,应该有这个属性

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

用 _keys_to_ignore_on_save 可能更好一点。

JunnYu
JunnYu previously approved these changes Mar 19, 2024
Copy link
Member

@JunnYu JunnYu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

ZHUI
ZHUI previously approved these changes Mar 19, 2024
Copy link
Collaborator

@ZHUI ZHUI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@DesmonDay DesmonDay dismissed stale reviews from ZHUI and JunnYu via 9d87445 March 19, 2024 08:14
@wawltor wawltor merged commit b6dcb4e into PaddlePaddle:develop Mar 19, 2024
5 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants