Lightning-AI / Lightning-AI/pytorch-lightning

Load callback states while testing.

Open
#5,542 21 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

checkpointing feature help wanted priority: 1 trainer: test trainer: validate
Dominant language
Python
Stars
31.4k
Forks
3.8k
Avg merge
6d 7h
Merged PRs (30d)
6

Description

## 🚀 Feature
Load callback states while testing.

### Motivation
https://github.com/PyTorchLightning/pytorch-lightning/pull/5161#issuecomment-759083492

### Pitch
Two possible API changes:

with an additional argument `restore_states`:
```python
test(ckpt_path, restore_states=True/False) # give an option whether to load states or not
test(model, ckpt_path, restore_states=True/False) # same as above but will just load checkpoint states and not the model

# raise an error
test(ckpt_path=None, restore_states=True)
```
or without any additional argument:
```python
test(ckpt_path) # always load states
test(ckpt_path=None) # don't load any states.
test(model, ckpt_path) # reload checkpoint states only from ckpt_path
```

### Alternatives
Alternatively, one can just reload checkpoints manually, call `on_load_checkpoint` for all the callbacks manually, and test.

PS: There may be a better solution. Open to suggestions :)
cc: @ananthsub

cc @borda @awaelchli @ananthsub @ninginthecloud @rohitgr7 @tchaton @akihironitta

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

No implementation files or tests are named. Start by reviewing the linked pull request discussion and the proposed test API alternatives, then establish which checkpoint and callback-state behavior is intended. Done means the API choice is settled and callback states load during testing with defined behavior for each shown call form.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning, testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.