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

Fix decoding multi part extension #6904

Merged
merged 2 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/datasets/features/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -1250,6 +1250,8 @@ def encode_nested_example(schema, obj, level=0):
sub_schema = schema[0]
if obj is None:
return None
elif isinstance(obj, np.ndarray):
return encode_nested_example(schema, obj.tolist())
else:
if len(obj) > 0:
for first_elmt in obj:
Expand Down
4 changes: 2 additions & 2 deletions src/datasets/packaged_modules/webdataset/webdataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ def _get_pipeline_from_tar(cls, tar_path, tar_iterator):
current_example["__key__"] = example_key
current_example["__url__"] = tar_path
current_example[field_name.lower()] = f.read()
if field_name in cls.DECODERS:
current_example[field_name] = cls.DECODERS[field_name](current_example[field_name])
if field_name.split(".")[-1] in cls.DECODERS:
current_example[field_name] = cls.DECODERS[field_name.split(".")[-1]](current_example[field_name])
if current_example:
yield current_example

Expand Down
Loading