aamini / introtodeeplearning

Lab Materials for MIT 6.S191: Introduction to Deep Learning
MIT License
7.1k stars 3.58k forks source link

Lab 1 part 2 getting Value error at defining Embedding Layer #162

Open Bluehand1984 opened 1 month ago

Bluehand1984 commented 1 month ago

I am getting valuerror on my Juypter Lab and Vscode. This only work on Coblab. ValueError: Unrecognized keyword arguments passed to Embedding: {'batch_input_shape': [32, None]}

def build_model(vocab_size, embedding_dim, rnn_units, batch_size): model = tf.keras.Sequential([ tf.keras.layers.Embedding(vocab_size, embedding_dim, batch_input_shape=[batch_size,None]), LSTM(rnn_units),
tf.keras.layers.Dense(vocab_size)
])

return model

model = build_model(len(vocab), embedding_dim=256, rnn_units=1024, batch_size=32)

jnchacon commented 1 month ago

Hi, I'm getting the same error, also in de solution... Did you find the solution?

jnchacon commented 1 month ago

Hi Again. I found that the error is because I had installed the 2.16.1 version (keras 3) of tensorflow, and the lab1 is for the 2.15.0 version (keras 2). I uninstalled the version I had and installed the 2.15.0 version instead. It worked.

pip3 install 'tensorflow==2.15.0' --force-reinstall