Facing issue while running my python code with "meta-llama/Llama-3.1-8B-Instruct"
Hello,
I'm unable to load the Llama-3.1-8B-Instruct model locally because the model files I downloaded in my folder are mismatched or corrupted, causing tensor shape errors.
Path I downloaded the files from : "https://huggingface.co/meta-llama/Llama-3.1-8B-Instruct/tree/main"
I have already tried downloading from HuggingFace, but the error persists, indicating the files are still not matching the model architecture.
Furthermore, I need a set of verified, complete, and matching model files for successful offline loading.
I have model downloaded in path: C:/models/Llama-3.1-8B-Instruct
Attached my check.py file for reference.
Trace:
Traceback (most recent call last):
File "C:\Users\Public\Workspace\Python\llama\check.py", line 13, in
model = AutoModelForCausalLM.from_pretrained(model_path)
File "C:\Users\xxxx\AppData\Roaming\Python\Python39\site-packages\transformers\models\auto\auto_factory.py", line 484, in from_pretrained
return model_class.from_pretrained(
File "C:\Users\xxxx\AppData\Roaming\Python\Python39\site-packages\transformers\modeling_utils.py", line 2881, in from_pretrained
) = cls._load_pretrained_model(
File "C:\Users\xxxx\AppData\Roaming\Python\Python39\site-packages\transformers\modeling_utils.py", line 3278, in _load_pretrained_model
raise RuntimeError(f"Error(s) in loading state_dict for {model.class.name}:\n\t{error_msg}")
RuntimeError: Error(s) in loading state_dict for LlamaForCausalLM
.
.
.
.
size mismatch for model.layers.31.self_attn.v_proj.weight: copying a param with shape torch.Size([1024, 4096]) from checkpoint, the shape in current model is torch.Size([4096, 4096]).
You may consider adding ignore_mismatched_sizes=True in the model from_pretrained method.
Please help me to address this issue.
Thanks In Advance.