Search code examples
pythontensorflowkerastensorboard

TensorBoard log dir problem in Windows and semicolon


I dont know if it is a problem with TensorBoard itself or I am doing something wrong here... When I provide a path with log_dir, it looks like a semicolon is added at the end, and it is using forward slash when I am on Windows.

Here is my code:


timestamp = datetime.datetime.now().strftime('%Y-%m-%d-%H:%M:%S')
callbacks = keras.callbacks.TensorBoard(log_dir='log\\' + timestamp,
                                            histogram_freq=0, write_graph=True, write_images=False)

I tried to use Path from pathlib, but it does not work either.

timestamp = Path(datetime.datetime.now().strftime('%Y-%m-%d--%H:%M:%S'))
log_dir = 'Graph' / timestamp

The error looks like:

tensorflow.python.framework.errors_impl.InvalidArgumentError: Failed to create a directory: log/2019-04-25-00:15:25; Invalid argument

Any ideas...?

Edit:

Yes, if I print my timestamp it has no semicolon at the end.

Versions: Python: 3.6.7 Keras: 2.2.4 Tensorflow: 1.13.1


Solution

  • If you are using Windows OS, / \ : * ? " < > | this are the characters which are not allowed to create file name. Because of the colon (:) you are not able to create a folder.