tensorboard)I have built a GAN with TF 2.0-alpha using tf.keras. I am using TensorBoard via train_writer = tf.summary.create_file_writer("log-train"). Adding scalars with tf.summary.scalar("loss g", loss_g, step=batch_id) and storing predicted images with tf.summary.image("g pred", prediction[0:3], step=batch_id) works without any problems.
However, when I try to add the generator's weights to TensorBoard with tf.summary.histogram it fails.
for layer in G_model.layers:
for weight in layer.weights:
tf.summary.histogram(weight.name, weight, step=batch_id)
G_model is a tf.keras model created with the functional API.
The exception seems to be TensorBoard-specific:
Traceback (most recent call last):
File "train.py", line 84, in <module>
tf.summary.histogram(weight.name, weight, step=batch_id)
File "(...)/python3.6/site-packages/tensorboard/plugins/histogram/summary_v2.py", line 73, in histogram
tensor = _buckets(data, bucket_count=buckets)
File "(...)/python3.6/site-packages/tensorboard/plugins/histogram/summary_v2.py", line 91, in _buckets
with tf.name_scope('buckets', values=[data, bucket_count]):
TypeError: __init__() got an unexpected keyword argument 'values'
If I simply delete , values=[data, bucket_count] in summary_v2.py (line 91) it works, weights are showing up correctly in TensorBoard then.
Thus, original code of summary_v2.py in line 91:
with tf.name_scope('buckets', values=[data, bucket_count]):
throws the exception posted above, while this code:
with tf.name_scope('buckets'):
is working properly.
Hi @Daniel451! Thanks for the report; I can reproduce this.
This should be fixed by #1933, which did not make it into the
1.14.0a20190301 version of TensorBoard bundled with the TF 2.0 alpha,
but did make it into the next day鈥檚 1.14.0a20190302.
We can push a patch release 1.14.0a20190301.post001 that would; cc
@nfelt @stephanwlee as to whether we want to do this, noting that we
also considered cherry-picking #1945.
@Daniel451 just to be clear, for now a workaround is to pip install --upgrade tb-nightly which will get you a version of the nightly TensorBoard build that includes the fix for this in #1933.
Closing this issue as this should be resolved with tb-nightly.
Most helpful comment
@Daniel451 just to be clear, for now a workaround is to
pip install --upgrade tb-nightlywhich will get you a version of the nightly TensorBoard build that includes the fix for this in #1933.