fix: resolve false-positive regex warning for non-mistral models#44736
Closed
yunhaoli24 wants to merge 1 commit intohuggingface:mainfrom
Closed
fix: resolve false-positive regex warning for non-mistral models#44736yunhaoli24 wants to merge 1 commit intohuggingface:mainfrom
yunhaoli24 wants to merge 1 commit intohuggingface:mainfrom
Conversation
The condition for calling _patch_mistral_regex was too broad (vocab_size > 100000), causing non-mistral models like Qwen to show incorrect regex pattern warnings. This change tightens the condition to only apply to actual mistral models. Fixes #44031
Member
|
Tell your code agent to check if the error still exists on |
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.
What does this PR do?
Fixes #44031
The Problem
The condition for calling
_patch_mistral_regexwas too broad (vocab_size > 100000), causing non-Mistral models like Qwen, LLaMA, BGE-Reranker to show incorrect regex pattern warnings even though they don't need the regex fix.Example from issue #44031:
This is misleading because Qwen doesn't have the Mistral regex issue.
The Solution
Add a path-based filter before calling
_patch_mistral_regex. Only call the function when:vocab_size > 100000(indicates potential need for fix)This ensures:
Code Change
Testing
The fix ensures:
Alternatives Considered
Check model_type in config.json: Similar to closed PR Fix incorrect fix_mistral_regex warning for local non-Mistral tokenizers #42605
Maintain a list of Mistral variants:
Chosen: Path-based filter (current approach)
Related Issues