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

[BUG] Pytorch module hooks are not executed #244

Closed
abhaybd opened this issue Dec 1, 2022 · 1 comment
Closed

[BUG] Pytorch module hooks are not executed #244

abhaybd opened this issue Dec 1, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@abhaybd
Copy link

abhaybd commented Dec 1, 2022

Describe the bug
I'm trying to debug some issues during online training (using fit_online) using pytorch hooks, but these hooks are not being executed. Looking at the code, policies are explicitly calling self.forward() like this. Directly calling self.forward() doesn't execute any hooks (see this post), so __call__() should be used instead. So self.forward() should be replaced with self().

To Reproduce

  1. Register a hook with the policy module, e.g. algo._impl.policy.register_module_forward_pre_hook(hook)
  2. Train with algo.fit_online(...)
  3. Observe that the hook is never invoked

Expected behavior
The registered hooks should be executed.

Additional context
N/A.

@abhaybd abhaybd added the bug Something isn't working label Dec 1, 2022
@takuseno
Copy link
Owner

Thanks for the issue. This issue has been resolved in the latest master branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants