diff options
| author | Jonas Knobloch <jonas.knobloch@t-online.de> | 2026-03-24 12:55:17 +0100 |
|---|---|---|
| committer | Jonas Knobloch <jonas.knobloch@t-online.de> | 2026-03-24 12:55:17 +0100 |
| commit | fc9be8f81f673c0b04a0381a544b78e5a2a0d0bb (patch) | |
| tree | cbcae52e0ce4cd9f080203dec47be11fc6fcad59 /llm | |
| parent | 6a3e2a960a925ac7f9c120fea0d7cdf8bd211010 (diff) | |
Refactor progress bar life cycle
Diffstat (limited to 'llm')
| -rw-r--r-- | llm/perplexity.go | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/llm/perplexity.go b/llm/perplexity.go index ab31889..5d9056e 100644 --- a/llm/perplexity.go +++ b/llm/perplexity.go @@ -1,7 +1,6 @@ package llm import ( - "context" "fmt" "sync" "time" @@ -47,16 +46,14 @@ func (e *Evaluator[R]) Run(data dataset.Reader, window, stride int) error { }() } - ctx, cancel := context.WithCancel(context.Background()) - - defer cancel() - pb := tui.NewProgressBar("Perplexity", 20, 0, time.Now()) - go pb.Watch(ctx, 1*time.Second, func() int { + pb.Start(1*time.Second, func() int { return int(e.completed.Load()) }) + defer pb.Close() + n := 0 for d := range data.Texts("text") { |
