Lightning-AI / Lightning-AI/pytorch-lightning

How do I continue to train the model but for different tasks?

Open
#17,797 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

### Bug description

I have obtained a model named last.ckpt by using lightning training. I want to continue training this model. The structure of the model remains unchanged, but the training task has changed, so the hyperparameters have also changed. But when I tried to use resume_from_checkpoint in Trainer, it reported an error and asked me that the hyperparameters for both training tasks needed to be the same.
I want to know how I can apply the trained model to training for other tasks.

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

v1.6

### How to reproduce the bug

_No response_

### Error messages and logs

_No response_

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

cc @justusschock @awaelchli

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 v1.6 Trainer documentation for resume_from_checkpoint and the checkpoint-loading API, using last.ckpt as the example. Determine whether the intended workflow is resuming training or loading model weights for a new task, and verify how changed hyperparameters are handled. Done means confirming or documenting the supported procedure.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.