-
Notifications
You must be signed in to change notification settings - Fork 989
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Validate features during add_frame
+ Add 2D-to-5D + Add string
#720
Validate features during add_frame
+ Add 2D-to-5D + Add string
#720
Conversation
f2d59a9
to
e94c029
Compare
add_frame
+ Add 2d, 3d, 4d, 5d featuresadd_frame
+ Add 2D-to-5D + Add string
…_v2.1' into user/rcadene/2025_02_11_2d_features
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.
First round, let's iterate on the comments a bit ;)
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
7c2bbee
into
user/aliberts/2025_02_10_dataset_v2.1
if key in ["index", "episode_index", "task_index"] or ft["dtype"] in ["image", "video"]: | ||
continue | ||
elif len(ft["shape"]) == 1 and ft["shape"][0] == 1: | ||
episode_buffer[key] = np.array(episode_buffer[key], dtype=ft["dtype"]) | ||
elif len(ft["shape"]) == 1 and ft["shape"][0] > 1: | ||
episode_buffer[key] = np.stack(episode_buffer[key]) | ||
else: | ||
raise ValueError(key) | ||
episode_buffer[key] = np.stack(episode_buffer[key]) |
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.
What this does
Motivations: We want to support more modalities and data type that Hugging Face
datasets
already supports. See: https://github.com/huggingface/datasets/blob/339e9dc3914e4ed837f2c9b24972e211334025ec/src/datasets/features/features.py#L462-L646(1,)
,(n,)
,(n,m)
,(n,m,l)
,(n,m,l,o)
,(n,m,l,o,p)
add_frame
to validate ifframe
matchesself.features
specificationimage_array_to_pil_image
which is executed in the image writer threadsHow it was tested
add_frame
inpytest -sx tests/test_datasets.py
image_array_to_pil_image
withrange_check=True
.Average time taken for computing max and min over 100 runs: 0.000188 seconds