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

Override num_workers from 0 to 1 in get_pytorch_dataloader #330

Merged

Conversation

vbourgin
Copy link
Contributor

Summary: To support a similar interface to the pytorch dataloader, we set num_workers to 1 if the input num_workers is 0 in get_pytorch_dataloader

Differential Revision: D68357865

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jan 17, 2025
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D68357865

raise ValueError(f"`num_workers` must be greater than 0. Found: {num_workers}")
elif num_workers == 0:
_LG.warning(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you use warnings.warn with stack_level=2?

Copy link
Collaborator

Choose a reason for hiding this comment

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

This is a good explanation of which one to use.

https://stackoverflow.com/a/14762106

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the resource! I just updated the code to reflect this

vbourgin pushed a commit to vbourgin/spdl that referenced this pull request Jan 22, 2025
…ookresearch#330)

Summary:

To support a similar interface to the pytorch dataloader, we set `num_workers` to 1 if the input `num_workers` is 0 in `get_pytorch_dataloader`

Differential Revision: D68357865
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D68357865

vbourgin pushed a commit to vbourgin/spdl that referenced this pull request Jan 22, 2025
…ookresearch#330)

Summary:

To support a similar interface to the pytorch dataloader, we set `num_workers` to 1 if the input `num_workers` is 0 in `get_pytorch_dataloader`

Differential Revision: D68357865
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D68357865

@mthrok
Copy link
Collaborator

mthrok commented Jan 22, 2025

Looks good. Thanks.

vbourgin pushed a commit to vbourgin/spdl that referenced this pull request Jan 22, 2025
…ookresearch#330)

Summary:

To support a similar interface to the pytorch dataloader, we set `num_workers` to 1 if the input `num_workers` is 0 in `get_pytorch_dataloader`

Reviewed By: moto-meta

Differential Revision: D68357865
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D68357865

…ookresearch#330)

Summary:

To support a similar interface to the pytorch dataloader, we set `num_workers` to 1 if the input `num_workers` is 0 in `get_pytorch_dataloader`

Reviewed By: moto-meta

Differential Revision: D68357865
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D68357865

@facebook-github-bot facebook-github-bot merged commit ca1389a into facebookresearch:main Jan 23, 2025
17 of 32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Meta Open Source bot. fb-exported
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants