Getting 0/50 for Error history.pkl And "accuracy" KeyError on Google Collabs

Hello team,

I always getting 0/50 on submitting history.pkl

I know this code is depricated:

acc=history.history['acc']
val_acc=history.history['val_acc']
loss=history.history['loss']
val_loss=history.history['val_loss']

epochs=range(len(acc)) # Get number of epochs

but, my Google Collabs doesn’t want to take “accuracy” as the key. It always getting back KeyError for accuracy. I think, this ‘acc’ and ‘accuracy’ are causing my 0 score.

Any advice to handle this? because I always getting 0/50 for my history file, and doesn’t know how to trace it

Thanks in advance.

Where are you getting the KeyError? When training or when retrieving the values of the history?

If it is at training time it is most likely a TF bug. Could you please check the TF version in your colab? You can do so by running this command: ! pip show tensorflow.

If it is when retrieving the values of the history make sure that accuracy is being used when compiling the model.

here s the output

So, the “acuraccy” KeyError comes from this code:

Send me a DM with a copy of your notebook and I’ll take a look

Done, please check DM