Downloads · 30 days
4
6% of all-time downloads
pkhyrn268/broken-model-fixed
broken-model-fixed is a text generation model from pkhyrn268. Use it when you need the model to write or continue text. It is set up for transformers.
This repository is a corrected version of yunmorning/broken-model, created as part of an engineering debugging exercise.
Downloads · 30 days
4
6% of all-time downloads
All-time downloads
66
Public
Parameters
8.2B
16.4 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors16.4 GB · 100%
From the Hugging Face model README
This repository is a corrected version of yunmorning/broken-model, created as part of an engineering debugging exercise.
chat_template to tokenizer_config.jsonWhat was missing:
The tokenizer_config.json had no chat_template field.
Why this breaks /chat/completions:
OpenAI-compatible inference servers receive requests as a list of {role, content} message objects. Before any token is fed to the model, the server must serialize this list into a flat string using the model's chat template. This serialization step is handled by HuggingFace's tokenizer.apply_chat_template(), which reads the chat_template field from tokenizer_config.json.
Without this field, apply_chat_template() raises a TemplateError immediately — the request never reaches the model weights. The failure is pre-inference and 100% reproducible on every request.
Fix applied:
Added the chat_template from the official Qwen/Qwen3-8B repository. The template implements:
<|im_start|>{role}\n{content}<|im_end|>\nenable_thinking=False → injects <think>\n\n</think>\n\n after <|im_start|>assistant\n to suppress reasoning tokens<tool_call> / <tool_response> tagsbase_model in README.mdBefore: base_model: meta-llama/Meta-Llama-3.1-8B
After: base_model: Qwen/Qwen3-8B
Why this is wrong: The model is clearly Qwen3-based ("model_type": "qwen3"), not Llama-3. Since Qwen3 and Llama-3 use different tokenizers and chat formats, keeping the wrong base_model metadata could cause inference systems to apply the wrong chat template.
| File | Field | Value | Notes |
|---|---|---|---|
config.json | intermediate_size | 12288 | Verified via parameter count: total_size (16,381,470,720 bytes) / 2 (bfloat16) = 8.191B params. With intermediate_size=12288 the computed total is ~8.191B (matches); with 22016 it would be ~12.5B (does not match). |
config.json | max_position_embeddings | 40960 | Matches the standard context length configuration for Qwen3-8B. |
tokenizer_config.json | model_max_length | 131072 | Larger than max_position_embeddings, but this does not directly break inference and is sometimes seen in extended-context variants. |
config.json | rope_scaling | null | Consistent with the default context configuration. |
model.safetensors.index.json | Cross-shard weights | Layers 7, 17, and 27 span multiple shards | Looked consistent with normal safetensors sharding behavior. |
generation_config.json | temperature, top_k, top_p | 0.6 / 20 / 0.95 | Matches the official Qwen3 recommended sampling settings. |