Lightning-AI / Lightning-AI/pytorch-lightning

LightingModel.save_checkpoint()

Open
#21,280 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

checkpointing feature
Dominant language
Python
Stars
31.4k
Forks
3.8k
Avg merge
6d 7h
Merged PRs (30d)
6

Description

### Description & Motivation

Allow Lightning model to save a checkpoint, that you can load with load_from_checkpoint.

### Pitch

I have encountered this issue several times, as I try to switch to Lightning, it is not simple to take old checkpoints from native pytorch and run them on the new code (for testing/comparison purposes for examples)
I tried to make a model, then load LightningModel.Model with the weights, but then if I want to save it, I need to run a full mock training which isn't handy or practical.

### Alternatives

You could have a simple attach method on the trainer to attach a model without having to use Fit/Test/predict etc... and requiring arguments. Which would be a good alternative.

### Additional context

_No response_

cc @lantiga @borda

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 existing load_from_checkpoint path and how a Lightning model is currently constructed from native PyTorch weights. Define the checkpoint-saving entry point from the issue's requested behavior; done means a model can save a checkpoint that load_from_checkpoint can load without running mock training.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.