Skip to content

fix gradient checkpoint tests in encoder-decoder#20017

Merged
ydshieh merged 1 commit intomainfrom
fix_enc_dec_grad_ckpt
Nov 2, 2022
Merged

fix gradient checkpoint tests in encoder-decoder#20017
ydshieh merged 1 commit intomainfrom
fix_enc_dec_grad_ckpt

Conversation

@ydshieh
Copy link
Collaborator

@ydshieh ydshieh commented Nov 2, 2022

What does this PR do?

Fix the test test_training_gradient_checkpointing in test_modeling_encoder_decoder.py.

The current error is

RuntimeError: Expected all tensors to be on the same device, but found at least two device

@ydshieh ydshieh requested review from NielsRogge and sgugger November 2, 2022 11:05
model.train()
model.to(torch_device)
model.gradient_checkpointing_enable()
model.train()
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The order is not a big deal - I just make it the same as in common test file.

Copy link
Contributor

@NielsRogge NielsRogge left a comment

Choose a reason for hiding this comment

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

Thanks for fixing!

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Nov 2, 2022

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

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.

Thanks for fixing!

@ydshieh ydshieh merged commit c6c9db3 into main Nov 2, 2022
@ydshieh ydshieh deleted the fix_enc_dec_grad_ckpt branch November 2, 2022 13:15
mpierrau pushed a commit to mpierrau/transformers that referenced this pull request Dec 15, 2022
Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
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