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

Inconsistent output in documentation example: num_classes not displayed in ClassLabel output #7129

Open
sergiopaniego opened this issue Aug 28, 2024 · 0 comments · May be fixed by #7293
Open

Comments

@sergiopaniego
Copy link

In the documentation for ClassLabel, there is an example of usage with the following code:

from datasets import Features
features = Features({'label': ClassLabel(num_classes=3, names=['bad', 'ok', 'good'])})
features

which expects to output (as stated in the documentation):

{'label': ClassLabel(num_classes=3, names=['bad', 'ok', 'good'], id=None)}

but it generates the following

{'label': ClassLabel(names=['bad', 'ok', 'good'], id=None)}

If my understanding is correct, this happens because although num_classes is used during the init of the object, it is afterward ignored:

num_classes: InitVar[Optional[int]] = None # Pseudo-field: ignored by asdict/fields when converting to/from dict

I would like to work on this issue if this is something needed 😄

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 a pull request may close this issue.

1 participant