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

Added distributed loading of PyTorch DiskDataset #3704

Merged
merged 1 commit into from
Dec 19, 2023

Conversation

arunppsg
Copy link
Contributor

Description

Added support for loading disk dataset in multiple processes.

Type of change

Please check the option that is related to your PR.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
    • In this case, we recommend to discuss your modification on GitHub issues before creating the PR
  • Documentations (modification for documents)

Checklist

  • My code follows the style guidelines of this project
    • Run yapf -i <modified file> and check no errors (yapf version must be 0.32.0)
    • Run mypy -p deepchem and check no errors
    • Run flake8 <modified file> --count and check no errors
    • Run python -m doctest <modified file> and check no errors
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New unit tests pass locally with my changes
  • I have checked my code and corrected any misspellings

Copy link
Contributor

@vsaravind01 vsaravind01 left a comment

Choose a reason for hiding this comment

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

The changes look good to me.

def __iter__(self):
worker_info = torch.utils.data.get_worker_info()
n_shards = self.disk_dataset.get_number_shards()
if worker_info is None:
first_shard = 0
last_shard = n_shards
process_id = 0
Copy link
Member

Choose a reason for hiding this comment

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

@arunppsg Can we add a unit test for the changed functionality?

Copy link
Member

Choose a reason for hiding this comment

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

Documenting offline discussion, this is proving difficult to write. The existing unit tests pass. Will come back with additional tests in future PR

Copy link
Member

@rbharath rbharath left a comment

Choose a reason for hiding this comment

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

@arunppsg Is there any risk for breakage with these changes? What code uses TorchDiskDataset already?

@arunppsg
Copy link
Contributor Author

@arunppsg Is there any risk for breakage with these changes? What code uses TorchDiskDataset already?

DiskDataset.make_pytorch_dataset uses TorchDiskDataset method to make an iterable pytorch dataset. In these code snippets, we are only updating the process of distributing the shards across multiple workers in a single machine, so that each gpu gets a different copy of the dataset.

Copy link
Member

@rbharath rbharath left a comment

Choose a reason for hiding this comment

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

LGTM

@rbharath rbharath merged commit 8130f62 into deepchem:master Dec 19, 2023
24 of 33 checks passed
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.

None yet

3 participants