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: support blob api in pytorch loader #3217

Merged
merged 2 commits into from
Dec 8, 2024
Merged

feat: support blob api in pytorch loader #3217

merged 2 commits into from
Dec 8, 2024

Conversation

eddyxu
Copy link
Contributor

@eddyxu eddyxu commented Dec 7, 2024

Support handling Blob data in PyTorch loader

@eddyxu eddyxu requested a review from chebbyChefNEQ December 7, 2024 14:33
@github-actions github-actions bot added enhancement New feature or request python labels Dec 7, 2024
@eddyxu eddyxu force-pushed the lei/pytorch_blob_api branch from d6188fa to 8e4082a Compare December 7, 2024 23:49
@@ -234,6 +243,10 @@ def __init__(
self._to_tensor_fn = to_tensor_fn
self._hf_converter = None

self._blob_columns = self._blob_columns()
if self._blob_columns:
self.with_row_id = True
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this needed?

Copy link
Contributor Author

@eddyxu eddyxu Dec 8, 2024

Choose a reason for hiding this comment

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

we need row id to call dataset.take_blobs()

arr: pa.Array = batch[col]

if isinstance(arr, list) and arr and isinstance(arr[0], lance.BlobFile):
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a way to check earlier? Like when constructing the loader?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes we probably can. One way to do it is passing more parameters, but it makes user-specified to_tensor_fn more complicated.

@eddyxu eddyxu merged commit f1c6c3e into main Dec 8, 2024
15 checks passed
@eddyxu eddyxu deleted the lei/pytorch_blob_api branch December 8, 2024 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request python
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants