Repository navigation
Expose generation timings from server & update completions.js - #2116
Conversation
Also add ways to access completion as promise and EventSource
|
Some goodies for #1998 |
ty for the help |
|
Why are there so many whitespace changes? Especially when it's going against the coding style? |
| { | ||
| const auto timings = llama_get_timings(llama.ctx); | ||
|
|
||
| assert(timings.n_eval == llama.num_tokens_predicted); |
There was a problem hiding this comment.
warning: comparison of integers of different signs: 'const int32_t' (aka 'const int') and 'size_t' (aka 'unsigned long') [-Wsign-compare]
There was a problem hiding this comment.
This line also crashes my server every time because they are not the same. I am running everything with the defaults, type "Hello Llama" and it crashes at the assert (guanaco-7B.ggmlv3.q5_K_M).
Commenting this line out seems to work just fine for me although I am not sure what unwanted behaviors I might get. seems like if this is not critical, it should be logged as a warning rather than cause an exception.
…rg#2116) * use javascript generators as much cleaner API Also add ways to access completion as promise and EventSource * export llama_timings as struct and expose them in server * update readme, update baked includes * llama : uniform variable names + struct init --------- Co-authored-by: Georgi Gerganov <[email protected]>
…rg#2116) * use javascript generators as much cleaner API Also add ways to access completion as promise and EventSource * export llama_timings as struct and expose them in server * update readme, update baked includes * llama : uniform variable names + struct init --------- Co-authored-by: Georgi Gerganov <[email protected]>
…rg#2116) * use javascript generators as much cleaner API Also add ways to access completion as promise and EventSource * export llama_timings as struct and expose them in server * update readme, update baked includes * llama : uniform variable names + struct init --------- Co-authored-by: Georgi Gerganov <[email protected]>
…rg#2116) * use javascript generators as much cleaner API Also add ways to access completion as promise and EventSource * export llama_timings as struct and expose them in server * update readme, update baked includes * llama : uniform variable names + struct init --------- Co-authored-by: Georgi Gerganov <[email protected]>
…rg#2116) * use javascript generators as much cleaner API Also add ways to access completion as promise and EventSource * export llama_timings as struct and expose them in server * update readme, update baked includes * llama : uniform variable names + struct init --------- Co-authored-by: Georgi Gerganov <[email protected]>
… (offset-rebind) Batched (ne3>1) decode-split flash matcher: per-(stream,row) dispatches with per-stream s*nb[3] offset rebinding of the EXISTING kernel — no kernel change (BATCHED-FLASH-OFFSET-PROPOSAL.md). Contiguity-gated stream dim; per-dispatch partial/counter transients (sharing one set at offset 0 raced the online-softmax reduce). Verified on strixhalo (zaya q4nx-c43, np2): - the batched node is CLAIMED (was 'unsupported HRX node FLASH_ATTN_EXT f32[128,8,4,2]' graph -1) - per-position logits: stream 0 ≈ CPU-exact (9079/236761/107/4906 argmax order, small fp deltas) — the flash attention math itself is correct - residual bug (downstream, not this matcher): the q8 alternate consumer reads stream 1 one row stale (B's logits = A's previous-step logits) — batched q8 row indexing in the consuming dispatch Separate finding recorded on the issues: this branch's device decode is not oracle-correct with a REAL continuation (dense qwen3 + 30B collapsed; zaya diverges at tok 4) — the ggml-org#2147 decode-norm reorder fix is on fix/qwen3-decode-norm, not this lineage. Earlier 'token-identical' claims from the rt_tok harness were measured on a degenerate continuation (harness bug, corrected on ggml-org#2117/ggml-org#2116/ggml-org#2145).
I still had some stashed changes floating around before the merge. This is pretty basic cleanups, but makes it even easier to use the completion.js. Now you can just:
Who knew that javascript had generators at this point? It's honestly not a bad language anymore it turns out 😆.
I also wanted to expose the generation speed in the frontend.
For that I moved the timing generation to return a new
llama_get_timingsand switchedllama_print_timingsto use this. This is changing llama.h/cpp so please let me know if this is is gross.