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

Abierto Apto para principiantes
#804 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
78/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
python

Línea de trabajo

Empieza en src/pruna/algorithms/llama_cpp.py y sigue _convert_to_gguf() hasta donde construye el comando convert_hf_to_gguf.py. Comprueba cómo se obtiene el nombre del modelo y se pasa al convertidor; luego busca pruebas relacionadas que cubran la conversión a GGUF. Se considera terminado cuando las compilaciones repetidas del mismo modelo usan un general.name estable; el informe también espera una prueba para ese comportamiento.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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).

Lenguaje dominante
Python
Estrellas
1.4k
Forks
129
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de PrunaAI/pruna

Todos los issues de PrunaAI/pruna

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.