Skip to content

Commit

Permalink
tools: Respect tie_word_embeddings for qwen2 architecture
Browse files Browse the repository at this point in the history
Some models like qwen2-0.5B use tied embeddings and it looks like all
models specify the value in the config.
  • Loading branch information
zeux committed Jun 6, 2024
1 parent 0406b93 commit 86dfb56
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ def conv(t):
tensors[f"model.layers.{l}.mlp.w3.weight"] = conv(weights[f"model.layers.{l}.mlp.up_proj.weight"])

tensors["model.norm.weight"] = weights["model.norm.weight"].float()
if arch not in ["gemma", "minicpm", "cohere"] or config.get("tie_word_embeddings", None) == False:
if arch not in ["gemma", "minicpm", "cohere", "qwen2"] or config.get("tie_word_embeddings", None) == False:
tensors["model.output.weight"] = conv(weights["lm_head.weight"])
elif arch == "internlm2":
tensors["model.embed.weight"] = conv(weights["model.tok_embeddings.weight"])
Expand Down

0 comments on commit 86dfb56

Please sign in to comment.