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

Change state dict loading default to strict #2216

Merged
merged 5 commits into from
May 11, 2023
Merged

Conversation

dakinggg
Copy link
Contributor

@dakinggg dakinggg commented May 10, 2023

What does this PR do?

This PR changes the trainer default for load_strict_model_weights to True. We would previously (and will still) emit a warning if there are unexpected or missing keys in the checkpoint, just now we will default to erroring out. This matches torch's default (https://pytorch.org/docs/stable/generated/torch.nn.Module.html#torch.nn.Module.load_state_dict), and helps prevent silent failures to load the model correctly.

TODO:

  • update notebooks

What issue(s) does this change relate to?

Closes CO-2067

Before submitting

  • Have you read the contributor guidelines?
  • Was this change discussed/approved in a GitHub issue first? It is much more likely to be merged if so.
  • Did you update any related docs and document your change?
  • Did you update any related tests and add any new tests related to your change? (see testing)
  • Did you run the tests locally to make sure they pass?
  • Did you run pre-commit on your change? (see the pre-commit section of prerequisites)

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@dakinggg dakinggg marked this pull request as ready for review May 10, 2023 16:53
Copy link
Contributor

@eracah eracah left a comment

Choose a reason for hiding this comment

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

LGTM

@dakinggg dakinggg merged commit 4577174 into mosaicml:dev May 11, 2023
@dakinggg dakinggg deleted the strict branch June 1, 2023 00:11
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.

3 participants