question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Implement/document TB debugging with tf.keras model.fit

See original GitHub issue

Currently (in TF 2.0.0 and TF 2.1.0 and tf-nightly/tb-nightly) the /#debugger view shows this snippet for “Keras Model”:

import tensorflow as tf
from tensorflow.python import debug as tf_debug
import keras

keras.backend.set_session(
    tf_debug.TensorBoardDebugWrapperSession(tf.Session(), "ip-a-b-c-d:6064"))
# Define your keras model, called "model".
model.fit(...)

But I’m using tf.keras. So I tried the above with from tensorflow import keras instead of import keras, and that fails (in TF 2.0.0 and TF 2.1.0 and tf-nightly) with:

AttributeError: module 'tensorflow.python.keras.api._v2.keras.backend' has no attribute 'set_session'

Looks like set_session was marked compat.v1 already in Tensorflow 2.0.0: https://github.com/tensorflow/tensorflow/commit/86ac0d0a377d5b89a97c9c468a31b6506c9a7209

So I didn’t find any instructions anywhere for using the Tensorboard debugger view with a tf.keras model.fit scenario in Tensorflow 2.0.0 up.

Is that not implemented at all, or the setup just not documented?

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:6

github_iconTop GitHub Comments

3reactions
rantavcommented, May 5, 2020

I too see similar (bogus) behavior as @gthb describes, usingTensorFlow version: 2.1.0

0reactions
bazhenovcommented, Jul 5, 2020

I’m facing the same issue in TF/2.2.0. Tensorflow doesn’t even try to connect to Tensorboard debugger plugin.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Keras debugging tips
If you write a custom layer, don't call fit() on your entire model just yet. Call your layer on some test data first....
Read more >
Debugging in TensorFlow - Towards Data Science
When you train with tf.keras.model.fit, by default, the training step is executed in graph mode. Of course, the inability to access arbitrary ...
Read more >
Inside TensorFlow: TF Debugging - YouTube
In this episode of Inside TensorFlow, Software Engineer Shanqing Cai demonstrates to us TensorFlow Debugging for TF 2 and TF 1.
Read more >
Logging with Tensorboard — DIVEDEEP - CityU CS
To call additional functions during training, we can add the functions to the callbacks parameter of the model fit method. For instance: import...
Read more >
tf.keras.Model | TensorFlow v2.11.0
Your model might run slower, but it should become easier for you to debug it by stepping into individual layer calls. By default,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found