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

Fix _load_pretrained_model #24200

Merged
merged 1 commit into from
Jun 12, 2023
Merged

Conversation

SunMarc
Copy link
Member

@SunMarc SunMarc commented Jun 12, 2023

What does this PR do ?

Fixes the following test from my old PR Add check for tied parameters (#24029):
RUN_SLOW=1 python3 -m pytest -v tests/models/marian/test_modeling_marian.py::TestMarian_FI_EN_V2::test_batch_generation_en_fr

@SunMarc SunMarc requested review from sgugger and ydshieh June 12, 2023 14:38
Copy link
Collaborator

@sgugger sgugger left a comment

Choose a reason for hiding this comment

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

Could you explain a bit more why we need to remove this line? Thanks!

@SunMarc
Copy link
Member Author

SunMarc commented Jun 12, 2023

This line what something I added in my previous PR thinking that we forgot to tie the weights. But I guess it was done intentionally as I see that one test failed and generated garbage value. Here the error that we get from the test:

tests/models/marian/test_modeling_marian.py:433: in _assert_generated_batch_equal_expected
    self.assertListEqual(self.expected_text, generated_words)
E   AssertionError: Lists differ: ['I like to read books', 'I like watching football'] != ['obliterat obliterat obliterat obliterat o[1345 chars]ɰɰɰ']
E   
E   First differing element 0:
E   'I like to read books'
E   'obliterat obliterat obliterat obliterat o[1214 chars]erat'
E   
E   Diff is 1556 characters long. Set self.maxDiff to None to see it.

Could you explain a bit more why we need to remove this line? Thanks!

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Jun 12, 2023

The documentation is not available anymore as the PR was closed or merged.

Copy link
Collaborator

@ydshieh ydshieh left a comment

Choose a reason for hiding this comment

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

The whole marian test suite now pass. Since you mentioned that line is added in the previous PR, the change here LGTM. Leave @sgugger to have a final judge though.

Thank you for the quick fix.

Copy link
Collaborator

@sgugger sgugger left a comment

Choose a reason for hiding this comment

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

Seems very weird that this changes anything one way or the other but let.s go.

@ydshieh
Copy link
Collaborator

ydshieh commented Jun 12, 2023

BTW, let's make the PR title a bit more precise, sth like fix _load_pretrained_model or anything you think more precise, @SunMarc .
Thanks!

@ydshieh ydshieh changed the title Fix test Fix _load_pretrained_model Jun 12, 2023
@SunMarc
Copy link
Member Author

SunMarc commented Jun 12, 2023

Yeah, I will explore a little bit more why we have this weird behavior before merging.

@SunMarc SunMarc merged commit 08ae37c into huggingface:main Jun 12, 2023
4 checks passed
@SunMarc SunMarc deleted the fix_test_marian branch June 12, 2023 15:31
@ydshieh ydshieh mentioned this pull request Jun 20, 2023
novice03 pushed a commit to novice03/transformers that referenced this pull request Jun 23, 2023
@patrickvonplaten patrickvonplaten mentioned this pull request Aug 2, 2023
5 tasks
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