I'm trying to use tensorboard dashboard to check the model performance. Below is the code I used:
from keras.callbacks import TensorBoard
%load_ext tensorboard
log_dir = "logs/fit/" + datetime.now().strftime("%Y%m%d-%H%M%S")
tensorboard_callback = TensorBoard(log_dir=log_dir, histogram_freq=1)
checkpoint_name = 'Weights-{epoch:03d}--{val_loss:.5f}.hdf5'
checkpoint = ModelCheckpoint(checkpoint_name, monitor='val_loss', verbose = 1, save_best_only = True, mode ='auto')
es = EarlyStopping(monitor='val_loss', verbose=1, patience=10)
callbacks_list = [checkpoint ,es,tensorboard_callback]
NN_model.fit(train, target, epochs=100, batch_size=32, validation_split = 0.2, callbacks=callbacks_list)
But after the model training, I could not display the dashboard:
%tensorboard --logdir logs
Here's the error I got:
ERROR: Could not find `tensorboard`. Please ensure that your PATH
contains an executable `tensorboard` program, or explicitly specify
the path to a TensorBoard binary by setting the `TENSORBOARD_BINARY`
environment variable.
It probably happens because of some conflict between notebook and virtual environment.
An easy solution here would be just to specify TENSORBOARD_BINARY
variable right in your notebook, so it won't interfere with global variables, before calling tensorboard like that:
os.environ['TENSORBOARD_BINARY'] = '/path/to/envs/my_env/bin/tensorboard'
A longterm solution would be to set up a variable for virtual environment like it was proposed here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With