Skip to content

Commit

Permalink
Merge pull request #8 from GOOD21/main
Browse files Browse the repository at this point in the history
Update tokenizer.go
  • Loading branch information
bluescreen10 authored Nov 7, 2024
2 parents 53141e4 + ad6a208 commit 60becaa
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tokenizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ package tokenizer
//}

import (
"strings"
"errors"

"github.com/tiktoken-go/tokenizer/codec"
Expand Down Expand Up @@ -200,7 +201,7 @@ func ForModel(model Model) (Codec, error) {
return Get(GPT2Enc)
default:
for prefix, enc := range modelPrefixToEncoding {
if string(model)[:len(prefix)] == string(prefix) {
if strings.HasPrefix(string(model), string(prefix)) {
return Get(enc)
}
}
Expand Down

0 comments on commit 60becaa

Please sign in to comment.