You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1. 加载模型时报错如下:
Traceback (most recent call last):
File "/data/Torch-Pruning/examples/LLMs/eval_ppl.py", line 272, in
main()
File "/data/Torch-Pruning/examples/LLMs/eval_ppl.py", line 237, in main
model = get_llm(args.model, args.cache_dir)
File "/data/Torch-Pruning/examples/LLMs/eval_ppl.py", line 206, in get_llm
model = AutoModelForCausalLM.from_pretrained(
File "/usr/local/lib/python3.10/site-packages/transformers/models/auto/auto_factory.py", line 564, in from_pretrained
return model_class.from_pretrained(
File "/usr/local/lib/python3.10/site-packages/transformers/modeling_utils.py", line 4225, in from_pretrained
) = cls._load_pretrained_model(
File "/usr/local/lib/python3.10/site-packages/transformers/modeling_utils.py", line 4728, in _load_pretrained_model
new_error_msgs, offload_index, state_dict_index = _load_state_dict_into_meta_model(
File "/usr/local/lib/python3.10/site-packages/transformers/modeling_utils.py", line 993, in _load_state_dict_into_meta_model
set_module_tensor_to_device(model, param_name, param_device, **set_module_kwargs)
File "/usr/local/lib/python3.10/site-packages/accelerate/utils/modeling.py", line 358, in set_module_tensor_to_device
raise ValueError( ValueError: Trying to set a tensor of shape torch.Size([1792, 2048]) in "weight" (which has shape torch.Size([1792, 1792])), this look incorrect.
The text was updated successfully, but these errors were encountered:
非常感谢您的开源,我在qwen2-7B剪枝和精度验证过程中遇见以下问题:
----------------- After Pruning -----------------
Qwen2ForCausalLM(
(model): Qwen2Model(
(embed_tokens): Embedding(152064, 1792)
(layers): ModuleList(
(0-27): 28 x Qwen2DecoderLayer(
(self_attn): Qwen2Attention(
(q_proj): Linear(in_features=1792, out_features=2048, bias=True)
(k_proj): Linear(in_features=1792, out_features=512, bias=True)
(v_proj): Linear(in_features=1792, out_features=512, bias=True)
(o_proj): Linear(in_features=2048, out_features=1792, bias=False)
(rotary_emb): Qwen2RotaryEmbedding()
)
(mlp): Qwen2MLP(
(gate_proj): Linear(in_features=1792, out_features=9472, bias=False)
(up_proj): Linear(in_features=1792, out_features=9472, bias=False)
(down_proj): Linear(in_features=9472, out_features=1792, bias=False)
(act_fn): SiLU()
)
(input_layernorm): Qwen2RMSNorm((1792,), eps=1e-06)
(post_attention_layernorm): Qwen2RMSNorm((1792,), eps=1e-06)
)
)
(norm): Qwen2RMSNorm((1792,), eps=1e-06)
(rotary_emb): Qwen2RotaryEmbedding()
)
(lm_head): Linear(in_features=1792, out_features=152064, bias=False)
)
Qwen2Config {
"_attn_implementation_autoset": true,
"_name_or_path": "/data/yaotong/Torch-Pruning/examples/LLMs/Qwen/Qwen2-7B",
"architectures": [
"Qwen2ForCausalLM"
],
"attention_dropout": 0.0,
"bos_token_id": 151643,
"eos_token_id": 151643,
"hidden_act": "silu",
"hidden_size": 1792,
"initializer_range": 0.02,
"intermediate_size": 9472,
"max_position_embeddings": 131072,
"max_window_layers": 28,
"model_type": "qwen2",
"num_attention_heads": 16,
"num_hidden_layers": 28,
"num_key_value_heads": 4,
"rms_norm_eps": 1e-06,
"rope_scaling": null,
"rope_theta": 1000000.0,
"sliding_window": null,
"tie_word_embeddings": false,
"torch_dtype": "float16",
"transformers_version": "4.46.3",
"use_cache": true,
"use_sliding_window": false,
"vocab_size": 152064
}
1. 加载模型时报错如下:
Traceback (most recent call last):
File "/data/Torch-Pruning/examples/LLMs/eval_ppl.py", line 272, in
main()
File "/data/Torch-Pruning/examples/LLMs/eval_ppl.py", line 237, in main
model = get_llm(args.model, args.cache_dir)
File "/data/Torch-Pruning/examples/LLMs/eval_ppl.py", line 206, in get_llm
model = AutoModelForCausalLM.from_pretrained(
File "/usr/local/lib/python3.10/site-packages/transformers/models/auto/auto_factory.py", line 564, in from_pretrained
return model_class.from_pretrained(
File "/usr/local/lib/python3.10/site-packages/transformers/modeling_utils.py", line 4225, in from_pretrained
) = cls._load_pretrained_model(
File "/usr/local/lib/python3.10/site-packages/transformers/modeling_utils.py", line 4728, in _load_pretrained_model
new_error_msgs, offload_index, state_dict_index = _load_state_dict_into_meta_model(
File "/usr/local/lib/python3.10/site-packages/transformers/modeling_utils.py", line 993, in _load_state_dict_into_meta_model
set_module_tensor_to_device(model, param_name, param_device, **set_module_kwargs)
File "/usr/local/lib/python3.10/site-packages/accelerate/utils/modeling.py", line 358, in set_module_tensor_to_device
raise ValueError(
ValueError: Trying to set a tensor of shape torch.Size([1792, 2048]) in "weight" (which has shape torch.Size([1792, 1792])), this look incorrect.
The text was updated successfully, but these errors were encountered: