You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SentencePieceTokenizer: Unigram ties in multi-word text differ from Hugging Face #7959
SentencePieceTokenizer.CreateFromTokenizerJson (Unigram) can still pick a different split than Hugging Face tokenizers when several splits have the same total score and the text has more than one word. #7956 fixes the single-word case from #7909 by scoring in double precision like Hugging Face, but not this one.
Hugging Face scores each pre-tokenized word on its own, starting from zero. SentencePieceUnigramModel scores the whole normalized string in one pass, so the running total from earlier words changes how ties in later words round.
Repro with the Paraphrase-multilingual-MiniLM-L12-v2tokenizer.json from the test data, with #7956 applied:
test9999999 on its own already gives the Hugging Face result.
Scoring each pre-tokenized word separately, like Hugging Face, matched it on every input I checked. Create with a .model stream should keep scoring the whole string, since that's what SentencePiece does.
Activity