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

Improve data module error messages #1307

Closed
adamjstewart opened this issue May 4, 2023 · 0 comments · Fixed by #1441
Closed

Improve data module error messages #1307

adamjstewart opened this issue May 4, 2023 · 0 comments · Fixed by #1441
Assignees
Labels
datamodules PyTorch Lightning datamodules
Milestone

Comments

@adamjstewart
Copy link
Collaborator

Summary

We should improve our data module error messages by being more specific about what issues a data module may have.

Rationale

The current error message just says:

Foo.setup does not define a 'foo_dataset'

but the actual error could be any of:

  • Foo.setup does not define a foo_dataset or dataset
  • Foo.setup does not define a foo_sampler or sampler or foo_batch_sampler or batch_sampler
  • The dataset length is 0
  • The sampler length is 0

We should explain which of the above is actually happening.

Implementation

We added a new BaseDataModule class. We can add a method to that which will be inherited by subclasses. This method will be given a list of either datasets or sampler, then check to see if at least one of them is defined and has length > 0, and prints the appropriate error message if that is not the case.

Alternatives

No response

Additional information

No response

@adamjstewart adamjstewart added the datamodules PyTorch Lightning datamodules label May 4, 2023
@adamjstewart adamjstewart added this to the 0.5.0 milestone May 4, 2023
@adamjstewart adamjstewart self-assigned this May 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
datamodules PyTorch Lightning datamodules
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant