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

[ModelOutput] Proposal to fix compatibility issue with torch.DataParallel #5740

Closed
wants to merge 1 commit into from

Conversation

thomwolf
Copy link
Member

@thomwolf thomwolf commented Jul 14, 2020

This is a proposal to fix #5693 by making ModelOutput inherit from a dictionary and behave like a dictionary on iteration (i.e. iterate over the keys rather than the values).

This could break backward compatibility when users iterates over the output tuple rather than indexing it.

On the other hand, we regain backward compatibility with torch.DataParallel and from a more general design point of view the ModelOutput class should probably be closer to a dictionary than a tuple in the future.

@thomwolf
Copy link
Member Author

Update: this is actually not working because it breaks the possibility to unpack the output of the model's forward pass which is obviously a common pattern (cf failure in the tests) :-/

@sgugger
Copy link
Collaborator

sgugger commented Jul 29, 2020

This is superseded by #6138 now.

@sgugger sgugger closed this Jul 29, 2020
@LysandreJik LysandreJik deleted the fix-model-output branch April 27, 2022 15:52
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.

__init__() missing 1 required positional argument: 'logits'
2 participants