weightmap.go 786 B

12345678910111213141516171819202122232425
  1. package qwen3
  2. import "makarna/pkg/model/weightmap"
  3. func init() {
  4. weightmap.Register("qwen3", weightmap.MapperFunc(mapQwen3Name))
  5. }
  6. func mapQwen3Name(name string) (int, string, bool) {
  7. return weightmap.ParseLayerName(name, "model.layers.", qwen3Fields)
  8. }
  9. var qwen3Fields = map[string]string{
  10. "input_layernorm.weight": "attn_norm",
  11. "self_attn.q_proj.weight": "wq",
  12. "self_attn.k_proj.weight": "wk",
  13. "self_attn.v_proj.weight": "wv",
  14. "self_attn.o_proj.weight": "wo",
  15. "self_attn.q_norm.weight": "q_norm",
  16. "self_attn.k_norm.weight": "k_norm",
  17. "post_attention_layernorm.weight": "mlp_norm",
  18. "mlp.gate_proj.weight": "gate",
  19. "mlp.up_proj.weight": "up",
  20. "mlp.down_proj.weight": "down",
  21. }