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

Multi gpu, named tuple converts to tuple #6257

Closed
Vozf opened this issue Mar 1, 2021 · 2 comments
Closed

Multi gpu, named tuple converts to tuple #6257

Vozf opened this issue Mar 1, 2021 · 2 comments
Labels
3rd party Related to a 3rd-party bug Something isn't working help wanted Open to be worked on

Comments

@Vozf
Copy link
Contributor

Vozf commented Mar 1, 2021

🐛 Bug

When setting multiple gpu training, named tuples are converted to tuples and this breaks training resulting in error

    preds = self.model(batch.image)
AttributeError: 'tuple' object has no attribute 'image'

Where batch is a named tuple and works fine as namedtuple when training with single gpu

@Vozf Vozf added bug Something isn't working help wanted Open to be worked on labels Mar 1, 2021
@Vozf
Copy link
Contributor Author

Vozf commented Mar 1, 2021

This may be connected to #1588

@edenlightning
Copy link
Contributor

edenlightning commented Mar 1, 2021

Thanks for the report!
This should be resolved by PyTorch 1.8. This isn't an issue in Lightning.

A workaround in the meantime: use dictionaries instead, or extract the values from the tuple, and the first index will be the image.

@edenlightning edenlightning added the 3rd party Related to a 3rd-party label Mar 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3rd party Related to a 3rd-party bug Something isn't working help wanted Open to be worked on
Projects
None yet
Development

No branches or pull requests

2 participants