Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
orangecat
ollama
Commits
cca61181
"mineru.template.json" did not exist on "f407079bc3d24350825b2124440343b65a4a5ce0"
Commit
cca61181
authored
Jul 25, 2023
by
Michael Yang
Browse files
sample metrics
parent
c4904161
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
0 deletions
+13
-0
api/types.go
api/types.go
+11
-0
llama/llama.go
llama/llama.go
+2
-0
No files found.
api/types.go
View file @
cca61181
...
...
@@ -98,6 +98,8 @@ type GenerateResponse struct {
TotalDuration
time
.
Duration
`json:"total_duration,omitempty"`
LoadDuration
time
.
Duration
`json:"load_duration,omitempty"`
SampleCount
int
`json:"sample_count,omitempty"`
SampleDuration
time
.
Duration
`json:"sample_duration,omitempty"`
PromptEvalCount
int
`json:"prompt_eval_count,omitempty"`
PromptEvalDuration
time
.
Duration
`json:"prompt_eval_duration,omitempty"`
EvalCount
int
`json:"eval_count,omitempty"`
...
...
@@ -113,6 +115,15 @@ func (r *GenerateResponse) Summary() {
fmt
.
Fprintf
(
os
.
Stderr
,
"load duration: %v
\n
"
,
r
.
LoadDuration
)
}
if
r
.
SampleCount
>
0
{
fmt
.
Fprintf
(
os
.
Stderr
,
"sample count: %d token(s)
\n
"
,
r
.
SampleCount
)
}
if
r
.
SampleDuration
>
0
{
fmt
.
Fprintf
(
os
.
Stderr
,
"sample duration: %s
\n
"
,
r
.
SampleDuration
)
fmt
.
Fprintf
(
os
.
Stderr
,
"sample rate: %.2f tokens/s
\n
"
,
float64
(
r
.
SampleCount
)
/
r
.
SampleDuration
.
Seconds
())
}
if
r
.
PromptEvalCount
>
0
{
fmt
.
Fprintf
(
os
.
Stderr
,
"prompt eval count: %d token(s)
\n
"
,
r
.
PromptEvalCount
)
}
...
...
llama/llama.go
View file @
cca61181
...
...
@@ -216,6 +216,8 @@ func (llm *LLM) Predict(ctx []int, prompt string, fn func(api.GenerateResponse))
fn
(
api
.
GenerateResponse
{
Done
:
true
,
Context
:
last
,
SampleCount
:
int
(
timings
.
n_sample
),
SampleDuration
:
parseDurationMs
(
float64
(
timings
.
t_sample_ms
)),
PromptEvalCount
:
int
(
timings
.
n_p_eval
),
PromptEvalDuration
:
parseDurationMs
(
float64
(
timings
.
t_p_eval_ms
)),
EvalCount
:
int
(
timings
.
n_eval
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment