ericjang / tdb

Interactive, node-by-node debugging and visualization for TensorFlow

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to run in python3

green-john opened this issue · comments

First of all, Thank you for this. It is awesome.

Second, I have started porting the code to python3 (all my env is python3) and I have got the extension and the plots to show on Jupyter. However I am now running into problems when setting breakpoints. What happens is, once the bp is hit, the code keeps executing. I have looked at the code, and I don't know if I am using the bp capability wrong, or if there is issues with python3.

Here is where I use tdb

for _ in range(n_batches):
    batch = data_gen.get_batch(batch_size)
    feed = {X: batch[0], y: one_hot(batch[1], n_classes)}
    stat, res = tdb.debug([train_step, cross_entropy, accuracy, y_],
                                      feed_dict=feed, break_immediately=True,
                                      session=sess)

And this is the output when I run that:

Breakpoint triggered. Next Node:  SoftmaxCrossEntropyWithLogits_1:0
Breakpoint triggered. Next Node:  SoftmaxCrossEntropyWithLogits_1:0
Breakpoint triggered. Next Node:  SoftmaxCrossEntropyWithLogits_1:0
Breakpoint triggered. Next Node:  SoftmaxCrossEntropyWithLogits_1:0
Breakpoint triggered. Next Node:  SoftmaxCrossEntropyWithLogits_1:0
Breakpoint triggered. Next Node:  SoftmaxCrossEntropyWithLogits_1:0
Breakpoint triggered. Next Node:  SoftmaxCrossEntropyWithLogits_1:0
Breakpoint triggered. Next Node:  SoftmaxCrossEntropyWithLogits_1:0

It doesn't stop until after the code has executed. My changes to make the code python3 compatible include very simple things:

  • Make all the imports relative, i.e. change import asdf for from . import asdf
  • Change StringIO for io.BytesIO.
  • Change base64.b64encode for base64.encodebytes.

I have the suspicion that this is the intended behavior and that I should check the value of status and stop execution based on it, however I want to make sure this is the case.