Repository navigation
fix(model): warn when checkpoint and model arguments differ #3846
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
Open
varunikarai
wants to merge
11
commits into
open-edge-platform:main
Choose a base branch
from
varunikarai:fix/model/warn-on-checkpoint-hparam-mismatch
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+210
β3
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
a19599e
fix(model): warn when a checkpoint is loaded into a model built with β¦
varunikarai d570bda
docs(changelog): add entry for #3846
varunikarai 4fd5982
refactor(model): skip pre_trained inline instead of through a class cβ¦
varunikarai 8a18541
refactor(model): reuse paths_to_strings when comparing checkpoint argβ¦
varunikarai 637e9d2
fix(model): only catch the errors that tensor and array comparisons rβ¦
varunikarai d933105
test(model): cover checkpoint arguments that cannot be compared
varunikarai 760dc8e
docs(model): drop the long explanation from the mismatch warning's doβ¦
varunikarai b11d2e6
fix(model): log only the names of mismatched checkpoint arguments
varunikarai 596acae
test(model): check that mismatch warnings do not log argument values
varunikarai 035cef7
Merge upstream main and resolve CHANGELOG conflict
varunikarai 7ff2acc
Merge upstream main and move changelog entry to Unreleased
varunikarai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When do you expect a Runtime, Type, or a Value error, and is returning True safe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed TypeError (637e9d2) and now only catch the two errors that tensor and array comparisons actually raise: RuntimeError when a hyperparameter is a multi-element tensor (== is elementwise and bool() on the result raises), and ValueError for the same case with numpy arrays. Returning True only means no warning is logged for that argument. Checkpoint loading behaves exactly the same, so the worst case is a missed warning, not a wrong model. This is covered by test_values_without_a_single_truth_value_are_treated_as_matching (d933105). Happy to switch to torch.equal / np.array_equal for those types if you'd prefer they get compared too.