title: Unable to train my keras model : (Data cardinality is ambiguous:)
body: <p>I am using the bert-for-tf2 library to do a Multi-Class Classification problem. I created the model but training throws the following error:</p>
  
  <pre><code>---------------------------------------------------------------------------
  ValueError                                Traceback (most recent call last)
  &lt;ipython-input-25-d9f382cba5d4&gt; in &lt;module&gt;()
  ----&gt; 1 model.fit([INPUT_IDS,INPUT_MASKS,INPUT_SEGS], list(train.SECTION))
  
  5 frames
  /tensorflow-2.0.0/python3.6/tensorflow_core/python/keras/engine/data_adapter.py in 
  __init__(self, x, y, sample_weights, batch_size, epochs, steps, shuffle, **kwargs)
  243             label, ", ".join([str(i.shape[0]) for i in nest.flatten(data)]))
  244       msg += "Please provide data which shares the same first dimension."
  --&gt; 245       raise ValueError(msg)
  246     num_samples = num_samples.pop()
  247 
  
  ValueError: Data cardinality is ambiguous:
  x sizes: 3
  y sizes: 6102
  Please provide data which shares the same first dimension.
  </code></pre>
  
  <p>I am referring the medium article called <a href="https://towardsdatascience.com/simple-bert-using-tensorflow-2-0-132cb19e9b22" rel="noreferrer">Simple BERT using TensorFlow 2.0</a> 
  The git repo for the library bert-for-tf2 can be found <a href="https://github.com/kpe/bert-for-tf2/tree/master/bert" rel="noreferrer">here</a>.</p>
  
  <p>Please find the entire code <a href="https://gist.github.com/AmalVijayan/d7d50e5ea4af39760dc9b55daa840dec" rel="noreferrer">here</a>.</p>
  
  <p><a href="https://colab.research.google.com/drive/1fIbPKxMayTgmRbFGQcC6tfY_6ZAXca-t" rel="noreferrer">Here</a> is a link to my colab notebook</p>
  
  <p>Really appreciate your help!</p>