Open Pasha-Akito opened 4 months ago
Yes I have faced similar issues, downgrading the Tensorflow
works but that's not the good workaround, the ncp package needs to be updated for the same correction.
For start you can try other supporting versions of tensorflow.
@mlech26l , @raminmh Any insights on this bug?
This is actually a fairly simple fix. AbstractRNNCell
was just an abstract class (Protocol) with methods stubbed out that the RNN
class requires for a cell. To fix this simply replace tf.keras.layers.AbstractRNNCell
with tf.keras.layers.Layer
I also stumbled over this bug. But he already has a Keras 3-compatible version in his repo, it's just not documented. I think they should just update the documentation. Just use ncps.keras
instead of ncps.tf
and all your problems are solved.
import keras
from ncps import wirings
from ncps.keras import LTC
wiring = wirings.AutoNCP(8,1) # 8 neurons in total, 1 output (motor neuron)
model = keras.models.Sequential(
[
keras.layers.InputLayer(shape=(None, 32)),
LTC(wiring, return_sequences=True)
]
)
model.compile(
optimizer=keras.optimizers.Adam(0.01), loss='mean_squared_error'
)
model.summary()
Hi,
I'm following this guide on using LTC with tensorflow: https://ncps.readthedocs.io/en/latest/examples/tf_first_steps.html
When running the imports as described here, I run into an issue, in particular this import:
from ncps.tf import LTC
I get the following error:
AttributeError: module 'tensorflow.keras.layers' has no attribute 'AbstractRNNCell'
From looking into it, it seems like tensorflow no longer supports AbstractRNNCell, this is fine as I can downgrade my tensorflow version to one which does support AbstractRNNCell.
My question is whether or not there is any intention of fixing this for newer tensorflow versions?
Thanks