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

[Data] Allow generator UDFs for map_batches and flat_map #32767

Merged
merged 8 commits into from
Feb 28, 2023

Conversation

amogkam
Copy link
Contributor

@amogkam amogkam commented Feb 23, 2023

UDFs may return very large objects (for example when converting videos stored as bytes into multiple tensors for each window frame). This can lead to large amounts of heap memory usage and possibly cause OOMs.

By allowing generator UDFs, users can instead yield chunks of the large object at a time.

Closes #32746

Why are these changes needed?

Related issue number

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

Signed-off-by: amogkam <amogkamsetty@yahoo.com>
Signed-off-by: amogkam <amogkamsetty@yahoo.com>
Signed-off-by: amogkam <amogkamsetty@yahoo.com>
@amogkam amogkam changed the title [WIP] [Data] Allow generator UDFs for map_batches [Data] Allow generator UDFs for map_batches and map Feb 26, 2023
@amogkam amogkam marked this pull request as ready for review February 26, 2023 01:07
Copy link
Contributor

@richardliaw richardliaw left a comment

Choose a reason for hiding this comment

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

one minor comment for docs

===================
Types of UDFs
=============
.. tabbed:: "Function UDFs"
Copy link
Contributor

Choose a reason for hiding this comment

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

before the tab, can you mention a summary statement - ie "There are three types of UDFs that you can use with Ray Data: Function ..."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

@ericl ericl added the @author-action-required The PR author is responsible for the next step. Remove tag to send back to the reviewer. label Feb 27, 2023
Signed-off-by: amogkam <amogkamsetty@yahoo.com>
Copy link
Contributor

@c21 c21 left a comment

Choose a reason for hiding this comment

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

LGTM w/ minor comments. Also cc @clarkzinzow for related zero-copy batching work. thanks.

python/ray/data/_internal/planner/map_batches.py Outdated Show resolved Hide resolved
python/ray/data/tests/test_dataset.py Outdated Show resolved Hide resolved
Signed-off-by: amogkam <amogkamsetty@yahoo.com>
Signed-off-by: amogkam <amogkamsetty@yahoo.com>
Signed-off-by: amogkam <amogkamsetty@yahoo.com>
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.

LGTM! @c21 I'll be sure to port this to the zero-copy fusion adapters PR.

Signed-off-by: amogkam <amogkamsetty@yahoo.com>
@amogkam amogkam changed the title [Data] Allow generator UDFs for map_batches and map [Data] Allow generator UDFs for map_batches and flat_map Feb 28, 2023
@amogkam amogkam merged commit c7cea68 into ray-project:master Feb 28, 2023
@amogkam amogkam deleted the sewer-patch branch February 28, 2023 00:58
ProjectsByJackHe pushed a commit to ProjectsByJackHe/ray that referenced this pull request Mar 21, 2023
…ject#32767)

UDFs may return very large objects (for example when converting videos stored as bytes into multiple tensors for each window frame). This can lead to large amounts of heap memory usage and possibly cause OOMs.

By allowing generator UDFs, users can instead yield chunks of the large object at a time.

Closes ray-project#32746

---------

Signed-off-by: amogkam <amogkamsetty@yahoo.com>
Signed-off-by: Jack He <jackhe2345@gmail.com>
edoakes pushed a commit to edoakes/ray that referenced this pull request Mar 22, 2023
…ject#32767)

UDFs may return very large objects (for example when converting videos stored as bytes into multiple tensors for each window frame). This can lead to large amounts of heap memory usage and possibly cause OOMs.

By allowing generator UDFs, users can instead yield chunks of the large object at a time.

Closes ray-project#32746

---------

Signed-off-by: amogkam <amogkamsetty@yahoo.com>
Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
peytondmurray pushed a commit to peytondmurray/ray that referenced this pull request Mar 22, 2023
…ject#32767)

UDFs may return very large objects (for example when converting videos stored as bytes into multiple tensors for each window frame). This can lead to large amounts of heap memory usage and possibly cause OOMs.

By allowing generator UDFs, users can instead yield chunks of the large object at a time.

Closes ray-project#32746

---------

Signed-off-by: amogkam <amogkamsetty@yahoo.com>
elliottower pushed a commit to elliottower/ray that referenced this pull request Apr 22, 2023
…ject#32767)

UDFs may return very large objects (for example when converting videos stored as bytes into multiple tensors for each window frame). This can lead to large amounts of heap memory usage and possibly cause OOMs.

By allowing generator UDFs, users can instead yield chunks of the large object at a time.

Closes ray-project#32746

---------

Signed-off-by: amogkam <amogkamsetty@yahoo.com>
Signed-off-by: elliottower <elliot@elliottower.com>
ProjectsByJackHe pushed a commit to ProjectsByJackHe/ray that referenced this pull request May 4, 2023
…ject#32767)

UDFs may return very large objects (for example when converting videos stored as bytes into multiple tensors for each window frame). This can lead to large amounts of heap memory usage and possibly cause OOMs.

By allowing generator UDFs, users can instead yield chunks of the large object at a time.

Closes ray-project#32746

---------

Signed-off-by: amogkam <amogkamsetty@yahoo.com>
Signed-off-by: Jack He <jackhe2345@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@author-action-required The PR author is responsible for the next step. Remove tag to send back to the reviewer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[data] Block splitting doesn't work for single large tensor outputs of map_batches()
5 participants