XieResearchGroup / Physics-aware-Multiplex-GNN

Code for our Nature Scientific Reports paper "A universal framework for accurate and efficient geometric deep learning of molecular systems"
https://www.nature.com/articles/s41598-023-46382-8
54 stars 11 forks source link

Encountered an in-place operation error when using the PAMNet model #4

Closed lfcdepression closed 4 months ago

lfcdepression commented 4 months ago

I have encountered an error while using the PAMNet model for RNA structure prediction. Specifically, the error occurred when executing the following line of code:


torch.arange(1, self.freq.numel() + 1, out=self.freq).mul_(PI)

The program threw the following error:
RuntimeError: a leaf Variable that requires grad is being used in an in-place operation.

I have consulted the relevant documentation but still cannot resolve this issue. Could you please advise on how to modify the code to avoid this error?
zetayue commented 4 months ago

I think it should be related to this: https://github.com/pyg-team/pytorch_geometric/pull/4424. I haven't encountered this error before, but you can try the following code to replace the previous one: https://github.com/pyg-team/pytorch_geometric/blob/c15421387b8049f32cae6967a9f8e77a03ff56b5/torch_geometric/nn/models/dimenet.py#L63-L66

lfcdepression commented 4 months ago

Thanks for your reply! The code runs normally after replacing.I think it's because the version is different, I'm using a different version than the one in requirement.txt