Lightning-AI / Lightning-AI/litgpt

Stuck on model forward with 100% GPU-Util

Open
#847 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
13.7k
Forks
1.5k
Avg merge
15h 37m
Merged PRs (30d)
1

Description

When I run finetune/adapter.py with my dataset with almost no modification (with devices=2), the code stuck on `logits = model(input_ids, lm_head_chunk_size=128)`(https://github.com/Lightning-AI/lit-gpt/blob/main/finetune/adapter.py#L157C13-L157C62), the `model ()` call nerver finish but GPU-Util is always 100%.

The process even can't be terminated with `Ctrl-C`

After replacing `validate(fabric, model, val_data, tokenizer, max_iters=2)`(https://github.com/Lightning-AI/lit-gpt/blob/main/finetune/adapter.py#L137) with `model.train()`, output error log with following:
```
torch.utils.checkpoint.CheckpointError: torch.utils.checkpoint: A different number of tensors was saved during the original forward and recomputation.
Number of tensors saved during forward: 49
Number of tensors saved during recomputation: 47
raise CheckpointError(
torch.utils.checkpoint.CheckpointError: torch.utils.checkpoint: A different number of tensors was saved during the original forward and recomputation.
Number of tensors saved during forward: 49
Number of tensors saved during recomputation: 47
```

The script param I used to run is:
```
python finetune/adapter.py \
--data_dir data/xxx \
--checkpoint_dir checkpoints/meta-llama/Llama-2-7b-chat-hf \
--out_dir out/adapter/xxx
```

Any tips will be appreciated.

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 with finetune/adapter.py at the validation call around line 137 and the model forward at line 157, using the provided two-device command and dataset setup. Reproduce the hang, then compare it with the reported torch.utils.checkpoint.CheckpointError; done means validation completes normally and the process can be interrupted without the forward remaining stuck.

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
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.