-
Notifications
You must be signed in to change notification settings - Fork 112
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Praateek <[email protected]>
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.
Good with me.
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.
LGTM, added minor comments for your consideration.
@@ -155,6 +155,73 @@ def read_pickle( | |||
) | |||
) | |||
|
|||
@classmethod | |||
def read_custom_data( |
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.
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 |
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.
Should this comment be for the test above?
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