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

Runtime Error in graph.py #83

Closed
jannisborn opened this issue Apr 2, 2022 · 1 comment · Fixed by #84
Closed

Runtime Error in graph.py #83

jannisborn opened this issue Apr 2, 2022 · 1 comment · Fixed by #84

Comments

@jannisborn
Copy link
Contributor

During property optimization, if all molecules are invalid, the following line fails:

if count.max() > 1:

with the error:

RuntimeError: max(): Expected reduction dim to be specified for input.numel() == 0. Specify the reduction dim with the 'dim' argument.

I thought I can fix this by increasing the batch size so that always at least one molecule is valid in the batch but due to the resampling this does not work either:

19:18:53   2 / 16 molecules are invalid even after 20 resampling
19:18:53   2 / 14 molecules are invalid even after 20 resampling
19:18:53   2 / 12 molecules are invalid even after 20 resampling
19:18:54   5 / 10 molecules are invalid even after 20 resampling
19:18:54   1 / 5 molecules are invalid even after 20 resampling
19:18:54   2 / 4 molecules are invalid even after 20 resampling
19:18:54   1 / 1 molecules are invalid even after 20 resampling

Then, I would like to increase the max_resample parameter but it's hardcoded, so there is no way to control it.

versions:

  • torch: 1.11.0
  • torchdrug: 0.1.2

Fix:
The following should be more robust but do the same job:

if len(count) > 0 and max(count) > 1:
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

Successfully merging a pull request may close this issue.

2 participants