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 tests without any real effect in EncoderDecoderMixin #13406

Conversation

ydshieh
Copy link
Collaborator

@ydshieh ydshieh commented Sep 3, 2021

What does this PR do?

In test_modeling_encoder_decoder.py, there are 2 places like

enc_dec_model.save_pretrained(tmpdirname)
EncoderDecoderModel.from_pretrained(tmpdirname)

after_outputs = enc_dec_model(...)

Therefore after_outputs will be exactly the same outputs, since enc_dec_model doesn't get the new value.
For the testing purpose, we need to do

enc_dec_model = EncoderDecoderModel.from_pretrained(tmpdirname)

(Hope I get it right)

Who can review?

@patrickvonplaten @sgugger

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.

LGTM, but let's wait for @patrickvonplaten review as he is the expert on encoder decoders.

@patrickvonplaten
Copy link
Contributor

Thanks a lot @ydshieh !

@patrickvonplaten patrickvonplaten merged commit 73ad258 into huggingface:master Sep 6, 2021
@LysandreJik
Copy link
Member

The model should have been cast to the torch_device as otherwise the inputs/model are on different devices :)

https://github.com/huggingface/transformers/runs/3524847938?check_suite_focus=true

@patrickvonplaten
Copy link
Contributor

I'll take care of it :-)

@ydshieh
Copy link
Collaborator Author

ydshieh commented Sep 6, 2021

Hey, thank you guys! Sorry about the device issue, I am less familiar with PyTorch, and it seems the checks I had when I opened this PR don't have that test above (probably it only runs when we merge to master?)

@patrickvonplaten
Copy link
Contributor

Don't worry about it @ydshieh :-)

@ydshieh ydshieh deleted the fix_minor_bugs_in_enc_dec_model_test branch September 17, 2021 16:20
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.

None yet

4 participants