Lightning-AI / Lightning-AI/pytorch-lightning

Lr_finder enconters an error when using dual GPU

Open
#19,611 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug tuner ver: 2.1.x
Dominant language
Python
Stars
31.4k
Forks
3.8k
Avg merge
6d 7h
Merged PRs (30d)
6

Description

### Bug description

an error happened when using two gpu training in the best initial lr finding process, and the training process can be finished normally. It is clear that no so much i can modify in the tuner, thus i suspect this as a BUG

### What version are you seeing the problem on?

v2.1

### How to reproduce the bug

```python
if not boolean_transfer(hparams.fast_dev_run):
print(colored('==============','blue')+"Looking for best lr"+colored('==================-','blue'))
tuner = Tuner(trainer)
lr_finder = tuner.lr_find(model,train_loader,val_loader)
new_lr = lr_finder.suggestion()
optimizer = model.configure_optimizers()
update_model(optimizer,new_lr,hparams.milestones)
if boolean_transfer(hparams.plot_lr):
fig = lr_finder.plot(suggest=True,show= False)
fig.savefig('lr_plot.png')
```

### Error messages and logs

```
Tensor must be CUDA and dense
```

### Environment

Current environment

```
#- Lightning Component (e.g. Trainer, LightningModule, LightningApp, LightningWork, LightningFlow):
#- PyTorch Lightning Version (e.g., 1.5.0):
#- Lightning App Version (e.g., 0.5.2):
#- PyTorch Version (e.g., 2.0):
#- Python version (e.g., 3.9):
#- OS (e.g., Linux):
#- CUDA/cuDNN version:
#- GPU models and configuration:
#- How you installed Lightning(`conda`, `pip`, source):
#- Running environment of LightningApp (e.g. local, cloud):
```

### More info

_No response_

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

Reproduce the issue through Tuner.lr_find with the two-GPU training setup shown in the report, then trace where the “Tensor must be CUDA and dense” error originates. Done means dual-GPU learning-rate finding completes successfully and a regression test covers this configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
distributed-systems, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.