Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work in torch.inference_mode()? #655

Open
LyuJZ opened this issue Aug 16, 2024 · 3 comments
Open

Doesn't work in torch.inference_mode()? #655

LyuJZ opened this issue Aug 16, 2024 · 3 comments

Comments

@LyuJZ
Copy link

LyuJZ commented Aug 16, 2024

❓ Questions and Help

Hi, thanks a lot this amazing work.

I am integrating the theseus layer to actor-critic framework. However, the theseus layer seems doesn't work under the with torch.inference_mode(): condition. It can only work under the with torch.no_grad(): condition.

Could you give me any explanations about this?

@luisenp
Copy link
Contributor

luisenp commented Aug 17, 2024

Hi @LyuJZ. I apologize, but we never tested with torch.inference_mode(). Could you share more details of the error you are getting?

@LyuJZ
Copy link
Author

LyuJZ commented Aug 17, 2024

Hi @luisenp , that's all right!
In the torch.inference_mode(), there are no errors. However, from the output of layer.forward(input_dict, optimizer_kwargs={"track_best_solution": True, "verbose": True, "ellipsoidal_damping": True}), it says there are only two iteration steps, and the total loss doesn't decrease at tall.

If I use with torch.no_grad():, the log information says that there are several iteration steps, and the total loss is decreasing consistently.

@luisenp
Copy link
Contributor

luisenp commented Sep 11, 2024

Sorry for the delay, somehow I never got notified about this response. Unfortunately, I'm not too familiar with torch.inference_mode() so I don't have a good idea of what can be causing this. Is this issue blocking your progress when using Theseus?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants