nengo / nengo-dl

Deep learning integration for Nengo
https://www.nengo.ai/nengo-dl
Other
88 stars 22 forks source link

Importing Nengo_DL in Google Colab #235

Open SerhiiBahdas opened 10 months ago

SerhiiBahdas commented 10 months ago

Hello there!

I'm encountering an issue with importing nengo_dl in Google Colab. The error states that 'keras.engine' is not available. Here's what I've tried:

  1. Attempted to resolve it by downgrading keras to version 2.2.1 using 'pip install keras==2.2.1,' but a new error occurred.
  2. The new error suggests that Colab cannot import 'Iterable' from 'collections,' possibly a Python compatibility issue.

Could you please help me resolve this? Thank you in advance, you guys are awesome!

ISSUE # 1

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-4-700eed500250> in <cell line: 1>()
----> 1 import nengo_dl

2 frames
/usr/local/lib/python3.10/dist-packages/nengo_dl/compat.py in <module>
     79     )
     80 else:
---> 81     from keras.engine.functional import Functional, _build_map
     82     from keras.layers import BatchNormalizationV1, BatchNormalizationV2
     83 

ModuleNotFoundError: No module named 'keras.engine'

---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------

ISSUE # 2

Using TensorFlow backend.
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-3-700eed500250> in <cell line: 1>()
----> 1 import nengo_dl

10 frames
/usr/local/lib/python3.10/dist-packages/keras/callbacks.py in <module>
     16 from collections import deque
     17 from collections import OrderedDict
---> 18 from collections import Iterable
     19 from .utils.generic_utils import Progbar
     20 from . import backend as K

ImportError: cannot import name 'Iterable' from 'collections' (/usr/lib/python3.10/collections/__init__.py)

---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------
sleepingcat4 commented 1 month ago

@SerhiiBahdas please use my forked version where I have fixed the issue of keras.engine

pip install git+https://github.com/sleepingcat4/nengo-dl.git

I've opened a pull request to this library and hopefully the maintainers will merge it pretty quick