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

Factor out methods #10215

Merged
merged 1 commit into from Feb 17, 2021
Merged

Factor out methods #10215

merged 1 commit into from Feb 17, 2021

Conversation

LysandreJik
Copy link
Member

With PyTorch's DataParallel, it is not possible to simply iterate over parameters in order to find the nn.Module's dtype or device.

Some efforts were made to catch the error (StopIteration) in most cases, but the some were forgotten. This PR factors the try/except in a method, which is applied everywhere instead.

Closes #10214

@LysandreJik
Copy link
Member Author

@sgugger @patrickvonplaten verified this fixed the issue in #10214

Copy link
Contributor

@patrickvonplaten patrickvonplaten left a comment

Choose a reason for hiding this comment

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

Looks good!

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!

@LysandreJik LysandreJik merged commit 4b91965 into master Feb 17, 2021
@LysandreJik LysandreJik deleted the parameter-device-dtype branch February 17, 2021 14:53
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.

StopIteration Error when running beam search for squad 2.0
3 participants