-
Notifications
You must be signed in to change notification settings - Fork 12
Closed
Description
Bug Report
Source: tiny-model-ground-truth parity checker (0/59 passing)
Severity: High — blocks GPT-2 GGUF roundtrip
Related: Follow-up to #233 (GPT-2 architecture support)
Description
When reimporting a GPT-2 GGUF file (apr import model.gguf), the contract enforcement fails because hidden_dim=0:
CONTRACT ENFORCEMENT FAILED: Missing vocab_size (50257) or hidden_dim (0).
Cannot validate tensor layouts without model config. This GGUF file may be malformed.
The GGUF export for GPT-2 writes vocab_size but not hidden_dim (or writes it as 0).
Error Output
[PMAT-222] Auto-detected architecture: Gpt2
[PMAT-224] WARNING: Architecture 'GPT-2' has not been verified for inference.
error: CONTRACT ENFORCEMENT FAILED: Missing vocab_size (50257) or hidden_dim (0).
Cannot validate tensor layouts without model config.
Root Cause
The GGUF export path (apr export --format gguf) doesn't write the correct metadata key for GPT-2's hidden dimension. The GGUF metadata writer likely uses an architecture-specific key like gpt2.embedding_length that either:
- Isn't being written during export, or
- Isn't being read back during reimport
This may also be related to the hidden_dim=64 bug (see companion issue) — if the APR file itself stores 64 as hidden_dim, the GGUF export might be writing 64 or 0.
Reproduction
cd tiny-model-ground-truth
apr import models/gpt2-124m-int4.gguf -o models/gpt2-roundtrip.apr
# → CONTRACT ENFORCEMENT FAILED: hidden_dim (0)Environment
aprv0.2.16 + Int8 quantization corrupts embedding tensors (NaN/Inf + shape mismatch) #231/232/233 fixes applied- Platform: Linux x86_64
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels