Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scripts : fix missing key in compare-llama-bench.py #10332

Merged
merged 1 commit into from
Nov 16, 2024

Conversation

ggerganov
Copy link
Owner

cont #10319

I get the following error on master:

Traceback (most recent call last):
  File "./scripts/compare-llama-bench.py", line 307, in <module>
    gpu_blas = bool(rows_full[0][KEY_PROPERTIES.index("gpu_blas")])
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: 'gpu_blas' is not in list

@ggerganov ggerganov requested a review from Copilot November 16, 2024 08:19
@github-actions github-actions bot added script Script related python python script changes labels Nov 16, 2024

Choose a reason for hiding this comment

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated no suggestions.

Copy link
Collaborator

@JohannesGaessler JohannesGaessler left a comment

Choose a reason for hiding this comment

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

This happens when you don't explicitly tell the script which columns to show, which is a case I didn't check.

@ggerganov ggerganov merged commit f245cc2 into master Nov 16, 2024
10 checks passed
@ggerganov ggerganov deleted the gg/py-compare-fix branch November 16, 2024 08:32
arthw pushed a commit to arthw/llama.cpp that referenced this pull request Nov 18, 2024
@ggerganov
Copy link
Owner Author

ggerganov commented Nov 25, 2024

Strangely, the compare-llama-bench.py script stopped working on my Mac Studio with this error:

$ ▶ ./scripts/compare-commits.sh master gg/metal-enable-mv -m models/llama-3.2-1b-instruct/ggml-model-q4_0.gguf -p 1,2,3,4,5,6,7,8
+ ./scripts/compare-llama-bench.py --check
+ bench_args='-m models/llama-3.2-1b-instruct/ggml-model-q4_0.gguf -p 1,2,3,4,5,6,7,8'
+ rm -f llama-bench.sqlite
+ git checkout master
Switched to branch 'master'
+ make clean
++ nproc
+ make -j24 llama-bench
+ ./llama-bench -o sql -oe md -m models/llama-3.2-1b-instruct/ggml-model-q4_0.gguf -p 1,2,3,4,5,6,7,8
+ sqlite3 llama-bench.sqlite
| model                          |       size |     params | backend    | threads |          test |                  t/s |
| ------------------------------ | ---------: | ---------: | ---------- | ------: | ------------: | -------------------: |
| llama 1B Q4_0                  | 727.75 MiB |     1.24 B | Metal,BLAS |      16 |           pp1 |        309.22 ± 5.13 |
| llama 1B Q4_0                  | 727.75 MiB |     1.24 B | Metal,BLAS |      16 |           pp2 |        140.87 ± 0.52 |
| llama 1B Q4_0                  | 727.75 MiB |     1.24 B | Metal,BLAS |      16 |           pp3 |        209.10 ± 0.48 |
| llama 1B Q4_0                  | 727.75 MiB |     1.24 B | Metal,BLAS |      16 |           pp4 |        280.78 ± 1.56 |
| llama 1B Q4_0                  | 727.75 MiB |     1.24 B | Metal,BLAS |      16 |           pp5 |        348.03 ± 1.30 |
| llama 1B Q4_0                  | 727.75 MiB |     1.24 B | Metal,BLAS |      16 |           pp6 |        413.57 ± 1.32 |
| llama 1B Q4_0                  | 727.75 MiB |     1.24 B | Metal,BLAS |      16 |           pp7 |        482.86 ± 1.97 |
| llama 1B Q4_0                  | 727.75 MiB |     1.24 B | Metal,BLAS |      16 |           pp8 |        550.37 ± 1.47 |
| llama 1B Q4_0                  | 727.75 MiB |     1.24 B | Metal,BLAS |      16 |         tg128 |        310.18 ± 0.36 |

build: f6d12e7df (4162)
+ git checkout gg/metal-enable-mv
Switched to branch 'gg/metal-enable-mv'
+ make clean
++ nproc
+ make -j24 llama-bench
+ ./llama-bench -o sql -oe md -m models/llama-3.2-1b-instruct/ggml-model-q4_0.gguf -p 1,2,3,4,5,6,7,8
+ sqlite3 llama-bench.sqlite
| model                          |       size |     params | backend    | threads |          test |                  t/s |
| ------------------------------ | ---------: | ---------: | ---------- | ------: | ------------: | -------------------: |
| llama 1B Q4_0                  | 727.75 MiB |     1.24 B | Metal,BLAS |      16 |           pp1 |        310.12 ± 2.93 |
| llama 1B Q4_0                  | 727.75 MiB |     1.24 B | Metal,BLAS |      16 |           pp2 |       529.01 ± 12.88 |
| llama 1B Q4_0                  | 727.75 MiB |     1.24 B | Metal,BLAS |      16 |           pp3 |       678.46 ± 13.34 |
| llama 1B Q4_0                  | 727.75 MiB |     1.24 B | Metal,BLAS |      16 |           pp4 |        826.56 ± 6.58 |
| llama 1B Q4_0                  | 727.75 MiB |     1.24 B | Metal,BLAS |      16 |           pp5 |        347.55 ± 0.92 |
| llama 1B Q4_0                  | 727.75 MiB |     1.24 B | Metal,BLAS |      16 |           pp6 |        415.98 ± 1.37 |
| llama 1B Q4_0                  | 727.75 MiB |     1.24 B | Metal,BLAS |      16 |           pp7 |        485.46 ± 0.59 |
| llama 1B Q4_0                  | 727.75 MiB |     1.24 B | Metal,BLAS |      16 |           pp8 |        553.17 ± 1.59 |
| llama 1B Q4_0                  | 727.75 MiB |     1.24 B | Metal,BLAS |      16 |         tg128 |        310.30 ± 1.27 |

build: 7670486c8 (4163)
+ ./scripts/compare-llama-bench.py -b master -c gg/metal-enable-mv
Traceback (most recent call last):
  File "/Users/ggerganov/development/github/llama.cpp/./scripts/compare-llama-bench.py", line 307, in <module>
    ngl = int(rows_full[0][KEY_PROPERTIES.index("n_gpu_layers")])
              ~~~~~~~~~^^^
IndexError: list index out of range

The weird thing is the same command runs successfully on my MacBook. Can't figure out what is the cause. @JohannesGaessler do you have any ideas?

@JohannesGaessler
Copy link
Collaborator

I think this is caused by the program for some reason not finding the correct commits to compare or not finding any data for the commits in question. rows_full ends up being an empty list so you get an error. It could have to do with implicit state through the contents of llama-bench.sqlite or different master branches.

Someone messaged me asking for useful things to do for the project and I told them (among other things) that better handling of failure cases in compare-llama-bench.py would be useful. I haven't heard anything back so I guess I may need to do it myself after all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python python script changes script Script related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants