Last active
January 19, 2019 02:20
-
-
Save rbarman/9c893e04b8a07ac2ccaaff0f152809e6 to your computer and use it in GitHub Desktop.
Tensorboard on google colab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# imports, etc | |
from keras.callbacks import TensorBoard | |
# install ngrok | |
!wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip | |
!unzip ngrok-stable-linux-amd64.zip | |
# specify the log location | |
LOG_DIR = './log' | |
get_ipython().system_raw(f'tensorboard --logdir {LOG_DIR} --host 0.0.0.0 --port 6006 &') | |
get_ipython().system_raw('./ngrok http 6006 &') | |
# get a link to tensorboard session | |
! curl -s http://localhost:4040/api/tunnels | python3 -c \ | |
"import sys, json; print(json.load(sys.stdin)['tunnels'][0]['public_url'])" | |
# preprocess data, create model, etc ... | |
# run model | |
RUN_NAME = 'first model' | |
callback = TensorBoard(log_dir=f'{LOG_DIR}/{RUN_NAME}') | |
history = model.fit(... , callbacks=[callback]) | |
# history = model.fit_generator( ... , callbacks = [callback]) , etc | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment