C2W4 Programming Assignment Grader Output

I received following error after submitting the assignment. However, in collab I didn’t get any error. Please help me understand it. My output layer has 3 units and I have used softmax activation function and sparse_categorical_crossentroy loss function.

All tests passed for parse_data_from_input!

All tests passed for train_val_generators!

Details of failed tests for create_model

Failed test case: your model could not be used for inference. Details shown in ‘got’ value below:.
Expected:
no exceptions,
but got:
Received a label value of 24 which is outside the valid range of [0, 3). Label values: 23 17 15 16 13 4 8 23 4 20 18 15 15 20 22 20 19 10 10 2 11 2 15 0 2 0 10 1 12 22 19 20 21 4 6 7 5 1 21 7 2 3 8 0 13 15 24 8 21 13 4 22 7 23 5 2 3 5 2 12 21 17 22 1 13 4 18 11 14 7 10 15 7 2 7 10 7 21 17 5 0 14 3 14 19 7 14 8 3 21 0 16 4 7 4 6 21 3 8 7
[[node sparse_categorical_crossentropy/SparseSoftmaxCrossEntropyWithLogits/SparseSoftmaxCrossEntropyWithLogits
(defined at /opt/conda/lib/python3.7/site-packages/keras/backend.py:5114)
]] [Op:__inference_test_function_501]

Errors may have originated from an input operation.
Input Source operations connected to node sparse_categorical_crossentropy/SparseSoftmaxCrossEntropyWithLogits/SparseSoftmaxCrossEntropyWithLogits:
In[0] sparse_categorical_crossentropy/Reshape_1 (defined at /opt/conda/lib/python3.7/site-packages/keras/backend.py:5109)
In[1] sparse_categorical_crossentropy/Reshape (defined at /opt/conda/lib/python3.7/site-packages/keras/backend.py:3561)

Operation defined at: (most recent call last)

File “entry.py”, line 56, in
main()

File “entry.py”, line 52, in main
grade_notebook(config)

File “entry.py”, line 40, in grade_notebook
failed_partids = grade_func()

File “/grader/grader.py”, line 302, in grade
cases, num_cases = g()

File “/grader/grader.py”, line 282, in grade
return g_func(learner_model)

File “/grader/grader.py”, line 247, in g_func
model.evaluate(train_generator)

File “/opt/conda/lib/python3.7/site-packages/keras/utils/traceback_utils.py”, line 64, in error_handler
return fn(*args, **kwargs)

File “/opt/conda/lib/python3.7/site-packages/keras/engine/training.py”, line 1537, in evaluate
tmp_logs = self.test_function(iterator)

File “/opt/conda/lib/python3.7/site-packages/keras/engine/training.py”, line 1366, in test_function
return step_function(self, iterator)

File “/opt/conda/lib/python3.7/site-packages/keras/engine/training.py”, line 1356, in step_function
outputs = model.distribute_strategy.run(run_step, args=(data,))

File “/opt/conda/lib/python3.7/site-packages/keras/engine/training.py”, line 1349, in run_step
outputs = model.test_step(data)

File “/opt/conda/lib/python3.7/site-packages/keras/engine/training.py”, line 1306, in test_step
y, y_pred, sample_weight, regularization_losses=self.losses)

File “/opt/conda/lib/python3.7/site-packages/keras/engine/compile_utils.py”, line 201, in call
loss_value = loss_obj(y_t, y_p, sample_weight=sw)

File “/opt/conda/lib/python3.7/site-packages/keras/losses.py”, line 141, in call
losses = call_fn(y_true, y_pred)

File “/opt/conda/lib/python3.7/site-packages/keras/losses.py”, line 245, in call
return ag_fn(y_true, y_pred, **self._fn_kwargs)

File “/opt/conda/lib/python3.7/site-packages/keras/losses.py”, line 1738, in sparse_categorical_crossentropy
y_true, y_pred, from_logits=from_logits, axis=axis)

File “/opt/conda/lib/python3.7/site-packages/keras/backend.py”, line 5114, in sparse_categorical_crossentropy
labels=target, logits=output)
.

Hello @Mohit_Soni ,

Welcome to the community!

Can you kindly to send me your notebook via dm.By clicking on my profile picture, you will see an option to message.There you can attach your notebook.

Then we can discuss the issues here, under the topic you created, on discourse.

With regards,
Nilosree Sengupta

You don’t have the correct number of output classes. You have to account for all possible sign language letters, not only the ones found only in the training and validation sets.