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

未关闭 适合新手
#804 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
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. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

PrunaAI/pruna 的其他 Issue

查看 PrunaAI/pruna 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。