Skip to content

ClassLabel docs: Correct value for unknown labels - #7645

Merged
lhoestq merged 1 commit into
huggingface:mainfrom
l-uuz:docs-negative-integers-for-missing-labels
May 11, 2026
Merged

ClassLabel docs: Correct value for unknown labels#7645
lhoestq merged 1 commit into
huggingface:mainfrom
l-uuz:docs-negative-integers-for-missing-labels

Conversation

@l-uuz

@l-uuz l-uuz commented Jun 25, 2025

Copy link
Copy Markdown
Contributor

This small change fixes the documentation to to be compliant with what happens in encode_example.

# Allowing -1 to mean no label.
if not -1 <= example_data < self.num_classes:
raise ValueError(f"Class label {example_data:d} greater than configured num_classes {self.num_classes}")
return example_data

@l-uuz

l-uuz commented May 9, 2026

Copy link
Copy Markdown
Contributor Author

@lhoestq Can you take a look at this PR? It seems to me that docs is incorrect at that point.

@lhoestq lhoestq left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

yes thanks !

@lhoestq
lhoestq merged commit 6d300f8 into huggingface:main May 11, 2026
Elsword016 pushed a commit to Elsword016/datasets that referenced this pull request Aug 6, 2026
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.

2 participants