Repository navigation
Fix scalar tags splitting into single-character list in card front matter - #5017
Merged
Merged
Conversation
…tter Fixes huggingface#5012 Signed-off-by: zeenat28-ui <zeenatriaz468@gmail.com>
Signed-off-by: zeenat28-ui <zeenatriaz468@gmail.com>
…ontent Signed-off-by: zeenat28-ui <zeenatriaz468@gmail.com>
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
Wauplin
approved these changes
Sep 28, 2026
Wauplin
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for reporting and fixing!
Contributor
|
This PR has been shipped as part of the v2.1.0 release. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #5012
Loading a
ModelCardorSpaceCardwith a scalar string in front matter (e.g.tags: text-classification) silently shredded the tag into individual characters (['t', 'e', 'x', ...]). Because Python strings are iterable,_to_unique_listiterated character-by-character instead of treating the value as a single tag.This normalizes
tagsto[tags]if a string is provided, matching how sibling fields likelanguageanddatasetshandle scalar inputs. Also updates the type annotations onModelCardDataandSpaceCardDatato reflectstr | list[str] | None.Added regression tests in
test_repocard_data.pyandtest_repocard.py.Who can review?
@@Wauplin
Note
Low Risk
Small, localized metadata normalization change with no auth, network, or persistence logic beyond correct tag parsing.
Overview
Fixes a bug where scalar
tagsin README front matter (e.g.tags: text-classification) were turned into one-character entries because_to_unique_listiterated the string directly._to_unique_listnow wraps astrin a one-element list before deduplication, consistent with how other card fields accept scalars.ModelCardDataandSpaceCardDataboth routetagsthrough this helper, so loading and constructing cards preserves the full tag string.Reviewed by Cursor Bugbot for commit 399a1c6. Bugbot is set up for automated code reviews on this repo. Configure here.