[UMT5] Ignore tied encoder embedding missing-key warning - #44014
Closed
weiguangli-io wants to merge 1 commit into
Closed
[UMT5] Ignore tied encoder embedding missing-key warning#44014weiguangli-io wants to merge 1 commit into
weiguangli-io wants to merge 1 commit into
Conversation
Contributor
|
[For maintainers] Suggested jobs to run (before merge) run-slow: umt5 |
Member
|
I think this is a duplicate of #43880! |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fixes #43992 by preventing a false missing-key report for
UMT5EncoderModelwhenencoder.embed_tokens.weightis tied toshared.weight.UMT5EncoderModelalready declares tied weights, but loading checkpoints that only carry the shared embedding can still surface a misleading missing key warning forencoder.embed_tokens.weight. This change marks that key as ignorable-on-load for this encoder-only class, matching the tied-embedding semantics.Changes
src/transformers/models/umt5/modeling_umt5.py_keys_to_ignore_on_load_missing = [r"encoder.embed_tokens.weight"]toUMT5EncoderModel.tests/models/umt5/test_encoder_missing_keys.pyUMT5EncoderModelfrom a state dict missingencoder.embed_tokens.weightand asserts the key is not reported inmissing_keys.Validation
PYTHONPATH=src python3 -m ruff check src/transformers/models/umt5/modeling_umt5.py tests/models/umt5/test_encoder_missing_keys.pyPYTHONPATH=src /tmp/tfpycheck/bin/pytest -q tests/models/umt5/test_encoder_missing_keys.pyPYTHONPATH=src /tmp/tfpycheck/bin/coverage run -m pytest -q tests/models/umt5/test_encoder_missing_keys.pyPYTHONPATH=src /tmp/tfpycheck/bin/coverage report -m src/transformers/models/umt5/modeling_umt5.pyCoverage note: