[BUG]: export_gguf.py crashes with unhandled tracebacks on missing inputs and allows overwriting source checkpoint
I maintainer di solito rispondono entro 1 giorno
@AdityasagarR123 ci sta già lavorando.
Dal 18/11/2026.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Ferma
- Ambito
- machine-learning
Direzione di ricerca
Start by comparing simple/export_gguf.py with the input validation and error handling in simple/export_safetensors.py, then inspect tests/simple/test_export_gguf.py if present. The issue specifies missing input, invalid checkpoint, overwrite, and vocabulary validation cases; done means those cases exit cleanly without tracebacks. A linked open pull request is already addressing this work.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Bug Description
In simple/export_safetensors.py, input validation and error handling were hardened (issue #295) to validate file existence before reading, report invalid checkpoints cleanly, and refuse to overwrite the source checkpoint.
However, simple/export_gguf.py currently performs no input validation in main():
run = Path(a.run)
cfg = json.loads((run / "recipe.json").read_text(encoding="utf-8"))["model"]
weights = run / f"{a.model}-model.pt"
sd = torch.load(weights, map_location="cpu", weights_only=True)
tok = json.loads(Path(a.tokenizer).read_text(encoding="utf-8"))["model"]
vocab = sorted(tok["vocab"].items(), key=lambda kv: kv[1])
assert [i for _, i in vocab] == list(range(len(vocab))), "tokenizer ids must be contiguous"
assert len(CONTROLS) + len(vocab) == cfg["vocab_size"], "vocabulary size differs from the recipe"
This leads to several failure modes:
- Missing
recipe.json: If--rundoes not containrecipe.json, it raises an unhandledFileNotFoundErrortraceback. - Missing or invalid checkpoint: If
{model}-model.ptis missing,torch.loadcrashes withFileNotFoundError. If corrupted, it produces an unhandled traceback. - Missing tokenizer: If
--tokenizerpoints to a nonexistent file,read_textraises an unhandledFileNotFoundErrortraceback. - Source checkpoint overwrite: If
--outpoints to the input checkpoint path (e.g.--out RUN/conversation-model.pt), the script overwrites the PyTorch checkpoint with GGUF bytes, destroying the source model weights. - Raw
AssertionError: Vocabulary size and contiguous ID assertions raiseAssertionErrortracebacks instead of clean error messages.
Steps to Reproduce
-
Run
export_gguf.pywith a missing run directory or missing checkpoint:python simple/export_gguf.py --run nonexistent --tokenizer tokenizer.json --out out.ggufOutput:
FileNotFoundError: [Errno 2] No such file or directory: 'nonexistent/recipe.json' -
Run
export_gguf.pywith--outpointing to the input checkpoint:python simple/export_gguf.py --run RUN --tokenizer PREP/tokenizer/tokenizer.json --out RUN/conversation-model.ptThe source
.ptmodel checkpoint is overwritten and corrupted.
Expected Behavior
Align error handling with simple/export_safetensors.py:
- Validate that
recipe.json,weights, andtokenizerexist before reading, exiting cleanly withsys.exit(...)if missing. - Catch corrupted checkpoint files cleanly:
sys.exit(f"source checkpoint {weights} is invalid: {exc}"). - Reject
--outwhen it resolves to the source checkpoint:p.error("--out must not overwrite the source checkpoint"). - Replace raw
assertstatements withsys.exit(...)for vocabulary validation. - Add unit tests in
tests/simple/test_export_gguf.pyverifying that missing inputs, invalid checkpoints, and overwrite attempts exit cleanly without tracebacks.
@ryoari Could you please assign this to me ? I can prepare a focused PR implementing these checks along with unit tests.
Update
Implemented in #352. Beyond the list above:
- The GGUF is written to a temporary file and renamed into place only when complete, so a failed export never leaves a broken
.gguf. - The recipe's model fields, the checkpoint's tensors and the tokenizer's
vocabandmergesare all checked before anything is written. - The overwrite guard also catches the source reached through another path or a hard link.
- Lingua principale
- Python
- Stelle
- 26
- Fork
- 64
- Merge medio
- 2g 11h
- PR unite (30g)
- 71
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di AOSSIE-Org/OpenVerifiableLLM
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
AOSSIE-Org/OpenVerifiableLLM#357 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG]: Forked runs omit timestamps for inherited chain entriesForse già presa @pavithra-r06 l’ha presa 3 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
AOSSIE-Org/OpenVerifiableLLM#334 · 3 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG]: review_ckpt.py passes a run that has .pt files no chain entry coversForse già presa @arshil42 l’ha presa 3 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
AOSSIE-Org/OpenVerifiableLLM#332 · 4 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG]: DigiCert timestamp verification fails on Windows because system_ca() ignores Windows CA bundlesForse già presa @pavithra-r06 l’ha presa 3 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
AOSSIE-Org/OpenVerifiableLLM#290 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG]: simple/ovl.py bench crashes with TypeError or ZeroDivisionError when stream yields <= 50 updatesForse già presa @AdityasagarR123 l’ha presa 26 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
AOSSIE-Org/OpenVerifiableLLM#223 · 2 commenti · 2 assegnatari ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di AOSSIE-Org/OpenVerifiableLLM
Issue simili
-
needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
gke-labs/kube-agents#6778 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Declare the CMS schema library in the optional recipients extraForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertaarea:python in-progress
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
yhay81/pyropdf#1005 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
area/build-framework kind/enhancement priority/low
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
yugabyte/yugabyte-db#38826 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 72/100
sususweet/midea_auto_cloud#306 ·
I maintainer di solito rispondono entro 9 giorni