Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with meta-llama/Llama-3.2-1B #211

Open
deafTim opened this issue Oct 18, 2024 · 2 comments
Open

Error with meta-llama/Llama-3.2-1B #211

deafTim opened this issue Oct 18, 2024 · 2 comments

Comments

@deafTim
Copy link

deafTim commented Oct 18, 2024

When I use meta-llama/Llama-3.2-1B
Can it be fixed?

RuntimeError: Error(s) in loading state_dict for Transformer:
	Missing key(s) in state_dict: "tok_embeddings.weight", "layers.0.attention.wqkv.weight", "layers.0.attention.wo.weight", "layers.0.feed_forward.w1.weight", "layers.0.feed_forward.w3.weight", "layers.0.feed_forward.w2.weight", "layers.0.ffn_norm.weight", "layers.0.attention_norm.weight", "layers.1.attention.wqkv.weight", "layers.1.attention.wo.weight", "layers.1.feed_forward.w1.weight", "layers.1.feed_forward.w3.weight", "layers.1.feed_forward.w2.weight", "layers.1.ffn_norm.weight", "layers.1.attention_norm.weight", "layers.2.attention.wqkv.weight", "layers.2.attention.wo.weight", "layers.2.feed_forward.w1.weight", "layers.2.feed_forward.w3.weight", "layers.2.feed_forward.w2.weight", "layers.2.ffn_norm.weight", "layers.2.attention_norm.weight", "layers.3.attention.wqkv.weight", "layers.3.attention.wo.weight", "layers.3.feed_forward.w1.weight", "layers.3.feed_forward.w3.weight", "layers.3.feed_forward.w2.weight", "layers.3.ffn_norm.weight", "layers.3.attention_norm.weight", "layers.4.attention.wqkv.weight", "layers.4.attention.wo.weight", "layers.4.feed_forward.w1.weight", "layers.4.feed_forward.w3.weight", "layers.4.feed_forward.w2.weight", "layers.4.ffn_norm.weight", "layers.4.attention_norm.weight", "layers.5.attention.wqkv.weight", "layers.5.attention.wo.weight", "layers.5.feed_forward.w1.weight", "layers.5.feed_forward.w3.weight", "layers.5.feed_forward.w2.weight", "layers.5.ffn_norm.weight", "layers.5.attention_norm.weight", "layers.6.attention.wqkv.weight", "layers.6.attention.wo.weight", "layers.6.feed_forward.w1.weight", "layers.6.feed_forward.w3.weight", "layers.6.feed_forward.w2.weight", "layers.6.ffn_norm.weight", "layers.6.attention_norm.weight", "layers.7.attention.wqkv.weight", "layers.7.attention.wo.weight", "layers.7.feed_forward.w1.weight", "layers.7.feed_forward.w3.weight", "layers.7.feed_forward.w2.weight", "layers.7.ffn_norm.weight", "layers.7.attention_norm.weight", "layers.8.attention.wqkv.weight", "layers.8.attention.wo.weight", "layers.8.feed_forward.w1.weight", "layers.8.feed_forward.w3.weight", "layers.8.feed_forward.w2.weight", "layers.8.ffn_norm.weight", "layers.8.attention_norm.weight", "layers.9.attention.wqkv.weight", "layers.9.attention.wo.weight", "layers.9.feed_forward.w1.weight", "layers.9.feed_forward.w3.weight", "layers.9.feed_forward.w2.weight", "layers.9.ffn_norm.weight", "layers.9.attention_norm.weight", "layers.10.attention.wqkv.weight", "layers.10.attention.wo.weight", "layers.10.feed_forward.w1.weight", "layers.10.feed_forward.w3.weight", "layers.10.feed_forward.w2.weight", "layers.10.ffn_norm.weight", "layers.10.attention_norm.weight", "layers.11.attention.wqkv.weight", "layers.11.attention.wo.weight", "layers.11.feed_forward.w1.weight", "layers.11.feed_forward.w3.weight", "layers.11.feed_forward.w2.weight", "layers.11.ffn_norm.weight", "layers.11.attention_norm.weight", "layers.12.attention.wqkv.weight", "layers.12.attention.wo.weight", "layers.12.feed_forward.w1.weight", "layers.12.feed_forward.w3.weight", "layers.12.feed_forward.w2.weight", "layers.12.ffn_norm.weight", "layers.12.attention_norm.weight", "layers.13.attention.wqkv.weight", "layers.13.attention.wo.weight", "layers.13.feed_forward.w1.weight", "layers.13.feed_forward.w3.weight", "layers.13.feed_forward.w2.weight", "layers.13.ffn_norm.weight", "layers.13.attention_norm.weight", "layers.14.attention.wqkv.weight", "layers.14.attention.wo.weight", "layers.14.feed_forward.w1.weight", "layers.14.feed_forward.w3.weight", "layers.14.feed_forward.w2.weight", "layers.14.ffn_norm.weight", "layers.14.attention_norm.weight", "layers.15.attention.wqkv.weight", "layers.15.attention.wo.weight", "layers.15.feed_forward.w1.weight", "layers.15.feed_forward.w3.weight", "layers.15.feed_forward.w2.weight", "layers.15.ffn_norm.weight", "layers.15.attention_norm.weight", "norm.weight", "output.weight". 
	Unexpected key(s) in state_dict: "model.embed_tokens.weight", "model.layers.0.input_layernorm.weight", "model.layers.0.mlp.down_proj.weight", "model.layers.0.mlp.gate_proj.weight", "model.layers.0.mlp.up_proj.weight", "model.layers.0.post_attention_layernorm.weight", "model.layers.0.self_attn.k_proj.weight", "model.layers.0.self_attn.o_proj.weight", "model.layers.0.self_attn.q_proj.weight", "model.layers.0.self_attn.v_proj.weight", "model.layers.1.input_layernorm.weight", "model.layers.1.mlp.down_proj.weight", "model.layers.1.mlp.gate_proj.weight", "model.layers.1.mlp.up_proj.weight", "model.layers.1.post_attention_layernorm.weight", "model.layers.1.self_attn.k_proj.weight", "model.layers.1.self_attn.o_proj.weight", "model.layers.1.self_attn.q_proj.weight", "model.layers.1.self_attn.v_proj.weight", "model.layers.10.input_layernorm.weight", "model.layers.10.mlp.down_proj.weight", "model.layers.10.mlp.gate_proj.weight", "model.layers.10.mlp.up_proj.weight", "model.layers.10.post_attention_layernorm.weight", "model.layers.10.self_attn.k_proj.weight", "model.layers.10.self_attn.o_proj.weight", "model.layers.10.self_attn.q_proj.weight", "model.layers.10.self_attn.v_proj.weight", "model.layers.11.input_layernorm.weight", "model.layers.11.mlp.down_proj.weight", "model.layers.11.mlp.gate_proj.weight", "model.layers.11.mlp.up_proj.weight", "model.layers.11.post_attention_layernorm.weight", "model.layers.11.self_attn.k_proj.weight", "model.layers.11.self_attn.o_proj.weight", "model.layers.11.self_attn.q_proj.weight", "model.layers.11.self_attn.v_proj.weight", "model.layers.12.input_layernorm.weight", "model.layers.12.mlp.down_proj.weight", "model.layers.12.mlp.gate_proj.weight", "model.layers.12.mlp.up_proj.weight", "model.layers.12.post_attention_layernorm.weight", "model.layers.12.self_attn.k_proj.weight", "model.layers.12.self_attn.o_proj.weight", "model.layers.12.self_attn.q_proj.weight", "model.layers.12.self_attn.v_proj.weight", "model.layers.13.input_layernorm.weight", "model.layers.13.mlp.down_proj.weight", "model.layers.13.mlp.gate_proj.weight", "model.layers.13.mlp.up_proj.weight", "model.layers.13.post_attention_layernorm.weight", "model.layers.13.self_attn.k_proj.weight", "model.layers.13.self_attn.o_proj.weight", "model.layers.13.self_attn.q_proj.weight", "model.layers.13.self_attn.v_proj.weight", "model.layers.14.input_layernorm.weight", "model.layers.14.mlp.down_proj.weight", "model.layers.14.mlp.gate_proj.weight", "model.layers.14.mlp.up_proj.weight", "model.layers.14.post_attention_layernorm.weight", "model.layers.14.self_attn.k_proj.weight", "model.layers.14.self_attn.o_proj.weight", "model.layers.14.self_attn.q_proj.weight", "model.layers.14.self_attn.v_proj.weight", "model.layers.15.input_layernorm.weight", "model.layers.15.mlp.down_proj.weight", "model.layers.15.mlp.gate_proj.weight", "model.layers.15.mlp.up_proj.weight", "model.layers.15.post_attention_layernorm.weight", "model.layers.15.self_attn.k_proj.weight", "model.layers.15.self_attn.o_proj.weight", "model.layers.15.self_attn.q_proj.weight", "model.layers.15.self_attn.v_proj.weight", "model.layers.2.input_layernorm.weight", "model.layers.2.mlp.down_proj.weight", "model.layers.2.mlp.gate_proj.weight", "model.layers.2.mlp.up_proj.weight", "model.layers.2.post_attention_layernorm.weight", "model.layers.2.self_attn.k_proj.weight", "model.layers.2.self_attn.o_proj.weight", "model.layers.2.self_attn.q_proj.weight", "model.layers.2.self_attn.v_proj.weight", "model.layers.3.input_layernorm.weight", "model.layers.3.mlp.down_proj.weight", "model.layers.3.mlp.gate_proj.weight", "model.layers.3.mlp.up_proj.weight", "model.layers.3.post_attention_layernorm.weight", "model.layers.3.self_attn.k_proj.weight", "model.layers.3.self_attn.o_proj.weight", "model.layers.3.self_attn.q_proj.weight", "model.layers.3.self_attn.v_proj.weight", "model.layers.4.input_layernorm.weight", "model.layers.4.mlp.down_proj.weight", "model.layers.4.mlp.gate_proj.weight", "model.layers.4.mlp.up_proj.weight", "model.layers.4.post_attention_layernorm.weight", "model.layers.4.self_attn.k_proj.weight", "model.layers.4.self_attn.o_proj.weight", "model.layers.4.self_attn.q_proj.weight", "model.layers.4.self_attn.v_proj.weight", "model.layers.5.input_layernorm.weight", "model.layers.5.mlp.down_proj.weight", "model.layers.5.mlp.gate_proj.weight", "model.layers.5.mlp.up_proj.weight", "model.layers.5.post_attention_layernorm.weight", "model.layers.5.self_attn.k_proj.weight", "model.layers.5.self_attn.o_proj.weight", "model.layers.5.self_attn.q_proj.weight", "model.layers.5.self_attn.v_proj.weight", "model.layers.6.input_layernorm.weight", "model.layers.6.mlp.down_proj.weight", "model.layers.6.mlp.gate_proj.weight", "model.layers.6.mlp.up_proj.weight", "model.layers.6.post_attention_layernorm.weight", "model.layers.6.self_attn.k_proj.weight", "model.layers.6.self_attn.o_proj.weight", "model.layers.6.self_attn.q_proj.weight", "model.layers.6.self_attn.v_proj.weight", "model.layers.7.input_layernorm.weight", "model.layers.7.mlp.down_proj.weight", "model.layers.7.mlp.gate_proj.weight", "model.layers.7.mlp.up_proj.weight", "model.layers.7.post_attention_layernorm.weight", "model.layers.7.self_attn.k_proj.weight", "model.layers.7.self_attn.o_proj.weight", "model.layers.7.self_attn.q_proj.weight", "model.layers.7.self_attn.v_proj.weight", "model.layers.8.input_layernorm.weight", "model.layers.8.mlp.down_proj.weight", "model.layers.8.mlp.gate_proj.weight", "model.layers.8.mlp.up_proj.weight", "model.layers.8.post_attention_layernorm.weight", "model.layers.8.self_attn.k_proj.weight", "model.layers.8.self_attn.o_proj.weight", "model.layers.8.self_attn.q_proj.weight", "model.layers.8.self_attn.v_proj.weight", "model.layers.9.input_layernorm.weight", "model.layers.9.mlp.down_proj.weight", "model.layers.9.mlp.gate_proj.weight", "model.layers.9.mlp.up_proj.weight", "model.layers.9.post_attention_layernorm.weight", "model.layers.9.self_attn.k_proj.weight", "model.layers.9.self_attn.o_proj.weight", "model.layers.9.self_attn.q_proj.weight", "model.layers.9.self_attn.v_proj.weight", "model.norm.weight". 
@deafTim
Copy link
Author

deafTim commented Oct 18, 2024

It seems like this model has a different architecture. Is there a way to fix that?

@deafTim
Copy link
Author

deafTim commented Oct 18, 2024

These are names of keys in layers:
Is there a way to may be convert them somehow?

Transformer (from your code)

layers.0.attention.wo.weight
layers.0.attention.wqkv.weight
layers.0.attention_norm.weight
layers.0.feed_forward.w1.weight
layers.0.feed_forward.w2.weight
layers.0.feed_forward.w3.weight
layers.0.ffn_norm.weight

llama-3.2-1B

layers.0.input_layernorm.weight
layers.0.mlp.down_proj.weight
layers.0.mlp.gate_proj.weight
layers.0.mlp.up_proj.weight
layers.0.post_attention_layernorm.weight
layers.0.self_attn.k_proj.weight
layers.0.self_attn.o_proj.weight
layers.0.self_attn.q_proj.weight
layers.0.self_attn.v_proj.weight

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant