google-deepmind / graph_nets

Build Graph Nets in Tensorflow
https://arxiv.org/abs/1806.01261
Apache License 2.0
5.34k stars 783 forks source link

AttributeError: module 'sonnet' has no attribute 'AbstractModule' #138

Closed dmagee closed 3 years ago

dmagee commented 3 years ago

I'm getting this error running the demo. Google suggests this was removed in Sonnet 2 (TF2), and replaced by Module (see comment half way down here https://github.com/deepmind/sonnet/issues/128). Full error:

2021-02-25 13:58:31.737640: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudart64_110.dll Traceback (most recent call last): File "models.py", line 44, in class MLPGraphIndependent(snt.AbstractModule): AttributeError: module 'sonnet' has no attribute 'AbstractModule'

seanjparker commented 3 years ago

I ran into this problem as well. As you noted, AbstractModule was removed in Sonnet 2. You should be able to manually fix the error using this solution from the thread you linked.

alvarosg commented 3 years ago

Thanks for your message. Which demo are you running, the TF1 or the TF2 demo?

This error seems to indicate that you are running the TF1 demos, but you have a Sonnet 2 installation (TF1 demos require "dm-sonnet<2"). If you are planning to use TF2 and Sonnet 2, I would recommend looking at the TF2 demos instead.

This PR could be useful too #119

alvarosg commented 3 years ago

(closing due to inactivity)