mirror of
https://github.com/ollama/ollama.git
synced 2025-04-02 09:00:28 +02:00
model: validate left and right pairs before merging them
This commit is contained in:
parent
63a394068c
commit
20e3593863
@ -169,6 +169,10 @@ func (spm SentencePieceModel) Encode(s string, addSpecial bool) ([]int32, error)
|
||||
continue
|
||||
}
|
||||
|
||||
if id := spm.vocab.Encode(string(left.runes) + string(right.runes)); id < 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
merges[pair.a].runes = append(left.runes, right.runes...)
|
||||
merges[pair.b].runes = nil
|
||||
merges[pair.a].n = right.n
|
||||
|
Loading…
x
Reference in New Issue
Block a user