KordingLab / Neural_Decoding

A python package that includes many methods for decoding neural activity
BSD 3-Clause "New" or "Revised" License
429 stars 119 forks source link

NameError: name 'Sequential' is not defined #13

Closed HuaizhenC closed 4 years ago

HuaizhenC commented 4 years ago

--------------------------------------------------------------------------- NameError Traceback (most recent call last) in 3 4 #Fit model ----> 5 model_dnn.fit(X_flat_train,y_train) 6 7 #Get predictions ~/Desktop/Cohen Lab/Projects/Neural_Decoding-master2/Neural_Decoding/decoders.py in fit(self, X_flat_train, y_train) 373 """ 374 --> 375 model=Sequential() #Declare model 376 #Add first hidden layer 377 model.add(Dense(self.units[0],input_dim=X_flat_train.shape[1])) #Add dense layer NameError: name 'Sequential' is not defined

Hi when I tried to run the upgraded version of the package, for DNN, RNN, GRU,LSTM, all have the error that name 'sequential' is not defined. I use Keras 2.4.3, and tensorflow2.3 Any ideas about why this happened? Thanks!!

jglaser2 commented 4 years ago

I'm sorry - I updated everything to be compatible up until Keras 2.3.1 (which was what you previously mentioned you were using).

I need to update our package further to be compatible with even new versions of Keras/TF. I'll hopefully get to that soon.

HuaizhenC commented 4 years ago

Hi the same error popped out in keras 2.3.1...

jglaser2 commented 4 years ago

Hmm, I'm not sure. It is working for me now on keras 2.4.3 and TF 2.3.

If you are getting the error that Sequential is not defined, that might happen because somehow it is not recognizing that Keras is installed. When you import the decoders, do you get the message "Warning: Keras package is not installed..." ?

HuaizhenC commented 4 years ago

Nevermind, Thank you so much!! The warning did pop out, but after I fixed this, a new error pop out : module 'tensorflow.python.framework.ops' has no attribute '_TensorLike' Then, I upgraded keras to 2.4.3 with TF 2.3, then everything works now. It seems that for TF2.3, keras has to be at a higher than 2.3.1 version (I use 2.4.3 as you have tested before)...

jglaser2 commented 4 years ago

Glad it's working!