xchoo / spaun2.0

Spaun (nengo 2.0 version)
63 stars 27 forks source link

No module named 'nengo.utils.compat' #12

Open RKCZ opened 4 years ago

RKCZ commented 4 years ago

Hello,

I cloned the repository on Linux and tried to run it both from the terminal and from the Spyder IDE. The execution failed with the following exception:

Traceback (most recent call last):
  File "<ipython-input-1-db715ac42e9c>", line 1, in <module>
    runfile('/home/nest/Desktop/nengo/spaun2.0/run_spaun.py', wdir='/home/nest/Desktop/nengo/spaun2.0')
  File "/home/nest/anaconda3/envs/nengo/lib/python3.7/site-packages/spyder_kernels/customize/spydercustomize.py", line 827, in runfile
    execfile(filename, namespace)
  File "/home/nest/anaconda3/envs/nengo/lib/python3.7/site-packages/spyder_kernels/customize/spydercustomize.py", line 110, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)
  File "/home/nest/Desktop/nengo/spaun2.0/run_spaun.py", line 10, in <module>
    from _spaun.configurator import cfg
  File "/home/nest/Desktop/nengo/spaun2.0/_spaun/configurator.py", line 10, in <module>
    from ._spa import MemoryBlock as MB
  File "/home/nest/Desktop/nengo/spaun2.0/_spaun/_spa/__init__.py", line 2, in <module>
    from .mem_block import MemoryBlock
  File "/home/nest/Desktop/nengo/spaun2.0/_spaun/_spa/mem_block.py", line 8, in <module>
    from .._networks import InputGatedMemory as WM
  File "/home/nest/Desktop/nengo/spaun2.0/_spaun/_networks/__init__.py", line 1, in <module>
    from .workingmemory import InputGatedMemory
  File "/home/nest/Desktop/nengo/spaun2.0/_spaun/_networks/workingmemory.py", line 8, in <module>
    from .assoc_mem import AssociativeMemory
  File "/home/nest/Desktop/nengo/spaun2.0/_spaun/_networks/assoc_mem.py", line 9, in <module>
    from nengo.utils.compat import is_iterable, range
ModuleNotFoundError: No module named 'nengo.utils.compat'

I looked through the Nengo source code and it seems that the module was deprecated and removed. Can you suggest some workaround to resolve the issue?

tbekolay commented 4 years ago

Hi Roman, thanks for your interest! The easiest workaround is to install an earlier version of Nengo, which contains the deprecated module.

pip install nengo==2.8.0

This is probably a good thing to do anyway as I do not believe Spaun has been updated since the Nengo 3.0.0 release, and might have other bugs.

RKCZ commented 4 years ago

Hi Trevor, thank you for such a quick response. I finally got back to this. Using version 2.8.0 helped with the issue. But I have another question. I executed the run_spaun.py script, it did not throw any error and an *.npz appeared in the data folder so I think it ran successfully. But I don't know how to get any results from the output file. Here are the last few lines of the output so you can tell me what is going on.

START BUILD
[] ETA: 0:04:25tcmalloc: large alloc 1296007168 bytes == 0x145142000 @  0x7f97f515a1e7 ...
[] ETA: 0:04:26tcmalloc: large alloc 1296007168 bytes == 0x19253a000 @  0x7f97f515a1e7 ...
[] ETA: 0:04:26^C

I registered there is another script process_out_data.py which might be used for that, but I couldn't execute it without errors. Is there some guide or tutorial describing how to run the whole model and get the results because currently, I have no clue how to proceed.

xchoo commented 4 years ago

Hi Roman, Because the data produced by Spaun can be quite large (especially when you probe neural activity from various parts of the system), the code is set up to write the probed output data to file (the *.npz file in the data folder) to reduce the amount of system memory used. After the simulation is complete, the process_out_data.py to process and graph the results with matplotlib.

From the errors you are getting running the code, I would guess that you are running out of system memory trying to build the model itself. Spaun is quite large, and a functional model requires up to 26GB of memory to build and run. However, if you are just looking to build and run the model without too much concern of the functionality of it (i.e., it might be really bad at doing the various tasks), you can reduce the -d parameter when running the run_spaun.py script:

python run_spaun.py -d 4

The default d (dimensionality) is 512, and Spaun requires at least 128 to be somewhat functional.

As for instructions or tutorials, unfortunately, the only instructions available are the README files, and the command line arguments for run_spaun.py (see lines 359 to 519 here: https://github.com/xchoo/spaun2.0/blob/c116cd4ded8301672f9a07e6694a1760a693bf68/run_spaun.py#L359). I will attempt to answer questions posted here as well.