nyu-dl / dl4chem-mgm

BSD 3-Clause "New" or "Revised" License
69 stars 10 forks source link

Code example (Generation QM9) TypeError #8

Closed Shunyang2018 closed 1 year ago

Shunyang2018 commented 2 years ago

Hi, I tired to run the example code under Generation QM9:

https://github.com/nyu-dl/dl4chem-mgm/blob/master/README.md#qm9-2

I just copy and paste all previous commands, and got error as:

2022-07-08 10:11:21.644672: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libnvinfer.so.6'; dlerror: libnvinfer.so.6: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /home/shunyang/intel/oneapi/compiler/2022.0.2/linux/lib:/home/shunyang/intel/oneapi/compiler/2022.0.2/linux/lib/x64:/home/shunyang/intel/oneapi/compiler/2022.0.2/linux/compiler/lib/intel64_lin
2022-07-08 10:11:21.644747: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libnvinfer_plugin.so.6'; dlerror: libnvinfer_plugin.so.6: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /home/shunyang/intel/oneapi/compiler/2022.0.2/linux/lib:/home/shunyang/intel/oneapi/compiler/2022.0.2/linux/lib/x64:/home/shunyang/intel/oneapi/compiler/2022.0.2/linux/compiler/lib/intel64_lin
2022-07-08 10:11:21.644765: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:30] Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.
  0%|                                                                                                                                                                                 | 0/400 [00:00<?, ?it/s]Generator length: 8
  0%|                                                                                                                                                                                   | 0/8 [00:04<?, ?it/s]
  0%|                                                                                                                                                                                 | 0/400 [00:04<?, ?it/s]
Traceback (most recent call last):
  File "generate.py", line 115, in <module>
    main(params)
  File "generate.py", line 110, in main
    params.evaluate_connected_only)
  File "/mnt/c/Users/Study/Documents/GitHub/dl4chem-mgm/src/model/graph_generator.py", line 158, in generate_with_evaluation
    smiles_list = self.carry_out_iteration(loader, use_argmax)
  File "/mnt/c/Users/Study/Documents/GitHub/dl4chem-mgm/src/model/graph_generator.py", line 199, in carry_out_iteration
    graph_properties, binary_graph_properties, use_argmax)
  File "/mnt/c/Users/Study/Documents/GitHub/dl4chem-mgm/src/model/graph_generator.py", line 257, in sample_simultaneously
    binary_graph_properties)
  File "/mnt/c/Users/Study/Documents/GitHub/dl4chem-mgm/src/model/graph_generator.py", line 274, in model_forward_mgm
    return self.model(batch_init_graph, graph_properties, binary_graph_properties)
  File "/home/shunyang/miniconda3/envs/ame/lib/python3.7/site-packages/torch/nn/modules/module.py", line 532, in __call__
    result = self.forward(*input, **kwargs)
  File "/mnt/c/Users/Study/Documents/GitHub/dl4chem-mgm/src/model/gnn.py", line 183, in forward
    batch_init_graph = self.calculate_embeddings(batch_init_graph, graph_properties, binary_graph_properties)
  File "/mnt/c/Users/Study/Documents/GitHub/dl4chem-mgm/src/model/gnn.py", line 138, in calculate_embeddings
    batch_graph.batch_num_nodes())
TypeError: 'list' object is not callable

Could you please help me solve this problem? Thank you! Shunyang

anamika-yadav99 commented 1 year ago

Hi @Shunyang2018 I'm getting the same error . Were you able run it?

omarnmahmood commented 1 year ago

Depending on the version of dgl, batch_num_nodes is either a list or a method that returns a list. If you are getting this error, you are most likely using a version in which it is a list, so you can remove the parentheses at the end and this should resolve the problem i.e. use batch_graph.batch_num_nodes instead of batch_graph.batch_num_nodes()