Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keras - failure to create TensorBoard directory

I am trying to create multiple graphs in TensorBoard by saving in separate sub directories, similar to as described here.

However I seem to get an error on the callback - I'm not sure why it is erroring.

Callback:

tensorboard = TensorBoard(log_dir=f"./logs/MODEL", histogram_freq=1,
                                  write_grads=True)

Error:

Traceback (most recent call last):
  File "C:\Users\Ad\AppData\Local\conda\conda\envs\coda\lib\site-packages\IPython\core\interactiveshell.py", line 2963, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-3-7fb3ff8a6fa3>", line 46, in <module>
    validation_split=0.2, callbacks=[tensorboard, metrics])
  File "C:\Users\Ad\AppData\Local\conda\conda\envs\coda\lib\site-packages\keras\engine\training.py", line 1657, in fit
    validation_steps=validation_steps)
  File "C:\Users\Ad\AppData\Local\conda\conda\envs\coda\lib\site-packages\keras\engine\training.py", line 1145, in _fit_loop
    callbacks.set_model(callback_model)
  File "C:\Users\Ad\AppData\Local\conda\conda\envs\coda\lib\site-packages\keras\callbacks.py", line 48, in set_model
    callback.set_model(model)
  File "C:\Users\Ad\AppData\Local\conda\conda\envs\coda\lib\site-packages\keras\callbacks.py", line 710, in set_model
    self.sess.graph)
  File "C:\Users\Ad\AppData\Local\conda\conda\envs\coda\lib\site-packages\tensorflow\python\summary\writer\writer.py", line 336, in __init__
    filename_suffix)
  File "C:\Users\Ad\AppData\Local\conda\conda\envs\coda\lib\site-packages\tensorflow\python\summary\writer\event_file_writer.py", line 67, in __init__
    gfile.MakeDirs(self._logdir)
  File "C:\Users\Ad\AppData\Local\conda\conda\envs\coda\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 368, in recursive_create_dir
    pywrap_tensorflow.RecursivelyCreateDir(compat.as_bytes(dirname), status)
  File "C:\Users\Ad\AppData\Local\conda\conda\envs\coda\lib\site-packages\tensorflow\python\framework\errors_impl.py", line 473, in __exit__
    c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.InvalidArgumentError: Failed to create a directory: ./logs/1-LTSM-NODES-32-DENSE-1: 1535276781.0160034; Invalid argument
like image 832
shbfy Avatar asked Aug 26 '18 09:08

shbfy


2 Answers

I had the same problem. I changed the / to \ and it worked

like image 178
vainv Avatar answered Oct 12 '22 01:10

vainv


This worked for me in Windows

log_dir="logs\\model\\"
like image 4
Mahee Gamage Avatar answered Oct 12 '22 01:10

Mahee Gamage