Instructions to use pkhyrn268/broken-model-fixed with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use pkhyrn268/broken-model-fixed with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="pkhyrn268/broken-model-fixed") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("pkhyrn268/broken-model-fixed") model = AutoModelForCausalLM.from_pretrained("pkhyrn268/broken-model-fixed", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use pkhyrn268/broken-model-fixed with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "pkhyrn268/broken-model-fixed" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "pkhyrn268/broken-model-fixed", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/pkhyrn268/broken-model-fixed
- SGLang
How to use pkhyrn268/broken-model-fixed with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "pkhyrn268/broken-model-fixed" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "pkhyrn268/broken-model-fixed", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "pkhyrn268/broken-model-fixed" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "pkhyrn268/broken-model-fixed", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use pkhyrn268/broken-model-fixed with Docker Model Runner:
docker model run hf.co/pkhyrn268/broken-model-fixed
broken-model-fixed
This repository is a corrected version of yunmorning/broken-model, created as part of an engineering debugging exercise.
Problem (a) — Root Cause Analysis and Fixes
[main] Fix 1: Added chat_template to tokenizer_config.json
What 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:
- Per-turn format:
<|im_start|>{role}\n{content}<|im_end|>\n enable_thinking=False→ injects<think>\n\n</think>\n\nafter<|im_start|>assistant\nto suppress reasoning tokens- Tool call serialization via
<tool_call>/<tool_response>tags - Multi-turn tool use with correct role handling
[Documentation] Fix 2: Corrected base_model in README.md
Before: 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.
Other fields reviewed
| 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. |
- Downloads last month
- 4