GitHub

Original file line numberDiff line numberDiff line change

@@ -245,6 +245,11 @@ def permute(v: Tensor, n_heads: int):

245245

continue

246246

sd[keymap[k]] = v

247247

for k,v in experts.items(): sd[k] = Tensor.stack(*[v[i] for i in range(len(v))])

248+
249+

# Handle tied embeddings (e.g., Llama 3.2 1B Instruct where lm_head shares weights with embed_tokens)

250+

if "output.weight" not in sd and "tok_embeddings.weight" in sd:

251+

sd["output.weight"] = sd["tok_embeddings.weight"]

252+
248253

return sd

249254
250255

def convert_from_gguf(weights:dict[str, Tensor], n_layers:int):

Read the original on github.com ↗