<p dir="auto">Setting <code class="notranslate">verbose=0</code> in <code class="notranslate">tf.keras.model.fit_generator()</code> has no effect if <code class="notranslate">validation_data</code> is provided.<br>
The progress is still displayed for each validation step.<br>
This is annoying if you have a callback that is responsible for printing progress.</p>
<p dir="auto"><strong>System information</strong></p>
<ul dir="auto">
<li>running in docker container tensorflow/tensorflow:latest-py3-jupyter</li>
<li><code class="notranslate">tf.GIT_VERSION</code>: v1.13.1-0-g6612da8951</li>
<li><code class="notranslate">tf.VERSION</code>: 1.13.1</li>
<li><code class="notranslate">tf.keras.__version__</code>: 2.2.4-tf</li>
</ul>
<p dir="auto"><strong>Describe the current behavior</strong><br>
Progress-bar is displayed regardless of <code class="notranslate">verbose=0</code></p>
<p dir="auto"><strong>Describe the expected behavior</strong><br>
Nothing should be printed</p>
<p dir="auto"><strong>Code to reproduce the issue</strong></p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="model = tf.keras.models.Sequential([
    tf.keras.layers.Dense(1, input_shape=(1,))
])
model.compile(loss=&quot;mae&quot;, optimizer=&quot;adam&quot;)

def generator():
    i=0
    while 1:
        yield (np.array([i]),[i])
        i+=1
valData = (np.arange(10), np.arange(10))

history = model.fit_generator(generator(), steps_per_epoch=5, verbose=0, validation_data=valData)"><pre class="notranslate"><span class="pl-s1">model</span> <span class="pl-c1">=</span> <span class="pl-s1">tf</span>.<span class="pl-s1">keras</span>.<span class="pl-s1">models</span>.<span class="pl-v">Sequential</span>([
    <span class="pl-s1">tf</span>.<span class="pl-s1">keras</span>.<span class="pl-s1">layers</span>.<span class="pl-v">Dense</span>(<span class="pl-c1">1</span>, <span class="pl-s1">input_shape</span><span class="pl-c1">=</span>(<span class="pl-c1">1</span>,))
])
<span class="pl-s1">model</span>.<span class="pl-en">compile</span>(<span class="pl-s1">loss</span><span class="pl-c1">=</span><span class="pl-s">"mae"</span>, <span class="pl-s1">optimizer</span><span class="pl-c1">=</span><span class="pl-s">"adam"</span>)

<span class="pl-k">def</span> <span class="pl-en">generator</span>():
    <span class="pl-s1">i</span><span class="pl-c1">=</span><span class="pl-c1">0</span>
    <span class="pl-k">while</span> <span class="pl-c1">1</span>:
        <span class="pl-k">yield</span> (<span class="pl-s1">np</span>.<span class="pl-en">array</span>([<span class="pl-s1">i</span>]),[<span class="pl-s1">i</span>])
        <span class="pl-s1">i</span><span class="pl-c1">+=</span><span class="pl-c1">1</span>
<span class="pl-s1">valData</span> <span class="pl-c1">=</span> (<span class="pl-s1">np</span>.<span class="pl-en">arange</span>(<span class="pl-c1">10</span>), <span class="pl-s1">np</span>.<span class="pl-en">arange</span>(<span class="pl-c1">10</span>))

<span class="pl-s1">history</span> <span class="pl-c1">=</span> <span class="pl-s1">model</span>.<span class="pl-en">fit_generator</span>(<span class="pl-en">generator</span>(), <span class="pl-s1">steps_per_epoch</span><span class="pl-c1">=</span><span class="pl-c1">5</span>, <span class="pl-s1">verbose</span><span class="pl-c1">=</span><span class="pl-c1">0</span>, <span class="pl-s1">validation_data</span><span class="pl-c1">=</span><span class="pl-s1">valData</span>)</pre></div>
<p dir="auto">Output:</p>
<blockquote>
<p dir="auto">10/10 [==============================] - 0s 6ms/sample - loss: 11.3572</p>
</blockquote>
<p dir="auto">Omitting <code class="notranslate">validation_data</code>  stops the output from appearing</p>
<p dir="auto">Link to an example notebook:<br>
<a href="https://colab.research.google.com/drive/1SrTdFXD_SCxu-gvo-h2YjFiAkO1CDaLG" rel="nofollow">https://colab.research.google.com/drive/1SrTdFXD_SCxu-gvo-h2YjFiAkO1CDaLG</a></p>
<p dir="auto"><strong>System information</strong></p>
<ul dir="auto">
<li>OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Windows 10 1809</li>
<li>TensorFlow installed from (source or binary): pip</li>
<li>TensorFlow version (use command below): 1.13 gpu</li>
<li>Python version: 3.6</li>
</ul>
<p dir="auto"><strong>Bug</strong><br>
When using <code class="notranslate">fit_generator</code> with validation the progress bar is printed regardless of the <code class="notranslate">verbose</code> setting.</p>
<p dir="auto"><strong>Cause</strong><br>
Line 216 of tensorflow/python/keras/engine/training_generator.py calls <code class="notranslate">model_iterator</code> to do validation, but does not pass the <code class="notranslate">verbose</code> parameter, meaning that the default value of <code class="notranslate">verbose=1</code> is used.</p>
<p dir="auto"><strong>Solution</strong><br>
Add in the missing parameter, e.g.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="    # Run the test loop every epoch during training.
    if do_validation and not callbacks.model.stop_training:
      val_results = model_iteration(
          model,
          validation_data,
          steps_per_epoch=validation_steps,
          batch_size=batch_size,
          class_weight=class_weight,
          workers=workers,
          use_multiprocessing=use_multiprocessing,
          max_queue_size=max_queue_size,
          verbose=verbose,
          mode='test')"><pre class="notranslate"><code class="notranslate">    # Run the test loop every epoch during training.
    if do_validation and not callbacks.model.stop_training:
      val_results = model_iteration(
          model,
          validation_data,
          steps_per_epoch=validation_steps,
          batch_size=batch_size,
          class_weight=class_weight,
          workers=workers,
          use_multiprocessing=use_multiprocessing,
          max_queue_size=max_queue_size,
          verbose=verbose,
          mode='test')
</code></pre></div>