-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Removes empty partitions after dropping rows and splitting datasets #2328
Conversation
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making this change - looks good to me!
…i/ludwig into remove-empty-partitions
for more information, see https://pre-commit.ci
…set <=> Dask conversions
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
ludwig/data/dataframe/dask.py
Outdated
@@ -129,7 +149,24 @@ def to_ray_dataset(self, df): | |||
return from_dask(df) | |||
|
|||
def from_ray_dataset(self, dataset) -> dd.DataFrame: | |||
return dataset.to_dask() | |||
"""Custom Ray to Dask conversion implementation to pass in meta during dd.DataFrame creation.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@geoffreyangus should we revert back to dataset.to_dask()
if the empty partitions issue doesn't stem from a need to pass in meta?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, reverted!
LGTM! |
This PR addresses two separate issues: #2324 and #2308.
The issues are addressed by culling empty partitions from the Dask DataFrame at two points: (1) after dropping rows with NaNs (part of the DROP_ROWS missing value strategy) and (2) after splitting the dataset into train/val/test.
In order to maintain/increase performance, we add a persist call at the end of
build_dataset
, which makes it relatively inexpensive to compute the length of partitions repeatedly downstream.