1
votes

I am new to Jupyter, and I launch it from Anaconda navigator, I download Anaconda application and create a new environment named 'tf' for tensorflow by following this video: How to install Tensorflow and Keras using Anaconda Navigator Then I want to repeat this tutorial Basic classification: Classify images of clothing from Tensorflow office website, I copy and paste each cell one by one and when I run this cell, it has a warning message said "The kernel appears to have died. It will restart automatically."

test_loss, test_acc = model.evaluate(test_images,  test_labels, verbose=2)

print('\nTest accuracy:', test_acc)

I have no idea how to fix that, I search some answer said that is because run out of memory, but I am wondering is the code run in Jupyter using my laptop's memory? I am using a 128G old Macbook pro and I am not very confidence about its memory.. Thanks!

1

1 Answers

0
votes

You're trying to load a model that doesn't fit in your RAM memory. Thus, the kernel dies.

Your old MacBook pro has 4Gb of RAM. According to the link you shared, you're trying to load this model:

model = keras.Sequential([
    keras.layers.Flatten(input_shape=(28, 28)),
    keras.layers.Dense(128, activation='relu'),
    keras.layers.Dense(10, activation='softmax')
])

Assuming you're using float32 tensors, this is the amount of data you're trying to load: 28 x 28 x 128 x 10 = 1003520 parameters times 4 bytes, that is, 4014080 bytes or 3920Mb. As your laptop needs some memory to work, you don't have memory enough to load this model.

Try to reduce the number of neurons or resize the image.

I hope it helps.