title: Eager vs graph mode with Keras and TF2.0
body: <p>I'm compiling a previously trained model in the graph mode:</p>
  <pre><code>inference_model = model_from_json(json.dumps(inference_model_dict))
  inference_model.set_weights(original_model.get_weights())
  inference_model.compile('adam', 'binary_crossentropy', run_eagerly=False)
  </code></pre>
  <p>When using it for prediction:</p>
  <pre><code>predictions = inference_model.predict(gen)
  </code></pre>
  <p>getting the following error:</p>
  <p>ValueError: Calling <code>Model.predict</code> in graph mode is not supported when the <code>Model</code> instance was constructed with eager mode enabled. Please construct your <code>Model</code> instance in graph mode or call <code>Model.predict</code> with eager mode enabled.</p>
  <p>I was trying to disable the TF2.0 default by</p>
  <pre><code>tf.compat.v1.disable_eager_execution()
  </code></pre>
  <ul>
  <li>this didn't help neither.</li>
  </ul>
  <p>Reading thru the Keras documentation, don't find how to follow this recommendation: &quot;call <code>Model.predict</code> with eager mode enabled&quot;</p>
  <p>Originally, this model was trained in the eager mode. Does this matter? Can't this be overwritten somehow?</p>