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

Issues using Sonnet #261

Open
MoxyFoxy opened this issue Jan 16, 2023 · 3 comments
Open

Issues using Sonnet #261

MoxyFoxy opened this issue Jan 16, 2023 · 3 comments

Comments

@MoxyFoxy
Copy link

Hello,

I'm having an issue attempting to run a project dependent on Sonnet (more specifically, the DeepMind DNC implementation). I'm getting the error:

Traceback (most recent call last):
  File "PATH\src\dnc_model.py", line 7, in <module>
    from dnc import dnc
  File "PATH\libs\dnc\dnc\dnc.py", line 27, in <module>
    import sonnet as snt
  File "C:\Users\USER\AppData\Local\Programs\Python\Python39\lib\site-packages\sonnet\__init__.py", line 2, in <module>
    from graphs import Sonnet, D3Graph, MatplotGraph
ModuleNotFoundError: No module named 'graphs'

Thinking that maybe I'm missing a package, I did the next obvious thing and ran pip install graphs (which I felt is not the solution, that graphs must be an internal package of sorts, but I still gave it a shot) and got the error ImportError: cannot import name 'Sonnet' from 'graphs'

I thought that maybe the version on pip is outdated, and it seems like it is. I then attempted to download the source code and run pip install -e on the extracted folder. However, after that, I get:

Traceback (most recent call last):
  File "PATH\src\dnc_model.py", line 7, in <module>
    from dnc import dnc
  File "PATH\libs\dnc\dnc\dnc.py", line 30, in <module>
    from dnc import access
  File "PATH\libs\dnc\dnc\access.py", line 25, in <module>
    from dnc import addressing
  File "PATH\libs\dnc\dnc\addressing.py", line 58, in <module>
    class CosineWeights(snt.AbstractModule):
AttributeError: module 'sonnet' has no attribute 'AbstractModule'

Does anyone have any idea what I could do to solve these issues? Is there a way I could modify the DNC code to work with modern Sonnet? Is there an alternative to AbstractModule in this use case?

@MoxyFoxy MoxyFoxy changed the title ModuleNotFoundError: No module named 'graphs' Issues using Sonnet Jan 16, 2023
@MoxyFoxy
Copy link
Author

This is the specific spot the error is occurring at: https://github.com/deepmind/dnc/blob/master/dnc/addressing.py#L58

Downloading an older version of Sonnet (if it will still work, that is) would also work, if that's a possibility, though I can't find a way to install an older version.

Also, I realized that it's dm-sonnet and not sonnet for pip install, so I have switched over to that instead of the source version. However, finding the pypi now gives me access to older versions, so I'm going to try playing around with them and see what I can do.

@MoxyFoxy
Copy link
Author

MoxyFoxy commented Jan 16, 2023

I unfortunately cannot downgrade Sonnet, so that is not an option. There is an issue with tensorflow-probability 0.8.0 (required by Sonnet 1.36) requiring cloudpickle==1.1.1, while Gymnasium, which I am using to simulate and train with, requires cloudpickle>=1.2.0.

@tomhennigan
Copy link
Collaborator

Hi @Denzeduous , indeed the first error is from using the wrong Sonnet package 😄

With regards to not being able to downgrade, I'm afraid that DNC requires TF1 and Sonnet <2.

I wonder what wold happen if you installed the old version of cloudpickle to satisfy TFP during install, and then force upgraded it to 1.2.0.

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