Commit e212240
fix: support tied embeddings in LlamaWeightLoader
Small models like Qwen2.5-0.5B/1.5B tie their input and output
embeddings (output.weight = token_embd.weight) to save parameters.
The GGUF file omits output.weight in this case, causing
"Missing required tensor" errors during load.
Detect missing output.weight when token_embd.weight is present
and alias the lookup to reuse the embedding tensor as the LM head.
Logs "Tied word embeddings" when this path is taken.
Verified with Qwen2.5-0.5B-Instruct-Q8_0 which now loads correctly
and reaches the tool calling demo. (Output quality still limited by
a separate byte-level BPE tokenizer issue.)
Refs: #49
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent e595a02 commit e212240
1 file changed
Lines changed: 29 additions & 2 deletions
Lines changed: 29 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
243 | 243 | | |
244 | 244 | | |
245 | 245 | | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
246 | 253 | | |
247 | | - | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
248 | 260 | | |
249 | 261 | | |
250 | 262 | | |
| |||
299 | 311 | | |
300 | 312 | | |
301 | 313 | | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
302 | 322 | | |
303 | | - | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
304 | 329 | | |
| 330 | + | |
| 331 | + | |
305 | 332 | | |
306 | 333 | | |
307 | 334 | | |
| |||
0 commit comments