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

Allow unigram tokenizer to handle NSNumber score values #94

Merged

Conversation

ZachNagengast
Copy link
Collaborator

For whatever reason, certain config files for unigram tokenizers end up reading scores as NSNumber instead of float, and throw malformedVocab errors.

Expected a Float but found __NSCFNumber

This doesn't convert directly to Float, so I'm adding one fallback here to attempt to convert it to float before throwing.

@ZachNagengast ZachNagengast requested a review from pcuenca April 28, 2024 18:31
@pcuenca
Copy link
Member

pcuenca commented Apr 28, 2024

Interesting! Maybe because of precision issues?

Copy link
Member

@pcuenca pcuenca left a comment

Choose a reason for hiding this comment

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

Looks good to me, I'll run the tests locally.

@pcuenca pcuenca merged commit fc65432 into huggingface:main Apr 28, 2024
1 check failed
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