Closed pairwiserr closed 5 years ago
Solution is to convert all your lists to numpy array e.g.
import numpy as np
x = np.array(x_train_pad)
y = np.array(y_train)
model.fit(x, y, validation_split=0.06, epochs=3, batch_size=64)
Also when you're loading tensorflow keras packages on line 2, change
from tensorflow.python.keras.models import Sequential
from tensorflow.python.keras.layers import Dense, GRU, Embedding
from tensorflow.python.keras.optimizers import Adam
from tensorflow.python.keras.preprocessing.text import Tokenizer
from tensorflow.python.keras.preprocessing.sequence import pad_sequences
to
from tensorflow.compat.v1.keras.models import Sequential
from tensorflow.compat.v1.keras.layers import Dense, GRU, Embedding
from tensorflow.compat.v1.keras.optimizers import Adam
from tensorflow.compat.v1.keras.preprocessing.text import Tokenizer
from tensorflow.compat.v1.keras.preprocessing.sequence import pad_sequences
I think tf 2.0 broke some of the utility functions when calculating gradients.
Your post is too short. I have to guess most of the context. Are you running the tutorial exactly like it is in the repo? Are you using another dataset? If you're running it exactly like it is in the repo, then it's perhaps a tensorflow 2.0 problem. At some point I will go through all the tutorials and see if I can update them to TF 2.0. Using compat.v1 is only a temporary fix.
Sorry, I should've prefaced that I am running the notebook exactly as is, line by line, using the same dataset with your download.py
and imdb.py
.
On line 48
model.fit(x_train_pad, y_train, validation_split=0.05, epochs=3, batch_size=64
I getI opened an issue https://github.com/keras-team/keras/issues/13407