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

Make AutoFormer work with previous torch version #24357

Merged
merged 1 commit into from
Jun 19, 2023

Conversation

ydshieh
Copy link
Collaborator

@ydshieh ydshieh commented Jun 19, 2023

What does this PR do?

Without import torch.utils.checkpoint (which we have in other files, like Bart), with torch 1.13, we got an error

(running RUN_SLOW=1 python3 -m pytest -v tests/models/autoformer/test_modeling_autoformer.py::AutoformerModelTest::test_training_gradient_checkpointing)

>                   layer_outputs = torch.utils.checkpoint.checkpoint(
                        create_custom_forward(encoder_layer),
                        hidden_states,
                        attention_mask,
                        (head_mask[idx] if head_mask is not None else None),
                    )
E                   AttributeError: module 'torch.utils' has no attribute 'checkpoint'

Let's make it work with previous torch version(s) ❤️ .

@ydshieh ydshieh requested a review from amyeroberts June 19, 2023 13:39
@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Jun 19, 2023

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

Copy link
Collaborator

@amyeroberts amyeroberts 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 a4de24f into main Jun 19, 2023
@ydshieh ydshieh deleted the fix_autoformer_in_past_ci branch June 19, 2023 14:02
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.

3 participants