Repository navigation
Support any LLMLingua-2-style token classifier (detect subword style from the tokenizer) - #261
Open
Dario A (riceharvest) wants to merge 1 commit into
Open
Dario A (riceharvest) wants to merge 1 commit into
Dario A (riceharvest) wants to merge 1 commit into
Conversation
…sifier works is_begin_of_new_word/get_pure_token matched model-name substrings and raised NotImplementedError for any other checkpoint. Detect WordPiece (##), SentencePiece (U+2581) or byte-level (U+0120) marking once from the tokenizer and use it when no name rule matches. Existing name-based behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Dario A (@riceharvest) please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
This branch has not been deployed
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.
is_begin_of_new_wordandget_pure_tokenpick their word-merging rule by matching substrings ofmodel_name(bert-base-multilingual-cased,tinybert,mobilebert,xlm-roberta-large,slingua).Any other checkpoint raises
NotImplementedError(see #168, #221), even when it follows theLLMLingua-2 format exactly (2-label token classifier, label 1 = keep).
This PR detects the subword style once from the tokenizer (
##WordPiece,▁SentencePiece,Ġbyte-level BPE) and uses it whenever no model-name rule matches.
microsoft/llmlingua-2-bert-base-multilingual-cased-meetingbankare byte-identical before and after(checked on 15 mixed prompts).
whitespace. Identifiers such as
ord_8f3a2c91or10.0.4.17:5432therefore stay one word instead ofbecoming
ord _ 8f3a2c91.lstrip("▁")blocks gated onxlm-roberta-largenow also apply to detected SentencePieceand byte-level styles.
Example of a new checkpoint that works with this change:
darioooooo0o/ctxprune-small(mmBERT-small,Apache-2.0, trained for agent tool outputs).
🤖 Generated with Claude Code