Skip to content

Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.

refactor: using testing.B.Loop

yajianggroupdf411c4b0282
diff --git a/model/bytepairencoding_test.go b/model/bytepairencoding_test.go
index 39e5ab452..15cb56ca9 100644
--- a/model/bytepairencoding_test.go
+++ b/model/bytepairencoding_test.go
@@ -251,7 +251,7 @@ func BenchmarkBytePairEncoding(b *testing.B) {
bts := bts[:n]
b.Run("encode"+strconv.Itoa(n), func(b *testing.B) {
b.ResetTimer()
- for range b.N {
+ for b.Loop() {
_, err := tokenizer.Encode(string(bts), true)
if err != nil {
b.Fatal(err)
@@ -266,7 +266,7 @@ func BenchmarkBytePairEncoding(b *testing.B) {
}
b.ResetTimer()
- for range b.N {
+ for b.Loop() {
_, err := tokenizer.Decode(ids)
if err != nil {
b.Fatal(err)
@@ -276,7 +276,7 @@ func BenchmarkBytePairEncoding(b *testing.B) {
b.Run("split"+strconv.Itoa(n), func(b *testing.B) {
b.ResetTimer()
- for range b.N {
+ for b.Loop() {
slices.Collect(tokenizer.split(string(bts)))
}
})