title: Tensorflow fit_generator - how to use epochs correctly?
body: <p>I am working on a binary text classifier using Tensorflow Hub.</p>
  
  <pre><code>x_train = np.array(["Some test text", 
                      "Testing this text",
                      "This is relevant to my test",
                      "Cows don't fly",
                      "One two three",
                      "some text"])
  y_train = np.array([1,1,1,0,0,0])
  
  model = "https://tfhub.dev/google/tf2-preview/gnews-swivel-20dim/1"
  
  hub_layer = hub.KerasLayer(model, output_shape=[20], input_shape=[], 
                             dtype=tf.string, trainable=True)
  model = tf.keras.Sequential()
  model.add(hub_layer)
  model.add(tf.keras.layers.Dense(16, activation='relu', input_shape=[20]))
  model.add(tf.keras.layers.Dense(1, activation='sigmoid'))
  
  model.summary()
  
  model.compile(optimizer='adam',
                loss='binary_crossentropy',
                metrics=['accuracy'])
  </code></pre>
  
  <p>When I fit the model using the <code>fit</code> command, I can set my epochs to be as high as I want. When I use the <code>fit_generator</code> method, it seems that I can only use each data point once.</p>
  
  <pre><code># Trains as expected
  model.fit(x_train, y_train, epochs=100)
  
  # Errors during training with 
  #    'Your dataset iterator ran out of data; interrupting training. 
  #     Make sure that your iterator can generate at least `steps_per_epoch * epochs` 
  #     batches (in this case, 600 batches).'
  model.fit_generator(my_iterator(x_train, y_train), epochs=100, steps_per_epoch=len(x_train))
  
  </code></pre>
  
  <p>How do I correctly set up my iterator to be able to train using a generator?</p>