title: How to handle Invalid Argument Error in keras
body: <p>Getting this error while trying to train the model using keras.</p>
  
  <blockquote>
    <p>InvalidArgumentError: indices[48,2] = 5388 is not in [0, 5388)<br>
    [[Node: embedding_1/embedding_lookup = GatherV2[Taxis=DT_INT32,
    Tindices=DT_INT32, Tparams=DT_FLOAT,
    _class=["loc:@training/RMSprop/Assign_1"], _device="/job:localhost/replica:0/task:0/device:CPU:0"](embedding_1/embeddings/read,
    embedding_1/Cast,
    training/RMSprop/gradients/embedding_1/embedding_lookup_grad/concat/axis)]]</p>
  </blockquote>
  
  <p>The actual line is this...</p>
  
  <pre><code>model.fit_generator(generator = generate_batch(X_train, y_train, batch_size = batch_size),
                      steps_per_epoch = train_samples//batch_size,
                      epochs=epochs,
                      validation_data = generate_batch(X_test, y_test, batch_size = batch_size),
                      validation_steps = val_samples//batch_size)
  </code></pre>
  
  <blockquote>
    <p>Epoch 1/50  73/237 [========>.....................] - ETA: 32:10 -
    loss: 7.4517 - acc: 0.1711</p>
  </blockquote>
  
  <p>And entire code is here...</p>
  
  <p><a href="https://github.com/shantanuo/pandas_examples/blob/master/deep_learn/WordLevelEngMarNMT.ipynb" rel="nofollow noreferrer">https://github.com/shantanuo/pandas_examples/blob/master/deep_learn/WordLevelEngMarNMT.ipynb</a></p>
  
  <p>Code cloned from...
  <a href="https://github.com/hlamba28/Word-Level-Eng-Mar-NMT" rel="nofollow noreferrer">https://github.com/hlamba28/Word-Level-Eng-Mar-NMT</a></p>