Lightning-AI / Lightning-AI/lit-llama

【solved】use adpater_v2.py fine-tuning llama 13B error

Open
#405 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
6.1k
Forks
517
PR merge metrics
No merged PRs in 30d

Description

when i use alpaca data to fine-tuning llama13B on 4*A100 80GB GPU, i got the following erroes:
```
RuntimeError: Error(s) in loading state_dict for LLaMA:
size mismatch for lm_head.weight: copying a param with shape torch.Size([32000, 5120]) from checkpoint, the shape in current model is torch.Size([32000, 4096]).
size mismatch for transformer.wte.weight: copying a param with shape torch.Size([32000, 5120]) from checkpoint, the shape in current model is torch.Size([32000, 4096]).
size mismatch for transformer.h.0.rms_1.scale: copying a param with shape torch.Size([5120]) from checkpoint, the shape in current model is torch.Size([4096]).
size mismatch for transformer.h.0.attn.c_attn.weight: copying a param with shape torch.Size([15360, 5120]) from checkpoint, the shape in current model is torch.Size([12288, 4096]).
size mismatch for transformer.h.0.attn.c_proj.weight: copying a param with shape torch.Size([5120, 5120]) from checkpoint, the shape in current model is torch.Size([4096, 4096]).
size mismatch for transformer.h.0.rms_2.scale: copying a param with shape torch.Size([5120]) from checkpoint, the shape in current model is torch.Size([4096]).
size mismatch for transformer.h.0.mlp.c_fc1.weight: copying a param with shape torch.Size([13824, 5120]) from checkpoint, the shape in current model is torch.Size([11008, 4096]).
size mismatch for transformer.h.0.mlp.c_fc2.weight: copying a param with shape torch.Size([13824, 5120]) from checkpoint, the shape in current model is torch.Size([11008, 4096]).
size mismatch for transformer.h.0.mlp.c_proj.weight: copying a param with shape torch.Size([5120, 13824]) from checkpoint, the shape in current model is torch.Size([4096, 11008]).
size mismatch for transformer.h.1.rms_1.scale: copying a param with shape torch.Size([5120]) from checkpoint, the shape in current model is torch.Size([4096]).
size mismatch for transformer.h.1.attn.c_attn.weight: copying a param with shape torch.Size([15360, 5120]) from checkpoint, the shape in current model is torch.Size([12288, 4096]).
size mismatch for transformer.h.1.attn.c_proj.weight: copying a param with shape torch.Size([5120, 5120]) from checkpoint, the shape in current model is torch.Size([4096, 4096]).
size mismatch for transformer.h.1.rms_2.scale: copying a param with shape torch.Size([5120]) from checkpoint, the shape in current model is torch.Size([4096]).
size mismatch for transformer.h.1.mlp.c_fc1.weight: copying a param with shape torch.Size([13824, 5120]) from checkpoint, the shape in current model is torch.Size([11008, 4096]).
size mismatch for transformer.h.1.mlp.c_fc2.weight: copying a param with shape torch.Size([13824, 5120]) from checkpoint, the shape in current model is torch.Size([11008, 4096]).
size mismatch for transformer.h.1.mlp.c_proj.weight: copying a param with shape torch.Size([5120, 13824]) from checkpoint, the shape in current model is torch.Size([4096, 11008]).
size mismatch for transformer.h.2.rms_1.scale: copying a param with shape torch.Size([5120]) from checkpoint, the shape in current model is torch.Size([4096]).
size mismatch for transformer.h.2.attn.c_attn.weight: copying a param with shape torch.Size([15360, 5120]) from checkpoint, the shape in current model is torch.Size([12288, 4096]).
size mismatch for transformer.h.2.attn.c_proj.weight: copying a param with shape torch.Size([5120, 5120]) from checkpoint, the shape in current model is torch.Size([4096, 4096]).
```

i'm sure i download the right version of llama13B, and i use the convert_hf_checkpoint.py to convert xx.bin to xx.ph

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with adapter_v2.py and convert_hf_checkpoint.py, then compare the converted checkpoint's tensor shapes with the LLaMA 13B model configuration. Reproduce the state_dict loading error if possible; the issue provides no confirmed fix or clear completion criteria, and its title says it is solved.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
15/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.