I am running a github code on google colab ‘https://github.com/locuslab/e2e-model-learning.git’ .When i run the power_sched>main.py file ,it gives me this error.Can you please help me in sorting this out
RuntimeError: Legacy autograd function with non-static forward method is deprecated. Please use new-style autograd function with static forward method. (Example: https://pytorch.org/docs/stable/autograd.html#torch.autograd.Function)
147 def __call__(self, *args, **kwargs):
148 raise RuntimeError(
--> 149 "Legacy autograd function with non-static forward method is deprecated. "
150 "Please use new-style autograd function with static forward method. "
151 "(Example: https://pytorch.org/docs/stable/autograd.html#torch.autograd.Function)")
I am afraid this code is several years old and was written for a very old version of pytorch. This feature (and most likely many others) are not supported anymore and you will need to update the code if you want to run it with the latest version of pytorch.
@albanD…Thanks for replying.I am new to this programming and testing this code from github. Can you please tell me what to update and how ?
Given that this code is from several versions back, it will be a bit of work to update it (even more if you don’t know pytorch) as you will need to check the BC-breaking changes in the release notes and update the code accordingly.
If you just want to run this code to try, maybe a safer alternative is to install an old version of pytorch from here https://pytorch.org/get-started/previous-versions/
Then if you decide that you want to use it further, you can spend the time to upgrade the code to run with newer versions.
Thanks a lot for your suggestion.I tried with older version too and was getting different kind of errors.
I am afraid that the errors which I will get in older versions ,whether I will be able to resolve them or not.