I am trying the following text Classification code from François Chollet’s Deep Learning Book on MacOS BigSur M1 Chip (Version 11.2.3) for the first time. I am using tensorflow version 2.5.0
import tensorflow as tf
from tensorflow.keras import layers
from tensorflow.keras.datasets import imdb
from tensorflow.keras.preprocessing import sequence
max_features = 2000
max_len = 500
(x_train, y_train), (x_test, y_test) = imdb.load_data(num_words=max_features)
x_train = sequence.pad_sequences(x_train, maxlen=max_len)
x_test = sequence.pad_sequences(x_test, maxlen=max_len)
model = keras.models.Sequential()
model.add(layers.Embedding(max_features, 128,input_length=max_len,name='embed'))
model.add(layers.Conv1D(32, 7, activation='relu'))
model.add(layers.MaxPooling1D(5))
model.add(layers.Conv1D(32, 7, activation='relu'))
model.add(layers.GlobalMaxPooling1D())
model.add(layers.Dense(1))
model.summary()
model.compile(optimizer='rmsprop',loss='binary_crossentropy',metrics=['acc'])
callbacks=[tf.keras.callbacks.TensorBoard(log_dir='my_log_dir',histogram_freq=1,embeddings_freq=1,)]
history = model.fit(x_train, y_train, epochs=20, batch_size=128,
validation_split=0.2,callbacks=callbacks)
Why these accuracy and loss values are very high. I am getting different values, if I run the same code on Windows 10.
Results on MacOS:
Results on Windows 10:
Even running any other code, using Adam’s Optimizer, I am getting a notice that Kernel appears to have died.
Results on MacOS:
And how to avoid these warnings (in pink box)?
Please help!!