This repository contains corrected configuration files for Meta-Llama-3.1-8B, fixing issues from the original yunmorning/broken-model.
Problem Identified
The original model's config.json contained Qwen3 model settings while the README claimed it was based on Meta-Llama-3.1-8B. This mismatch causes inference failures because:
The architecture class (Qwen3ForCausalLM) doesn't match the actual model weights
Token IDs (BOS, EOS) are wrong for LLaMA tokenizer
Vocabulary size mismatches the LLaMA tokenizer
Layer count and intermediate size are incorrect for LLaMA 3.1 8B
Changes Made
config.json
Field
Original (Broken)
Fixed
Reason
architectures
["Qwen3ForCausalLM"]
["LlamaForCausalLM"]
Must match LLaMA model class
model_type
"qwen3"
"llama"
Required for correct model loading
vocab_size
151936
128256
LLaMA 3.1 vocabulary size
bos_token_id
151643
128000
LLaMA 3.1 BOS token
eos_token_id
151645
128001
LLaMA 3.1 EOS token
num_hidden_layers
36
32
LLaMA 3.1 8B has 32 layers
intermediate_size
12288
14336
Correct FFN dimension for LLaMA 3.1 8B
rms_norm_eps
1e-06
1e-05
LLaMA standard value
rope_scaling
null
{...llama3 config}
LLaMA 3.1 uses RoPE scaling
rope_theta
1000000
500000.0
LLaMA 3.1 8B value
generation_config.json
Field
Original
Fixed
Reason
bos_token_id
151643
128000
Match LLaMA tokenizer
eos_token_id
[151645, 151643]
[128001, 128008, 128009]
LLaMA 3.1 EOS tokens
pad_token_id
151643
128004
LLaMA finetune pad token
New Files Added
tokenizer_config.json - Required for chat template and proper tokenization
special_tokens_map.json - Defines BOS, EOS, PAD token strings
test_broken_model.py - Validation script to verify fixes