Skip to content

Studio: log a live generation rate while a reply is still streaming - #15390

Merged
danielhanchen merged 2 commits into
unslothai:mainfrom
NilayYadav:engine-stats-log-gen-tok
Oct 28, 2026
Merged

danielhanchen merged 2 commits into
unslothai:mainfrom
NilayYadav:engine-stats-log-gen-tok

Conversation

@NilayYadav

Copy link
Copy Markdown
Collaborator

The engine_stats log line read gen_tok_s 0.0 for every tick of a reply longer than one tick, even with running 1 and the engine decoding steadily. llama-server only adds tokens to its rate gauge when a slot is released, and the gauge empties on every read, so long replies (common with reasoning models) only showed a rate on the tick they finished.

While requests run, the rate now comes from the tokens each busy slot decoded since the last tick, read from llama-server's slots endpoint with the same loopback scrape and key. The gauge still wins when a reply finished in that tick. If the slots endpoint is off or fails while decoding, gen_tok_s is left out instead of logging a misleading 0.0.

On a T4 with Qwen3-1.7B GGUF, a 4000-word reply now logs 96 to 115 tok/s on each tick instead of 0.0.

@NilayYadav NilayYadav self-assigned this Oct 26, 2026
@NilayYadav

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-26T23:20:53.908943Z
We couldn’t complete this review. Comment @codex review to try again.
f7d8747 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

An unknown error occurred
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@NilayYadav

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

An unknown error occurred
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

danielhanchen added a commit that referenced this pull request Oct 27, 2026
…reaches (#15515)

`tests/test_optimized_precision_conflicts.py` fails 19 of 19 on main
(`Repo tests (CPU, rest)`, e.g. job 122034866725 on #15505):

```
NameError: name '_agree_fast_inference_across_ranks' is not defined
```

The fixture compiles `FastLanguageModel.from_pretrained` out of
`loader.py` together with a fixed list of three module helpers. #15390
added a call from `from_pretrained` to a new module helper,
`_agree_fast_inference_across_ranks`, which was not on that list, so
every case now stops on the NameError before reaching the precision
checks this file is about. The product code is fine (the helper returns
early when `fast_inference` was not requested); the harness list was
stale.

Instead of adding one more name, the fixture now lifts every `loader.py`
top-level function (and literal constant such as `_VLLM_ENGINE_KWARGS`)
that `from_pretrained` reaches by name, transitively, skipping anything
the fixture already stubs in its namespace. A future helper is picked up
automatically, and the stubs keep precedence.

Verification (local, CPU):
- main: 19 failed; this branch: 19 passed.
- Sabotage: making `_agree_fast_inference_across_ranks` raise fails all
19, so the real helper runs on every case.
- Stub precedence: redefining a stubbed name
(`_raise_if_modeling_ignores_config`) in `loader.py` to raise still
passes 19, so the lift never overrides a stub.
@danielhanchen danielhanchen self-assigned this Oct 28, 2026
@shimmyshimmer

Copy link
Copy Markdown
Member

Review record for #15390, carried over from the mirror it was reviewed on: danielhanchen/unsloth-staging-review#582.

Findings are quoted as posted and attributed to the account that posted them. The reactions shown are the triage recorded on the mirror; none were re-applied here. Commits are named as the mirror's, with this PR's equivalent where one was found.

Round 1: reviewed mirror 8944a5139 (no equivalent commit found on this PR)

chatgpt-codex-connector[bot] (on the mirror)

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 8944a51399

No triage reaction was recorded on the mirror

Verdict

The round converged at mirror 8944a5139 (no equivalent commit found on this PR).

This is the review as it stood at that commit. Anything pushed to this PR afterwards was not part of it.

@danielhanchen
danielhanchen merged commit 940a42a into unslothai:main Oct 28, 2026
36 of 43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants