THUDM / THUDM/slime

size not match error after many training steps

Open
#1,076 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
8.5k
Forks
1.3k
Avg merge
5h 36m
Merged PRs (30d)
22

Description

https://github.com/THUDM/slime/blob/6986c4698ada539e42eb258afbc22d6c70656b76/slime/backends/megatron_utils/loss.py#L296

After many training steps, the below error often occurs:
RuntimeError: The size of tensor a (6236) must match the size of tensor b (8192) at non-singleton dimension 0
I even add the below code to ensure their size is the same:
student_log_probs = [s_log_prob[-response_length:] for s_log_prob, response_length in zip(student_log_probs, response_lengths)]
so what are the possible reasons? Has anyone else encountered the same problem?

Contributor guide

Open the contributing guide

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 at slime/backends/megatron_utils/loss.py around line 296 and inspect how student_log_probs and response_lengths are produced before the failing tensor operation. Reproduce the mismatch after extended training, trace the differing lengths, and document or fix the cause so the tensors remain compatible.

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
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.