openkinome / experiments-binding-affinity

6 stars 9 forks source link

Graph Convolutional Neural Network #9

Open t-kimber opened 3 years ago

t-kimber commented 3 years ago

Ligand-based model

Graph

Featurization:

Model:

ijpulidos commented 11 months ago

I believe this is the place to report updates with issues in the experiments/001_example-ligand-only-graph-subset.py, please correct me if I'm wrong and I can raise a new issue if needed.

When trying to build and run the mode I'm facing the current issue:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[10], line 8
      6     a_dataloader = dataloaders[next(iter(dataloaders.keys()))]["train"]
      7     x_sample, _ = next(iter(a_dataloader))
----> 8     MODEL_KWARGS["input_shape"] = ModelCls.estimate_input_shape(x_sample)
     10 nn_model = ModelCls(**MODEL_KWARGS)
     12 optimizer = import_object(OPTIMIZER)(nn_model.parameters(), **OPTIMIZER_KWARGS)

File ~/workdir/repos/kinoml/kinoml/ml/torch_geometric_models.py:34, in GraphConvolutionNeuralNetwork.estimate_input_shape(input_sample)
     31 @staticmethod
     32 def estimate_input_shape(input_sample):
     33     # Take the first batch [0]
---> 34     return input_sample[0].num_node_features

AttributeError: 'Tensor' object has no attribute 'num_node_features'

Which seems to suggest that it's expecting a torch.geometric.Data object instead of a Tensor one.