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

Error computing embeddings #4

Closed
tkram01 opened this issue Apr 13, 2022 · 1 comment
Closed

Error computing embeddings #4

tkram01 opened this issue Apr 13, 2022 · 1 comment

Comments

@tkram01
Copy link

tkram01 commented Apr 13, 2022

When running the compute_embedding.py I get this error.

Using backend: pytorch
Downloading gin_supervised_contextpred_pre_trained.pth from https://data.dgl.ai/dgllife/pre_trained/gin_supervised_contextpred.pth...
Pretrained model loaded
Total data:  172988
  0%|                                                                                                                                                                                                            | 0/172988 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "/home/ec2-user/SynNet/scripts/compute_embedding.py", line 143, in <module>
    embeddings.append(model(smi))
  File "/home/ec2-user/miniconda3/envs/rdkit/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl
    return forward_call(*input, **kwargs)
TypeError: forward() missing 2 required positional arguments: 'categorical_node_feats' and 'categorical_edge_feats'

When trying to run the compute_embedding_mp.py I get the following error

Using backend: pytorch
Downloading gin_supervised_contextpred_pre_trained.pth from https://data.dgl.ai/dgllife/pre_trained/gin_supervised_contextpred.pth...
Pretrained model loaded
Total data:  172988
Traceback (most recent call last):
  File "/home/ec2-user/SynNet/scripts/compute_embedding_mp.py", line 29, in <module>
    embeddings = pool.map(gin_embedding, data)
NameError: name 'gin_embedding' is not defined

I think this can be resolved by changing gin_embedding to model but that then results in the above error.

@rociomer
Copy link
Collaborator

This has now been fixed. To summarize the problem, the 'model()' should have been replaced by the 'mol_embedding()' function (which creates the GIN embeddings from the pretrained model). I have replaced it now with the right function names, and moved this and related functions to syn_net/utils/predict_utils.py, as the mol_embedding() function is used by both scripts/compute_embedding.py and scripts/compute_embedding_mp.py

rociomer pushed a commit that referenced this issue Oct 12, 2022
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