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

Add read_custom_data to DocumentDataset #574

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

praateekmahajan
Copy link
Collaborator

Description

We need an ability to read arbitrary datasets using a user defined function.
The UDF should accept
- files: A list of file paths.
- file_type: The type of the file to read (in case you want to handle different file types differently).
- backend: pd / cudf
- add_filename: True / False / str in which case they can use from nemo_curator.utils.distributed_utils import _resolve_filename_col
- columns: Can use this to define set of cols to return (output is always sorted columns)
- input_meta: Can use this for typecasting if eneded

Usage

# Add snippet demonstrating usage

Checklist

  • I am familiar with the Contributing Guide.
  • New or Existing tests cover these changes.
  • The documentation is up to date with these changes.

Signed-off-by: Praateek <[email protected]>
@praateekmahajan praateekmahajan added the gpuci Run GPU CI/CD on PR label Feb 25, 2025
Copy link
Collaborator

@ryantwolf ryantwolf left a comment

Choose a reason for hiding this comment

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

Good with me.

Copy link
Collaborator

@sarahyurick sarahyurick left a comment

Choose a reason for hiding this comment

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

LGTM, added minor comments for your consideration.

@@ -155,6 +155,73 @@ def read_pickle(
)
)

@classmethod
def read_custom_data(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
def read_custom_data(
def read_custom(

to more closely match read_json, read_parquet, read_pickle?

expected_df[["embedding", "id"]], # because we sort columns by name,
)

# Test multiple files per partition
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this comment be for the test above?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gpuci Run GPU CI/CD on PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants