Skip to content

fix: cap model_max_length sentinel value to prevent OverflowError in … - #206

Open
anaghasimha wants to merge 1 commit into
Tiiiger:masterfrom
anaghasimha:master
Open

fix: cap model_max_length sentinel value to prevent OverflowError in …#206
anaghasimha wants to merge 1 commit into
Tiiiger:masterfrom
anaghasimha:master

Conversation

@anaghasimha

Copy link
Copy Markdown

Problem

When using bert_score with models that don't explicitly define model_max_length
(e.g. DeBERTa, DistilBERT), HuggingFace assigns a sentinel value
(VERY_LARGE_INTEGER ~ 1e30) as the default. This gets passed to the Rust
tokenizers backend and causes an OverflowError since it exceeds int32 bounds.

Fix

Cap model_max_length to 512 in sent_encode() in utils.py before it
reaches the Rust backend.

Related

…Rust tokenizers backend

Models like DeBERTa and DistilBERT don't define model_max_length, causing
HuggingFace to assign VERY_LARGE_INTEGER (~1e30) as default. This overflows
int32 when passed to the Rust tokenizers backend via enable_truncation().

Fixes Tiiiger#205
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.

OverflowError when using fast tokenizers with models that don't define model_max_length

1 participant