LAB1>> ValueError: Data cardinality is ambiguous:

Looks like week 2 Lab 1 has issues with the shape of inputs for training and test data. Getting error as mentioned below:

Epoch 1/10
774/782 [============================>.] - ETA: 0s - loss: 0.4963 - accuracy: 0.7408

---------------------------------------------------------------------------

ValueError                                Traceback (most recent call last)

<ipython-input-35-f101d07e60e0> in <module>()
      2 
      3 # Train the model
----> 4 model.fit(padded, training_labels_final, epochs=num_epochs, validation_data=(testing_padded, testing_labels_final))

1 frames

/usr/local/lib/python3.7/dist-packages/keras/engine/data_adapter.py in _check_data_cardinality(data)
   1651                            for i in tf.nest.flatten(single_data)))
   1652     msg += "Make sure all arrays contain the same number of samples."
-> 1653     raise ValueError(msg)
   1654 
   1655 

ValueError: Data cardinality is ambiguous:
  x sizes: 0
  y sizes: 25000
Make sure all arrays contain the same number of samples.

The issue has been reported and opened here as well, please let me know in case I’m missing anything here?

Please click my name and message your notebook as an attachment.

I managed to get it working by logging out of google colab and redoing the entire thing over again, now its working fine! thanks for the help. Not exactly sure what was causing the issue.

Hi,

I am facing the similar issue. I would appreciate if you can help me to resolve it.

PFB the error screenshot

Looking forward for the reply.

Thanks in advance.

Re run from the beginning, I had some test case cells loaded that were messing it up.

@Shubhangi_Ghate

The error states that x and y are of different lengths.
Please check your data preparation functions.

If you’re unable to find the bug, please click my name and message your notebook as an attachment.

Please describe your issue clearly. If this is a grader related problem, don’t forget to share the expanded screenshot of grader feedback.

The issue is resolved.

Thank you very much.