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

When given, use the sequence len for array_shape #3144

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ccl-core
Copy link
Contributor

@ccl-core ccl-core commented Mar 3, 2025

I see that some datasets have the Sequence length defined, e.g.: https://datasets-server.huggingface.co/info?dataset=pollen-robotics/apple_storage

We should probably use this info.

else:
if shape := feature.length:
Copy link
Contributor

@marcenacp marcenacp Mar 3, 2025

Choose a reason for hiding this comment

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

nit: For readability, collect int | None instead of str, and clean afterwards when building the actual arrayShape.

array_shape: list[int | None] = []
...
array_shape.append(-1)
...
array_shape.append(feature.length)
...
array_shape.append(sub_feature.length)
...

str_array_shape = [str(shape) if shape else '-1' for shape in array_shape]
field["arrayShape"] = ",".join(str_array_shape)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, done.

@ccl-core ccl-core marked this pull request as ready for review March 3, 2025 20:17
@ccl-core
Copy link
Contributor Author

ccl-core commented Mar 3, 2025

@lhoestq could you PTAL? Thanks :)

@ccl-core
Copy link
Contributor Author

ccl-core commented Mar 5, 2025

@lhoestq gentle ping :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants