Lightning-AI/pytorch-lightning

Load callback states while testing.

Open

#5,542 建立於 2021年1月16日

在 GitHub 查看
 (21 留言) (0 反應) (0 負責人)Python (3,233 fork)batch import
checkpointingfeaturehelp wantedpriority: 1trainer: testtrainer: validate

倉庫指標

Star
 (26,687 star)
PR 合併指標
 (平均合併 9天 15小時) (30 天內合併 3 個 PR)

描述

🚀 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:

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:

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

貢獻者指南