chengtan9907 / OpenSTL

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

How to inference by ckpt #125

Closed moonstarsky37 closed 7 months ago

moonstarsky37 commented 7 months ago

Thank you for your repo. After going through your tutorial.ipynb, I've trained my own model with my datasets and generate the corresponding ckpt.

However, if I want to use the results of ckpt directly to predict new input without going through the training process, what should I do?

1998cj commented 7 months ago

hello can you tell me you solved it?

moonstarsky37 commented 7 months ago

@1998cj I'm not quite sure what you mean by what you just said. If you're asking how I converted my own data to be compatible with executing tutorial.ipynb, all I did was run his program once to check what the shape of his training, validation, and testing dataset should be. Then, I simply reshaped my dataset to match that shape.

However, if you're asking about how to use the trained model's checkpoint, I'm still waiting for a response.

chengtan9907 commented 7 months ago

We are sorry that the current lightning version does not have such a feature. For a quick response, you can use the load_from_checkpoint when initialize self.method(openstl/api/exp.py#L37). You may refer to the Lightning's official document: Lightning/checkpont_basic.

moonstarsky37 commented 7 months ago

@chengtan9907 Thank you for your response. I originally thought I might have missed some information, but it turns out I have already prepared a version that can be used directly.

Additionally, I've noticed other issues regarding the installation of Torch-related packages through Conda, as the versions may not always follow the expected rules. Consequently, if the installation involves settings of training parameters like:

'sched': 'cosine'

errors occur. 圖片

I haven't found a simple fix for this yet. If possible, I would appreciate it if you could provide the versions of all the dependent packages that you are able to run, as part of the installation information.

oduinihao commented 7 months ago

@moonstarsky37 Hello,Nice to meet you! I have solve this issue by adding commit a6e0dd3 already deleted function: def lr_scheduler_step(self, scheduler, *args, **kwargs): scheduler.step(epoch=self.current_epoch) in openstl/methods/base_method.py By the way, if you are using scheduler like onecycle, plese delete this function or your learn rate won`t update.

moonstarsky37 commented 7 months ago

@oduinihao Thank you for letting me know. I was quite busy recently and didn't see this notice. I will test it out in the next few days. Thank you again for your response and suggestions.

moonstarsky37 commented 7 months ago

Since the author has responded to the issue I initially opened. I developed the related code myself, it should be okay to close this issue now.