Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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] Add performant way to read large tfrecord datasets #42277
[Data] Add performant way to read large tfrecord datasets #42277
Changes from all commits
af7b677
f25fa2e
14ed874
3b8bf91
b303cac
ddfca72
c3beb21
4ac5221
552c2e0
4a007c6
3c20737
bf061db
3d7bd33
b8519a1
b6982a3
7934adc
386be26
1d83dce
2c49d51
953af46
c373724
e19c1fc
fb6b290
7d7a08f
ca27c49
aac5ec6
7408c10
030556c
681f753
bca5bff
8cf1c2d
9aa260b
befc187
413c1f0
1e2c627
9894178
bf06a37
bf64415
663c39c
550392e
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
lint: add API annotation:
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.
can you add a comment on why this function is needed?
it seems that we'll read the datasource twice, one for
aggregate
, one formap_batches
. will that not be less efficient?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.
@raulchen it will indeed mean an extra pass on the data. The reason it is needed is because tfx-bsl ExampleDecoder returns always list of lists when no schema is provided, and what this function is doing is infering the schema for those fields that are single value fields.
Performance wise, some of our benchmarks on this implementation (we have had it for a while running internally), gives us more than 15X improvements compared to the current implementation. Some of our datasets take ~30m to load with the ray native implementation compared to less than 2m with this tfx-bsl implementation. Let me know if you need more benchmark numbers, happy to provide more
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 the explanation. it's okay to proceed without more benchmarks for now.
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.
@scottjlee this function now also cast the large_list to list preserving the underlying data format, and also cast large_binary to binary since to_tf does not have an implementation for large_binary.
One thing I just realized is that this conversion will only be applied when the schema inference is ran (which is when no tf_schema is provided), which means that there might be cases where the fast_read is used with a tf_schema and the to_tf could potentially fail if there's a large_list in the schema
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 catch, maybe in that case, it would be appropriate to catch the failure, and try applying the large_list -> list_ / large_binary -> binary casting.
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.
@scottjlee meaning that in this error scenario we will leave the user to cast the schema?
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.
I was thinking that Ray Data would automatically try the casting. Alternatively, we could add to the error message to indicate the user should modify the scheme themselves