Lightning-AI / Lightning-AI/pytorch-lightning

Resume training, how to change learning scheduler?

Open
#19,865 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

lr scheduler question ver: 2.2.x
Dominant language
Python
Stars
31.4k
Forks
3.8k
Avg merge
6d 7h
Merged PRs (30d)
6

Description

### Bug description

I used the cosine learning scheduler in my first round training and after reaching the set max steps, I stopped the training. And now I need to restart the training and replace the learning rate scheduler with a new one because if I don't, the learning rate should always be 0. My question is how to restarting the training with a new learning rate scheduler?

I just replace a new learning rate scheduler in` def configure_optimizers()` and then set last checkpoint in` trainer.fit()`?

Thanks so much !

JJ

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

master

### How to reproduce the bug

_No response_

### Error messages and logs

```
# Error messages and logs here please
```

### 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

Start by reviewing the configure_optimizers() entry point and the trainer.fit() checkpoint-resume usage described in the issue. Determine whether changing the learning-rate scheduler during resumed training is supported, and document the confirmed procedure or limitations with a reproducible example.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.