Code Now
Code Now

Reputation: 771

Google Colab - Your session crashed for an unknown reason

Your session crashed for an unknown reason

when I run the following cell in Google Colab:

from keras import backend as K
if 'tensorflow' == K.backend():
  import tensorflow as tf
  from keras.backend.tensorflow_backend import set_session
  config = tf.ConfigProto()
  config.gpu_options.allow_growth = True
  config.gpu_options.visible_device_list = "0"
  set_session(tf.Session(config=config))

I receive this message since I have uploaded two data sets to google drive.

Does anyone know this message and can give me some advice? Many thanks for every hint.

Update: enter image description hereI always receive the message

Update I have removed the data sets from Google Drive, but the session is still crashing.

Upvotes: 7

Views: 11885

Answers (3)

YeonwooSung
YeonwooSung

Reputation: 61

This error happens when the expected device and the actual device are different.

For example, if you run the code that is written with torch_xla, which is for TPU training, on the GPU (cuda) then the Colab will return you this error.

It is really tricky since it does not give you an actual debugging message, etc, which makes you hard to find what is the actual problem.

Upvotes: 0

Mark K
Mark K

Reputation: 9338

Just a side note: sometimes you may want to reinstall an litle older version of the related module (see from the error log). It works for me in a case.

Upvotes: 0

user11530462
user11530462

Reputation:

Google Colab is crashing because you are trying to Run Code related to GPU with Runtime as CPU.

The execution is successful if you change the Runtime as GPU. Steps for the same are mentioned below:

Runtime -> Change Runtime -> GPU (Select from dropdown).

Please find the Working code in Github Gist.

Upvotes: 5

Related Questions