Error with keras.callbacks.Tensorboard for visualizing Emebeddings

243 views
Skip to first unread message

boardw...@gmail.com

unread,
Nov 27, 2019, 5:06:03 AM11/27/19
to Keras-users
Hello,

I am using:
keras 2.3.0
tensorflow 1.14.1
python 3.7.4
Ubuntu 16.04.6

and try to visualize embeddings within tensorboard:

hereafter my code:

# logs tensorboard
    tensorboard_callback=keras.callbacks.TensorBoard(log_dir=logs_path+"logs/lstm_{}".format(time()),histogram_freq = 1,embeddings_freq = 1,embeddings_layer_names="my_embeddings",embeddings_data=train,embeddings_metadata={'my_embeddings':my_path+labelfile})

If I do not use the embeddings parameter (see 4 parameters belows), everything works fine.

But with embedding parameters, I get the following error:

Traceback (most recent call last):
  File "/home/ypsa6500/anaconda3/envs/tensorflow_gpuenv/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 1356, in _do_call
    return fn(*args)
  File "/home/ypsa6500/anaconda3/envs/tensorflow_gpuenv/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 1341, in _run_fn
    options, feed_dict, fetch_list, target_list, run_metadata)
  File "/home/ypsa6500/anaconda3/envs/tensorflow_gpuenv/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 1429, in _call_tf_sessionrun
    run_metadata)
tensorflow.python.framework.errors_impl.FailedPreconditionError: Error while reading resource variable Variable from Container: localhost. This could mean that the variable was uninitialized. Not found: Resource localhost/Variable/N10tensorflow3VarE does not exist.
     [[{{node my_embeddings_embedding/Initializer/ReadVariableOp}}]]

Remark:
- with other version of keras and tensorflow (older version) where Tendorboard do not require "embedding_data" parameter, everything works fine.
- the keras online documentation, uses : keras.callbacks.tensorboard_v1.Tensorboard which I have tried as well, I get error as well (not the same)

Endly, can you say me how I can use keras callback to visualize embedding in tensorboard (with the version described above) ?


boardw...@gmail.com

unread,
Dec 4, 2019, 11:25:30 AM12/4/19
to Keras-users
Any idea @fchollet ?
Reply all
Reply to author
Forward
0 new messages