Skip to content

Fix TypeError in histogram generation by casting bin count to int - #32518

Merged
CISC merged 2 commits into
ggml-org:masterfrom
zhaixuejun1993:xuejun/fix_type_error
Nov 20, 2026
Merged

CISC merged 2 commits into
ggml-org:masterfrom
zhaixuejun1993:xuejun/fix_type_error

Conversation

@zhaixuejun1993

Copy link
Copy Markdown
Contributor

This pull request makes a minor adjustment to how histogram bins are calculated in the benchmark function of scripts/server-bench.py. The change ensures that the maximum bin value is explicitly cast to an integer, which may improve compatibility or correctness in plotting.

  • Changed the calculation of bin_max in the benchmark function to cast the result of np.ceil(token_t_last) to an integer before adding 1, ensuring the bin range for the histogram is an integer value.…eration

Symptom: benchmark crashes while generating gen_rate histogram.

Root cause: np.ceil(...) returns numpy.float64, and that value was used where an integer count/shape argument is required.

Fix: cast ceil result to int before +1, ensuring bin count is an integer.

Result: histogram path completes and gen_rate.png is generated reliably.

Overview

Additional information

Requirements

…eration

Symptom: benchmark crashes while generating gen_rate histogram.

Root cause: np.ceil(...) returns numpy.float64, and that value was used where an integer count/shape argument is required.

Fix: cast ceil result to int before +1, ensuring bin count is an integer.

Result: histogram path completes and gen_rate.png is generated reliably.
@ggml-gh-bot

ggml-gh-bot Bot commented Nov 18, 2026

Copy link
Copy Markdown

Hi @zhaixuejun1993, thanks for your contribution!

Per our contribution guidelines, the automated PR checker found the following issue(s) that need your attention:

  • PR Template not respected: Please respect the template when creating a new pull request. Make sure to fill out all required sections.

Please note that maintainers reserve the right to make final decisions on PRs. If you believe there is a mistake, please comment below.

@ggml-gh-bot ggml-gh-bot Bot added the draft PR will be changed to draft by github-actions bot label Nov 18, 2026
@github-actions
github-actions Bot marked this pull request as draft November 18, 2026 05:50
@github-actions github-actions Bot removed the draft PR will be changed to draft by github-actions bot label Nov 18, 2026

@CISC CISC left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, this is my fault, ironically happened while fixing type errors... :)

Comment thread scripts/server-bench.py Resolved
Co-authored-by: Sigbjørn Skjæret <[email protected]>
@zhaixuejun1993
zhaixuejun1993 marked this pull request as ready for review November 20, 2026 13:21
@zhaixuejun1993
zhaixuejun1993 requested a review from CISC November 20, 2026 13:21
@CISC
CISC merged commit e626db7 into ggml-org:master Nov 20, 2026
8 checks passed
Kidplayer666 pushed a commit to Kidplayer666/llama.cpp that referenced this pull request Nov 20, 2026
* fix(server-bench): prevent float bin-count TypeError in histogram generation

Symptom: benchmark crashes while generating gen_rate histogram.

Root cause: np.ceil(...) returns numpy.float64, and that value was used where an integer count/shape argument is required.

Fix: cast ceil result to int before +1, ensuring bin count is an integer.

Result: histogram path completes and gen_rate.png is generated reliably.

* Update scripts/server-bench.py

Co-authored-by: Sigbjørn Skjæret <[email protected]>

---------

Co-authored-by: Sigbjørn Skjæret <[email protected]>
Annieren pushed a commit to Annieren/llama.cpp-upstream that referenced this pull request Nov 23, 2026
* fix(server-bench): prevent float bin-count TypeError in histogram generation

Symptom: benchmark crashes while generating gen_rate histogram.

Root cause: np.ceil(...) returns numpy.float64, and that value was used where an integer count/shape argument is required.

Fix: cast ceil result to int before +1, ensuring bin count is an integer.

Result: histogram path completes and gen_rate.png is generated reliably.

* Update scripts/server-bench.py

Co-authored-by: Sigbjørn Skjæret <[email protected]>

---------

Co-authored-by: Sigbjørn Skjæret <[email protected]>
Nindaleth pushed a commit to Nindaleth/llama.cpp that referenced this pull request Nov 26, 2026
* fix(server-bench): prevent float bin-count TypeError in histogram generation

Symptom: benchmark crashes while generating gen_rate histogram.

Root cause: np.ceil(...) returns numpy.float64, and that value was used where an integer count/shape argument is required.

Fix: cast ceil result to int before +1, ensuring bin count is an integer.

Result: histogram path completes and gen_rate.png is generated reliably.

* Update scripts/server-bench.py

Co-authored-by: Sigbjørn Skjæret <[email protected]>

---------

Co-authored-by: Sigbjørn Skjæret <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants