Unexpected error occurred during variable check

I got this message when submitting my results:

We expected variable metrics to be of type <class ‘str’>

In my code metrics is a string and I don’t get where is the mistake.

That’s not quite accurate: it needs to be a list of strings, not just a string. Here’s one of the “canned” model.compile invocations they give us in the MobilNet exercise:

base_learning_rate = 0.001
model2.compile(optimizer=tf.keras.optimizers.Adam(lr=base_learning_rate),
              loss=tf.keras.losses.BinaryCrossentropy(from_logits=True),
              metrics=['accuracy'])

Does your code look similar to that? Note the square brackets there.

1 Like