When finetune the 7b model, I get runtime error: The size of tensor a (65537024) must match the size of tensor b (262148096)
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 39.5k
- Forks
- 4.8k
- PR merge metrics
- No merged PRs in 30d
Description
RuntimeError: The size of tensor a (65537024) must match the size of tensor b (262148096) at non-singleton dimension 0
site-packages/torch/optim/adamw.py:273 in │
│ _single_tensor_adamw │
│ │
│ 270 │ │ param.mul_(1 - lr * weight_decay) │
│ 271 │ │ │
│ 272 │ │ # Decay the first and second moment running average coefficient │
│ ❱ 273 │ │ exp_avg.mul_(beta1).add_(grad, alpha=1 - beta1) │
│ 274 │ │ exp_avg_sq.mul_(beta2).addcmul_(grad, grad, value=1 - beta2) │
│ 275 │ │ │
│ 276 │ │ if capturable: │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
RuntimeError: The size of tensor a (65537024) must match the size of tensor b (262148096) at non-singleton dimension 0
WARNING:torch.distributed.elastic.multiprocessing.api:Sending process 38467 closing signal SIGTERM
WARNING:torch.distributed.elastic.multiprocessing.api:Sending process 38469 closing signal SIGTERM
ERROR:torch.distributed.elastic.multiprocessing.api:failed (exitcode: 1) local_rank: 1 (pid: 38468) of binary: /data/miniconda3/envs/arainmodel/bin/python
Traceback (most recent call last):
File "/data/miniconda3/envs/arainmodel/bin/torchrun", line 8, in
sys.exit(main())
File "/data/miniconda3/envs/arainmodel/lib/python3.10/site-packages/torch/distributed/elastic/multiprocessing/errors/__init__.py", line 346, in wrapper
return f(*args, **kwargs)
File "/data/miniconda3/envs/arainmodel/lib/python3.10/site-packages/torch/distributed/run.py", line 762, in main
run(args)
File "/data/miniconda3/envs/arainmodel/lib/python3.10/site-packages/torch/distributed/run.py", line 753, in run
elastic_launch(
File "/data/miniconda3/envs/arainmodel/lib/python3.10/site-packages/torch/distributed/launcher/api.py", line 132, in __call__
return launch_agent(self._config, self._entrypoint, list(args))
File "/data/miniconda3/envs/arainmodel/lib/python3.10/site-packages/torch/distributed/launcher/api.py", line 246, in launch_agent
raise ChildFailedError(
torch.distributed.elastic.multiprocessing.errors.ChildFailedError:
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the traceback at site-packages/torch/optim/adamw.py in _single_tensor_adamw and the torchrun distributed failure shown in the report. Reproduce the 7b finetuning run, identify why the optimizer state and gradient sizes differ, and document a verified resolution.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100