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

[FEAT] Add DataFrame.to_torch_map_dataset and .to_torch_iter_dataset. #1086

Merged
merged 3 commits into from
Jun 23, 2023

Conversation

xcharleslin
Copy link
Contributor

@xcharleslin xcharleslin commented Jun 23, 2023

Adds two new top-level APIs to DataFrame: to_torch_map_dataset and to_torch_iter_dataset, that returns respective PyTorch datasets (TODO: make these DataPipes).

  • to_torch_map_dataset will execute the whole dataframe before returning, since it needs random access.
  • to_torch_iter_dataset will return immediately; results are returned via streaming execution.

Both are only meant for use in a single-node setting, with Ray Datasets being the recommended data loading abstraction for distributed training.

@github-actions github-actions bot added the enhancement New feature or request label Jun 23, 2023
@codecov
Copy link

codecov bot commented Jun 23, 2023

Codecov Report

Merging #1086 (2aeb22e) into main (cd59693) will decrease coverage by 0.55%.
The diff coverage is 10.52%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1086      +/-   ##
==========================================
- Coverage   88.87%   88.33%   -0.55%     
==========================================
  Files          53       54       +1     
  Lines        5439     5477      +38     
==========================================
+ Hits         4834     4838       +4     
- Misses        605      639      +34     
Impacted Files Coverage Δ
daft/dataframe/to_torch.py 0.00% <0.00%> (ø)
daft/dataframe/dataframe.py 88.84% <40.00%> (-1.02%) ⬇️

Copy link
Contributor

@clarkzinzow clarkzinzow left a comment

Choose a reason for hiding this comment

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

@xcharleslin Meta comment: we might want to subclass the new canonical Torch data abstractions, IterDataPipe and MapDataPipe.

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Jun 23, 2023
@xcharleslin
Copy link
Contributor Author

@clarkzinzow Hahaha, was just gonna ask for your input on this one :) I'll do that, thanks!

Do the API naming and docs look good to you as well?

@xcharleslin xcharleslin changed the title [FEAT] Add DataFrame.to_torch_dataset and to_torch_iter_dataset. [FEAT] Add DataFrame.to_torch_map_dataset and .to_torch_iter_dataset. Jun 23, 2023
@xcharleslin xcharleslin marked this pull request as ready for review June 23, 2023 20:44
@xcharleslin xcharleslin enabled auto-merge (squash) June 23, 2023 20:44
@xcharleslin xcharleslin merged commit e101ed6 into main Jun 23, 2023
@xcharleslin xcharleslin deleted the charles/torch-dataset branch June 23, 2023 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants