mirror of
https://github.com/ollama/ollama.git
synced 2025-07-09 18:20:13 +02:00
use benchmark loop
This commit is contained in:
@ -83,8 +83,7 @@ func BenchmarkColdStart(b *testing.B) {
|
|||||||
// Set number of tokens as our throughput metric
|
// Set number of tokens as our throughput metric
|
||||||
b.SetBytes(int64(tt.maxTokens))
|
b.SetBytes(int64(tt.maxTokens))
|
||||||
|
|
||||||
b.ResetTimer()
|
for b.Loop() {
|
||||||
for range b.N {
|
|
||||||
b.StopTimer()
|
b.StopTimer()
|
||||||
// Ensure model is unloaded before each iteration
|
// Ensure model is unloaded before each iteration
|
||||||
unload(client, m, b)
|
unload(client, m, b)
|
||||||
@ -122,12 +121,11 @@ func BenchmarkWarmStart(b *testing.B) {
|
|||||||
// Set number of tokens as our throughput metric
|
// Set number of tokens as our throughput metric
|
||||||
b.SetBytes(int64(tt.maxTokens))
|
b.SetBytes(int64(tt.maxTokens))
|
||||||
|
|
||||||
b.ResetTimer()
|
for b.Loop() {
|
||||||
for range b.N {
|
|
||||||
req := &api.GenerateRequest{
|
req := &api.GenerateRequest{
|
||||||
Model: m,
|
Model: m,
|
||||||
Prompt: tt.prompt,
|
Prompt: tt.prompt,
|
||||||
Options: map[string]interface{}{"num_predict": tt.maxTokens, "temperature": 0.1},
|
Options: map[string]any{"num_predict": tt.maxTokens, "temperature": 0.1},
|
||||||
}
|
}
|
||||||
|
|
||||||
runGenerateBenchmark(b, ctx, client, req)
|
runGenerateBenchmark(b, ctx, client, req)
|
||||||
|
Reference in New Issue
Block a user