mirror of
https://github.com/R0m1k3/Loki.git
synced 2026-10-23 23:18:13 +02:00
v0.2.20 : corrige le tok/s de decode qui retombait à 0 en fin de génération (timings llama.cpp sur le chunk final sans choices, lus avant le garde)
This commit is contained in:
1 parent
18b8903603
commit
e16c43715e
5 files changed
+18
-16
No files matched your search
@@ -478,8 +478,20 @@ func runChat(ctx context.Context, messages []Message, temperature float64, caps
|
|||||||
if err := json.Unmarshal([]byte(data), &chunk); err != nil {
|
if err := json.Unmarshal([]byte(data), &chunk); err != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
// Le chunk d'usage (include_usage) arrive seul, sans choices : on l'émet
|
// Timings ET usage (include_usage) arrivent sur le CHUNK FINAL qui, sur ce
|
||||||
// avant le guard pour ne pas le perdre.
|
// build llama.cpp (MTP/spéculatif), a `choices:[]` — on les traite AVANT le
|
||||||
|
// garde de choices, sinon `gen_tokens`/`gen_per_second` (decode) sont jetés
|
||||||
|
// et l'UI retombe à « 0 tok/s » à la fin de la génération.
|
||||||
|
if chunk.Timings != nil {
|
||||||
|
stats.PromptTokens = chunk.Timings.PromptN
|
||||||
|
stats.PromptPerSecond = chunk.Timings.PromptPerSecond
|
||||||
|
stats.PromptMs = chunk.Timings.PromptMs
|
||||||
|
stats.GenTokens = chunk.Timings.PredictedN
|
||||||
|
stats.GenPerSecond = chunk.Timings.PredictedPerSec
|
||||||
|
stats.GenMs = chunk.Timings.PredictedMs
|
||||||
|
s := stats
|
||||||
|
cb(StreamEvent{Stats: &s})
|
||||||
|
}
|
||||||
if chunk.Usage != nil && chunk.Usage.PromptTokens > 0 {
|
if chunk.Usage != nil && chunk.Usage.PromptTokens > 0 {
|
||||||
stats.PromptTokensTotal = chunk.Usage.PromptTokens
|
stats.PromptTokensTotal = chunk.Usage.PromptTokens
|
||||||
s := stats
|
s := stats
|
||||||
@@ -492,16 +504,6 @@ func runChat(ctx context.Context, messages []Message, temperature float64, caps
|
|||||||
if ch.FinishReason != "" {
|
if ch.FinishReason != "" {
|
||||||
finishReason = ch.FinishReason
|
finishReason = ch.FinishReason
|
||||||
}
|
}
|
||||||
if chunk.Timings != nil {
|
|
||||||
stats.PromptTokens = chunk.Timings.PromptN
|
|
||||||
stats.PromptPerSecond = chunk.Timings.PromptPerSecond
|
|
||||||
stats.PromptMs = chunk.Timings.PromptMs
|
|
||||||
stats.GenTokens = chunk.Timings.PredictedN
|
|
||||||
stats.GenPerSecond = chunk.Timings.PredictedPerSec
|
|
||||||
stats.GenMs = chunk.Timings.PredictedMs
|
|
||||||
s := stats
|
|
||||||
cb(StreamEvent{Stats: &s})
|
|
||||||
}
|
|
||||||
if len(ch.Delta.ToolCalls) > 0 {
|
if len(ch.Delta.ToolCalls) > 0 {
|
||||||
for i, tc := range ch.Delta.ToolCalls {
|
for i, tc := range ch.Delta.ToolCalls {
|
||||||
// llama.cpp's stream may omit index; fall back to slot i.
|
// llama.cpp's stream may omit index; fall back to slot i.
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
const Version = "0.2.19"
|
const Version = "0.2.20"
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// Migration one-shot des anciens skills (SKILLS/<nom>/SKILL.md) vers la
|
// Migration one-shot des anciens skills (SKILLS/<nom>/SKILL.md) vers la
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
+3
-3
@@ -3,13 +3,13 @@
|
|||||||
"FileVersion": {
|
"FileVersion": {
|
||||||
"Major": 0,
|
"Major": 0,
|
||||||
"Minor": 2,
|
"Minor": 2,
|
||||||
"Patch": 19,
|
"Patch": 20,
|
||||||
"Build": 0
|
"Build": 0
|
||||||
},
|
},
|
||||||
"ProductVersion": {
|
"ProductVersion": {
|
||||||
"Major": 0,
|
"Major": 0,
|
||||||
"Minor": 2,
|
"Minor": 2,
|
||||||
"Patch": 19,
|
"Patch": 20,
|
||||||
"Build": 0
|
"Build": 0
|
||||||
},
|
},
|
||||||
"FileFlagsMask": "3f",
|
"FileFlagsMask": "3f",
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
"LegalCopyright": "Copyright (c) 2026 Jean contributors. MIT License.",
|
"LegalCopyright": "Copyright (c) 2026 Jean contributors. MIT License.",
|
||||||
"OriginalFilename": "jean.exe",
|
"OriginalFilename": "jean.exe",
|
||||||
"ProductName": "Jean",
|
"ProductName": "Jean",
|
||||||
"ProductVersion": "0.2.19",
|
"ProductVersion": "0.2.20",
|
||||||
"Comments": "https://github.com/nathaninline/jean — projet open source (MIT)"
|
"Comments": "https://github.com/nathaninline/jean — projet open source (MIT)"
|
||||||
},
|
},
|
||||||
"VarFileInfo": {
|
"VarFileInfo": {
|
||||||
|
|||||||
Reference in new issue
Block a user