Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Graph visualization failed, in Graph mode [TF 2.2, TB 2.2.1] #42133

Closed
OverLordGoldDragon opened this issue May 25, 2020 · 11 comments
Closed

Graph visualization failed, in Graph mode [TF 2.2, TB 2.2.1] #42133

OverLordGoldDragon opened this issue May 25, 2020 · 11 comments
Assignees
Labels
comp:keras Keras related issues comp:tensorboard Tensorboard related issues TF 2.3 Issues related to TF 2.3 type:bug Bug

Comments

@OverLordGoldDragon
Copy link
Contributor

Eager works, though partially - Graph doesn't work at all. Suggested thread doesn't reveal much.

image

import shutil
import tempfile
import numpy as np
import tensorflow as tf
tf.compat.v1.disable_eager_execution()

from tensorflow.keras.layers import Input, Dense
from tensorflow.keras.models import Model
from tensorflow.keras.callbacks import TensorBoard

#%%############################################
ipt = Input(shape=(16,))
out = Dense(16)(ipt)
model = Model(ipt, out)
model.compile('adam', 'mse')

logdir = tempfile.mkdtemp()
print('tensorboard --logdir="%s"' % logdir)
tb = TensorBoard(logdir, write_graph=True)

#%%############################################
x = y = np.random.randn(160, 16)
model.fit(x, y, batch_size=32, callbacks=[tb])

# shutil.rmtree(logdir)

Environment info:

  • Browser: Google Chrome v83.0.4103.61 x64 [also tried Firefox Developer Edition]
  • System: Windows 10 x64, GTX 1070, i7-7700HQ 2.8 GHz
@stephanwlee
Copy link
Contributor

I looked at it a bit and it looks like you are using a Functional style of Keras (

from tensorflow.python.keras.engine import functional # pylint: disable=g-import-not-at-top
return functional.Functional(*args, **kwargs)
).

While I am confident that Keras will generate op graph when using Sequential model (a special case of Functional), I am not too certain op graphs will be generated in all cases of Functional. It is inconclusive with my cursory reading of https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/keras/engine/functional.py as it is quite dense. @omalleyt12 could you enlighten us a bit?

@XiaotianZou
Copy link

Also having the same issue. Did you solve this problem eventually?

@garryyan2
Copy link

Greetings! I am very new to Python and Tensorflow. I am just trying to find out where is a good place to start. It seems Keras is a good starting point. However, I ran into the same issue. I can see the SCALARS' plots. However, I can't see the model in GRAPHS. I just used a very simple Sequential model as given in a web page tutorial. I understand that Tensorflow Version 2.0 made some changes. I was hoping it's a simple fix in my code to your experts. Thank you in advance.

train_2b.txt

@rmothukuru rmothukuru assigned rmothukuru and unassigned rmothukuru Aug 7, 2020
@stephanwlee stephanwlee transferred this issue from tensorflow/tensorboard Aug 7, 2020
@jvishnuvardhan jvishnuvardhan added comp:keras Keras related issues type:bug Bug TF 2.3 Issues related to TF 2.3 labels Aug 20, 2020
@jvishnuvardhan jvishnuvardhan added the stat:awaiting tensorflower Status - Awaiting response from tensorflower label Aug 20, 2020
@manivaradarajan manivaradarajan added the comp:tensorboard Tensorboard related issues label Sep 16, 2020
@hy2610
Copy link

hy2610 commented Oct 23, 2020

I also have the same issue. When I used sequential model and model.fit(), there is a tab for graph, but it shows" Graph visualization failed". Also, the example code for @tf.function does not works for me either.

@acarl005
Copy link

acarl005 commented Jan 15, 2021

Also having this issue with my sub-classed model. I'm using TF 2.4 and Python 3.7.

@hitskyer
Copy link

Also having the same issue. Did you solve this problem eventually?

@nikitamaia
Copy link
Member

Hi @OverLordGoldDragon, is there a particular reason you are disabling eager execution? In TF2 tf.compat.v1.disable_eager_execution() is generally not recommended.

@OverLordGoldDragon
Copy link
Contributor Author

@nikitamaia Back then it was recommended for speed and memory advantages; I also ensured Graph & Eager compatibility of my packages for users.

I've switched to Pytorch and no longer seek to resolve any TF bugs. Keeping issue open for others.

@tensorflowbutler tensorflowbutler removed the stat:awaiting tensorflower Status - Awaiting response from tensorflower label Feb 5, 2021
@sushreebarsa
Copy link
Contributor

sushreebarsa commented May 30, 2021

Was able to reproduce the issue in TF v2.5 ,please find the gist here..Thanks !

@tensorflowbutler
Copy link
Member

Hi There,

This is a stale issue. As you are using an older version of tensorflow, we are checking to see if you still need help on this issue. Please test the issue with the latest TensorFlow (TF2.7 and tf-nightly). If the issue still persists with the newer versions of TF, please feel free to open it in keras-team/keras repository by providing details about the issue and a standalone code to reproduce the issue. Thanks!

Please note that Keras development has moved to a separate Keras-team/keras repository to focus entirely on only Keras. Thanks!

@google-ml-butler
Copy link

Are you satisfied with the resolution of your issue?
Yes
No

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:keras Keras related issues comp:tensorboard Tensorboard related issues TF 2.3 Issues related to TF 2.3 type:bug Bug
Projects
None yet
Development

No branches or pull requests