chengtan9907 / OpenSTL

OpenSTL: A Comprehensive Benchmark of Spatio-Temporal Predictive Learning
https://openstl.readthedocs.io/en/latest/
Apache License 2.0
730 stars 113 forks source link

Loading from checkpoint? #141

Open jamesafranke opened 3 months ago

jamesafranke commented 3 months ago

Hi - Thanks so much for the amazing package.

Is there any easy way to load a checkpoint so that I can do inference with the trained model. Something like:

.
.
exp = BaseExperiment(args, dataloaders=(dataloader_train, dataloader_val, dataloader_test), strategy='ddp')
PATH = './checkpoints/best.ckpt'
exp.load_from_checkpoint(PATH)

exp.eval()
y_hat = exp(x)

Thanks in advance!

chengtan9907 commented 2 months ago

If you're using the PyTorch Lightning, you can refer to this document: Saving and loading checkpoints