-
Notifications
You must be signed in to change notification settings - Fork 27.5k
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
Tied weights load #24310
Tied weights load #24310
Conversation
The documentation is not available anymore as the PR was closed or merged. |
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.
Looks good to me!
@@ -3274,7 +3267,9 @@ def _find_mismatched_keys( | |||
missing_keys = [elem for elem in missing_keys if "SCB" not in elem] | |||
|
|||
if len(unexpected_keys) > 0: | |||
logger.warning( | |||
archs = [] if model.config.architectures is None else model.config.architectures | |||
warner = logger.warn if model.__class__.__name__ in archs else logger.info |
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.
Good!
@@ -3019,22 +3019,15 @@ def _fix_key(key): | |||
unexpected_keys = list(set(loaded_keys) - set(expected_keys)) | |||
|
|||
if is_accelerate_available(): | |||
model.tie_weights() |
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.
@sgugger This line causes a test of marian
failing due to garbage output values.
It was removed by @SunMarc in #24200 when I reported the same issue to him.
If this line is necessary, we might need some fix/change for marian or its test.
tests/models/marian/test_modeling_marian.py::TestMarian_FI_EN_V2::test_batch_generation_en_fr
(line 433) AssertionError: Lists differ: ['I like to read books', 'I like watching football'] != ['obliterat obliterat obliterat obliterat o[1345 chars]ɰɰɰ']
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.
This line is necessary. I'll look at the test later today.
What does this PR do?
This continue cleaning up a bit the model loading by:
_tied_weight_keys
class variable when deleting weights without warning for safetensors serialization