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

AttributeError: module 'tensorboard.summary._tf.summary' has no attribute 'FileWriter' #102

Open
ghost opened this issue Jun 3, 2021 · 1 comment

Comments

@ghost
Copy link

ghost commented Jun 3, 2021

I'm getting this error when running !python train_pose2vid.py on colab:

Traceback (most recent call last):
  File "train_pose2vid.py", line 127, in <module>
    main()
  File "train_pose2vid.py", line 43, in main
    visualizer = Visualizer(opt)
  File "/content/drive/My Drive/animation/EveryBodyDance/src/pix2pixHD/util/visualizer.py", line 26, in __init__
    self.writer = tf.summary.FileWriter(self.log_dir)
AttributeError: module 'tensorboard.summary._tf.summary' has no attribute 'FileWriter'

When I changed the line 26 in visualizer.py (as said in this issue: #99), I'm getting this error instead:

Traceback (most recent call last):
  File "train_pose2vid.py", line 127, in <module>
    main()
  File "train_pose2vid.py", line 43, in main
    visualizer = Visualizer(opt)
  File "/content/drive/My Drive/animation/EveryBodyDance/src/pix2pixHD/util/visualizer.py", line 26, in __init__
    self.writer = tf.compat.v1.summary.FileWriter(self.log_dir)
  File "/usr/local/lib/python3.7/dist-packages/tensorflow/python/summary/writer/writer.py", line 360, in __init__
    "v1.summary.FileWriter is not compatible with eager execution. "
RuntimeError: v1.summary.FileWriter is not compatible with eager execution. Use `tf.summary.create_file_writer`,or a `with v1.Graph().as_default():` context

P.S. I changed it to tf.summary.create_file_writer, as said in the error message, and for now I'm not getting this error (it's currently executing this sell)

Getting this error instead now (issue #48):

Traceback (most recent call last):
  File "train_pose2vid.py", line 127, in <module>
    main()
  File "train_pose2vid.py", line 84, in main
    errors = {k: v.data[0] if not isinstance(v, int) else v for k, v in loss_dict.items()}
  File "train_pose2vid.py", line 84, in <dictcomp>
    errors = {k: v.data[0] if not isinstance(v, int) else v for k, v in loss_dict.items()}
IndexError: invalid index of a 0-dim tensor. Use `tensor.item()` in Python or `tensor.item<T>()` in C++ to convert a 0-dim tensor to a number
@ghost ghost mentioned this issue Jun 3, 2021
@dklingmann
Copy link

dklingmann commented Jun 3, 2021

What version of tensorflow are you using? You can find this by printing the __version__ attribute
print(tensorflow.__version__) for example.

If you are using GoogleColab, try:
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
%tensorflow_version 1.x

before running !python train_pose2vid.py

The IndexError message is related to:
errors = {k: v.data[0] if not isinstance(v, int) else v for k, v in loss_dict.items()}
See #100 : replace v.data[0] with v.data.item()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant