title: python generator thread safety using Keras
body: <p>I am using Keras for some ML and have this generator for the data and labels:</p>
  
  <pre><code>def createBatchGenerator(driving_log,batch_size=32):
      batch_images = np.zeros((batch_size, 66, 200, 3))
      batch_steering = np.zeros(batch_size)
      while 1:
          for i in range(batch_size):
              x,y = get_preprocessed_row(driving_log)
              batch_images[i]=x
              batch_steering[i]=y
          yield batch_images, batch_steering
  </code></pre>
  
  <p>When I use it locally it runs fine, but when I run it on an AWS g2.2xlarge with a GPU, I get this error "ValueError: generator already executing". Can someone please help me resolve this?</p>