C4 - Week 2 - ex-w2a2 errors in evaluation

Hi guys,

I’ve reviewed it a few times and when I change something in the learning rate my tests don’t pass. However, leaving it in a way that all tests pass, my test score is 66.

I have the following error messages:

Code Cell UNQ_C1: Function ‘data_augmenter’ is correct.
Code Cell UNQ_C2: Function ‘alpaca_model’ is correct.
Code Cell UNQ_C3: The value of your variable ‘loss_function’ is correct.
Code Cell UNQ_C3: You have an incorrect value for ‘optimizer’ variable. We expected a value of ‘(<class ‘tensorflow.python.keras.optimizer_v2.adam.Adam’>, 0.0001)’ and you have ‘(<class ‘tensorflow.python.keras.optimizer_v2.adam.Adam’>, <tf.Variable ‘learning_rate:0’ shape=() dtype=float32, numpy=0.001>)’.
Code Cell UNQ_C3: The value of your variable ‘metrics’ is correct.
If you see many functions being marked as incorrect, try to trace back your steps & identify if there is an incorrect function that is being used in other steps.
This dependency may be the cause of the errors.

PS: When trying to change the learning rate or casting it, the same error messages continue, even though all tests are ok. And leaving the learning rate with 0.0001, it does not pass the test, due to the assert in the next cell.

Hey! It looks like you might have provided the wrong value for the learning rate. Can you check with the instruction comments in the provided code that you’ve done it properly?

Hi @XpRienzo , the tests were ok:

Define an Adam optimizer with a learning rate of 0.1 * base_learning_rate

optimizer = tf.keras.optimizers.Adam(lr=0.1*base_learning_rate)

assert type(loss_function) == tf.python.keras.losses.BinaryCrossentropy, “Not the correct layer”
assert loss_function.from_logits, “Use from_logits=True”
assert type(optimizer) == tf.keras.optimizers.Adam, “This is not an Adam optimizer”
assert optimizer.lr == base_learning_rate / 10, “Wrong learning rate”
assert metrics[0] == ‘accuracy’, “Wrong metric”

print(’\033[92mAll tests passed!’)

→ All tests passed!

However, when sending the code the result is the one posted above.

Okay, that’s peculiar, could you dm me your code for the entire block?

I sent you in private. Thank you for your help.

For others who check this thread later on for similar issues. Fetching a new version of the notebook and then completing it solved the problem here. These are the instructions you can follow to do so:

Rename your notebook by clicking on top where the name is. Then click on help, and click Get Latest Version. You’ll get an updated notebook (you earlier notebook is still saved under the new name, you can click File → Open to see it, then can right click and open it in a new tab), now you could try to redo the assignment using this notebook, and manually fill the Nones again.