Make QSAR model with PyG and pytorch2.0 #RDKit #Chemoinfo

Recently, I updated version of pytorch on my env from 1.x to 2.0.

I think it’s worth to update because, original site says….


Today, we announce torch.compile, a feature that pushes PyTorch performance to new heights and starts the move for parts of PyTorch from C++ back into Python. We believe that this is a substantial new direction for PyTorch – hence we call it 2.0. torch.compile is a fully additive (and optional) feature and hence 2.0 is 100% backward compatible by definition.

Underpinning torch.compile are new technologies – TorchDynamo, AOTAutograd, PrimTorch and TorchInductor.

And also, pytorch_geometric supports pytorch2.0. Previously I worte blog post about building QSAR model with PyG. Old version of PyG didn’t support graph from molecule. So I wrote my own function to do that. But recent version of PyG has the function!

You can check the details on the official documentation.

I have interest the new version of pyg and pytorch. So I rewrote the my code with new packages.

The code is shown below.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

By using compiled model, I got many worning masseges but it worked and got almost same figure to previous post.

This is first trial of using new version of pyg and pytorch for me. I would like to dive more deeply into the packages as soon as possible.


Published by iwatobipen

I'm medicinal chemist in mid size of pharmaceutical company. I love chemoinfo, cording, organic synthesis, my family.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: