[BUG] llama_cpp: the GGUF file gets a random general.name, so the same build never has the same SHA-256

オープン 初心者向け
#804 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python

調査の方向性

src/pruna/algorithms/llama_cpp.pyから始め、_convert_to_gguf()をたどって、convert_hf_to_gguf.pyコマンドを組み立てる箇所を確認します。モデル名の取得方法とコンバーターへの渡し方を調べ、GGUF変換に関連するテストを探します。同じモデルのビルドを繰り返しても安定したgeneral.nameが使われることを完了条件とし、レポートではその動作を検証するテストも求めています。

索引モデルが issue の本文から書いたものです。

説明

Describe the bug

_convert_to_gguf() in src/pruna/algorithms/llama_cpp.py saves the model into a tempfile.TemporaryDirectory and runs convert_hf_to_gguf.py on that folder without --model-name. When no name comes from the model card, the converter falls back to the folder name for general.name (convert_hf_to_gguf.py at the pinned b8958, lines 901 to 903). So every GGUF file carries a random name like tmpk3x9..., and two builds of the same model can never have the same SHA-256.

What I did

Smashed Qwen2.5-Coder-1.5B-Instruct three times with
SmashConfig({"llama_cpp": {"quantization_method": "q4_k_m", "n_gpu_layers": 0}}, device="cpu")
and compared the files:
- same file size in all three runs
- three different SHA-256 hashes
- three different model names in the logs, each the name of the temp folder
- the same answers on the same 200 Spider questions

Expected behavior

The same model and settings give the same file, or at least a stable general.name, so a checksum can show that the smashed model is the one that was evaluated.

Environment

  • pruna version: 0.3.5
  • python version: 3.12
  • Operating System: Ubuntu (GitHub-hosted runner), x86_64, CPU only

Additional context

convert_hf_to_gguf.py has a --model-name option, and gguf/metadata.py lets it override the name. Passing a stable name, for example the last part of model.config._name_or_path, would fix it:

convert_cmd += ["--model-name", model_id]

I can open a PR with a test that builds twice and compares the names. Found while building a text-to-SQL benchmark on pruna (the same one as #800).

主要言語
Python
スター
1.4k
フォーク
129
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

PrunaAI/pruna のほかの issue

PrunaAI/pruna の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。