Tensorflow.keras not training and stoping with error 'No algorithm worked!' in Colab

Viewed 1868

I created a CNN model and it trained properly for the first and completed all epochs but when I closed the runtime and came back after a day and tried to retrain. It gives this error.

NotFoundError:  No algorithm worked!
 [[node sequential_2/conv2d_4/Conv2D (defined at <ipython-input-7-5d7257468056>:45) ]] [Op:__inference_train_function_3464]

Note: I am training this in google colab Here's the error code.

model.compile(optimizer='adam' , loss='categorical_crossentropy', metrics=['accuracy'])
model.fit(train_dataset,batch_size=16,epochs=40,verbrose = 1,
         validation_data=val_data,validation_steps = 16 
         ,shuffle=True, steps_per_epoch=80,
         use_multiprocessing=False,callbacks=[callbacks])
model.save('/content/drive/My Drive/eyes2.h5')
model.summary()

Link to notebook https://colab.research.google.com/drive/1Qf05-Axd1gjuZhBDv7LwNtO_znIg4iKf

2 Answers

I had this exact error message with Tensorflow when running a known-working model. As suggested by Bharath, it did appear to be related to version incompatibility.

However, I did not downgrade to fix it as this seems counter-intuitive and a step backwards. Here's an alternative solution that worked for me:

$ python3 -m pip install --upgrade pip
$ python3 -m pip install --upgrade pandas numpy matplotlib # probably not necessary
$ python3 -m pip uninstall tensorflow-gpu # if you have the old style packages installed
$ python3 -m pip install --upgrade tf-nightly

The Tensorflow installation instructions and GPU installation instructions were useful when solving this.

Try downgrading tensorflow to 1.x. Recently colab has updated tensorflow from 1.x to 2.x as its default which might be leading to this error. .

Related