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

Megnet & NMPN error using Custom dataset #37

Closed
thegodone opened this issue Dec 1, 2021 · 14 comments
Closed

Megnet & NMPN error using Custom dataset #37

thegodone opened this issue Dec 1, 2021 · 14 comments

Comments

@thegodone
Copy link
Contributor

thegodone commented Dec 1, 2021

Traceback (most recent call last):
File "GCN-keras.py", line 213, in
dataloader = NumpyTensorList(*[getattr(dataset, x['name']) for x in hyper['model']['inputs']])
File "/Users/itetko/anaconda3/lib/python3.8/site-packages/kgcnn-1.1.2-py3.8.egg/kgcnn/io/loader.py", line 34, in init
File "/Users/itetko/anaconda3/lib/python3.8/site-packages/kgcnn-1.1.2-py3.8.egg/kgcnn/io/loader.py", line 37, in _length_test
File "/Users/itetko/anaconda3/lib/python3.8/site-packages/kgcnn-1.1.2-py3.8.egg/kgcnn/io/loader.py", line 37, in
TypeError: object of type 'NoneType' has no len()

I use the last version of the code 1.1.2 Master bug got an error.

I don't see this error with GraphSage, GAT, GATv2 models parameter

@thegodone thegodone changed the title GCN error using Custom dataset GCN & DimeNetPP error using Custom dataset Dec 1, 2021
@thegodone thegodone reopened this Dec 1, 2021
@thegodone thegodone changed the title GCN & DimeNetPP error using Custom dataset GCN & DimeNetPP & Megnet error using Custom dataset Dec 1, 2021
@thegodone
Copy link
Contributor Author

I use this data preparation script

image

@PatReis
Copy link
Collaborator

PatReis commented Dec 1, 2021

The error means that the name of the input layer does not have a property set in the dataset. For DimeNetPP it is angle_indices for sure. so you also need
dataset.set_angle()
But I should write something to that also the name is printed in the error message, otherwise we would not know what it was...

@PatReis
Copy link
Collaborator

PatReis commented Dec 1, 2021

ah for GCN its edge_weights I guess
the can be set for the dataset via normalize_edge_weights_sym()

@thegodone
Copy link
Contributor Author

thegodone commented Dec 1, 2021 via email

@PatReis
Copy link
Collaborator

PatReis commented Dec 1, 2021

for megnet it is probably the name="graph_number" but that can be replaces with "graph_attributes" for the inputs of the model paramters MegNet needs a graph tensor as state or graph input feature.

@thegodone
Copy link
Contributor Author

Thanks for the tips, I was able to run GCN and DimenetPP models now. But I still don't know what to do with the Megnet code. Cause I don't see in the repo where to set the graph_attributes in the features of my custom dataset.

@PatReis
Copy link
Collaborator

PatReis commented Dec 2, 2021

oh sorry, I meant in the hyper parameters for input there is
"inputs": [ {"shape": [None], "name": "node_number", "dtype": "float32", "ragged": True}, {"shape": [None, 3], "name": "node_coordinates", "dtype": "float32", "ragged": True}, {"shape": [None, 2], "name": "range_indices", "dtype": "int64", "ragged": True}, {"shape": [2], "name": "graph_attributes", "dtype": "float32", "ragged": False} ],
And when there is a not a graph_attributes then this could be a problem.

@thegodone
Copy link
Contributor Author

thegodone commented Dec 2, 2021 via email

@thegodone thegodone changed the title GCN & DimeNetPP & Megnet error using Custom dataset Megnet & NMPN error using Custom dataset Dec 3, 2021
@thegodone
Copy link
Contributor Author

thegodone commented Dec 3, 2021

I remove graph_attributes part from the hyper json but got another error

image

my settings:

image

image

@PatReis
Copy link
Collaborator

PatReis commented Dec 3, 2021

No No sorry, you can not remove it. MegNet needs graph attributes. I meant if in place of graph_attributes there is something like graph_size or graph_number (which is not set, then there will be a Problem.) But graph_attributes should be set automatically.

@PatReis
Copy link
Collaborator

PatReis commented Dec 3, 2021

Can you put this before the dataloader part and run again?

for x in hyper['model']['inputs']:
    if not hasattr(dataset, x['name']):
        print("ERROR: Dataset does not has information on %s" % x['name'])

@PatReis
Copy link
Collaborator

PatReis commented Dec 3, 2021

I will make a method to the dataset base class like process_hyper

@PatReis PatReis closed this as completed Dec 3, 2021
@PatReis PatReis reopened this Dec 3, 2021
@thegodone
Copy link
Contributor Author

this is really an excellent idea to avoid mistake between data process and architectude needs dependencies.

@thegodone
Copy link
Contributor Author

thegodone commented Dec 3, 2021

by using this part in the "json":
{"shape": [2], "name": "graph_attributes", "dtype": "float32", "ragged": False}
fix the issue, I use version master of the morning before our new modifications.

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

No branches or pull requests

2 participants