Skip to content

Static batch schema #349

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

Merged
merged 20 commits into from
Mar 24, 2025
Merged

Conversation

laserkelvin
Copy link

This PR addresses an issue with the existing BatchSchema definition, which is done on-the-fly based on what information was actually packed into the individual data samples. The issue with this is that serialization is not possible, which prevents multiple data loader workers being used, which hinders training.

This is solved by creating a static definition of a BatchSchema that subclasses DataSampleSchema. The scope of testing is on a new HDF5 dataset with PyG graphs, and is functional for multi-GPU training.

Summary of changes:

  • Defined BatchSchema, subclassing DataSampleSchema
  • Added a to method for DataSampleSchema (which is inherited by BatchSchema) for data transfers to accelerators
  • Added transfer_batch_to_device methods to LightningModule definitions, which facilitates the data transfer before model calls
  • Unit tests for batching with the new BatchSchema

@laserkelvin laserkelvin added bug Something isn't working data Issues related to data loading, pipelining, etc. labels Mar 20, 2025
Copy link
Collaborator

@smiret-intel smiret-intel left a comment

Choose a reason for hiding this comment

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

Does this imply we need to change the underlying data format to HDF5? I assume this works for native PyTorch as well.

@laserkelvin laserkelvin merged commit 66b5280 into IntelLabs:main Mar 24, 2025
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working data Issues related to data loading, pipelining, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants