mirror of
https://github.com/dogkeeper886/ollama37.git
synced 2025-12-12 16:57:04 +00:00
model: validate left and right pairs before merging them
This commit is contained in:
@@ -169,6 +169,10 @@ func (spm SentencePieceModel) Encode(s string, addSpecial bool) ([]int32, error)
|
|||||||
continue
|
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.a].runes = append(left.runes, right.runes...)
|
||||||
merges[pair.b].runes = nil
|
merges[pair.b].runes = nil
|
||||||
merges[pair.a].n = right.n
|
merges[pair.a].n = right.n
|
||||||
|
|||||||
Reference in New Issue
Block a user