DeepGraphLearning / torchdrug

A powerful and flexible machine learning platform for drug discovery
https://torchdrug.ai/
Apache License 2.0
1.43k stars 199 forks source link

Error when running the molecule generation tutorial #105

Open liusulin opened 2 years ago

liusulin commented 2 years ago

When following the molecule generation tutorial in https://torchdrug.ai/docs/tutorials/generation.html, I got the following error when running the following code to generate with the pretrained GCPNresults = task.generate(num_sample=32, max_resample=5). Here is the error message: ***/torchdrug/data/graph.py", line 1171, in _check_attribute raise ValueError("Expect node attribute%sto have shape (%d, *), but found %s" % ValueError: Expect node attributeatom_featureto have shape (64, *), but found torch.Size([32, 18]) Could you kindly check and provide any help?

joaoplay commented 2 years ago

I'm experiencing the same issue. I also tried to downgrade to Torch 1.9.0 but the issue is still occurring. Any suggestion on how to fix it? Thank you!

liusulin commented 2 years ago

I'm experiencing the same issue. I also tried to downgrade to Torch 1.9.0 but the issue is still occurring. Any suggestion on how to fix it? Thank you!

I was able to run it by downgrading TorchDrug to v0.1.2, but I didn't have enough time to find out what is the exact issue for v0.1.3. Hope this is helpful!

joaoplay commented 2 years ago

I'm experiencing the same issue. I also tried to downgrade to Torch 1.9.0 but the issue is still occurring. Any suggestion on how to fix it? Thank you!

I was able to run it by downgrading TorchDrug to v0.1.2, but I didn't have enough time to find out what is the exact issue for v0.1.3. Hope this is helpful!

@liusulin Thank you! I'm now able to run it using:

Unfortunately, v0.1.2 doesn't have an integration with Weights & Biases, as well as many other improvements already in v0.1.3. It would be great that someone could fix it :pray:

KiddoZhu commented 2 years ago

Thanks for pointing that out. It looks like a bug for v0.1.3. We will have a look at that.

joaoplay commented 2 years ago

@KiddoZhu Do you have any estimation of when the fix is available? After downgrading to v1.0.2 I got stuck in old bugs already fixed in v1.0.3. For example:

File "/usr/local/lib/python3.8/dist-packages/torchdrug/data/graph.py", line 1212, in __getitem__ if count.max() > 1: RuntimeError: max(): Expected reduction dim to be specified for input.numel() == 0. Specify the reduction dim with the 'dim' argument.

It is now fixed in v1.0.3 after you've added if self.batch_size > 0 and count.max() > 1:.

Finally, the integration with Weights & Biases is a great feature, but only available in v1.0.3. I kindly ask your effort to help in fixing the GCPN tutorial as soon as possible. It would be great if you could give some guidelines on how to fix it.

Thank you very much!

jannisborn commented 2 years ago

I believe that this issue should be fixed on current master