Nextjournal / Nov 05 2019
Tensorboard Environment
Import Tensorflow + Tensorboard docker image, (tensorflow/tensorflow:latest-py3-jupyter).
TF
Download as Docker image from:
Copy
This image was imported from: tensorflow/tensorflow:latest-py3-jupyter
apt-get install -y gitpip install jupyter jupyter_client \ git+https://github.com/nextjournal/jupyter_core12.7s
TF+TB (Bash)
TF
restore jupyter connection file permissions if jupyter runtime refuses to start
ls -lah runtimes/jupyter/kernel_connection.jsonchmod 600 runtimes/jupyter/kernel_connection.jsonls -lah runtimes/jupyter/kernel_connection.json0.8s
Fix Permissions (Bash in Python)
Test in Jupyter Runtime
%load_ext tensorboard0.1s
Jupyter Test (Python 3)
TF+TB
Until we fork tensorboard,
# TODO: fork tensorboardfrom IPython.display import publish_display_datafrom tensorboard import notebookimport uuiddef _nextjournal_display(port=None, print_message=False, display_handle=None): display_id = str(uuid.uuid4()) print("TENSORBOARD NEXTJOURNAL DISPLAY - %s" % display_id) data = {"application/vnd.nextjournal.tensorboard+html": "<meta name='nextjournal-display-id' value='%s' />" % display_id} publish_display_data(data, metadata=None, source=None) notebook._display = _nextjournal_displayShift+Enter to run
Jupyter Test (Python 3)
TF+TB
import tensorflow as tfprint("TensorFlow version: ", tf.__version__)# print(version.parse(tf.__version__))# %tensorflow_version 2.x2.5s
Jupyter Test (Python 3)
TF+TB
%tensorboard --logdir logs/train_data --host="0.0.0.0" --port=99982.6s
Jupyter Test (Python 3)
TF+TB
Launching TensorBoard...
/runner/Lpxj2cZwiRrLtUsN5rpbp/runtime/runtime-id/5a2cf4f9-166a-4191-87b5-2d354202c4d4Tensorboard in Nextrepl Runtimes
from tensorboard import notebookimport uuidclass TB(object): def __init__(self, logdir): notebook.start("--port 9998 --bind_all --logdir %s" % logdir) def _repr_mimebundle_(self): return {'application/vnd.nextjournal.tensorboard+html': "<meta name='nj-display-id' value='%s'/>" % str(uuid.uuid4())}0.1s
Nextrepl Test (Python)
TF+TB
tb = TB("/train_data/logs")tb0.0s
Nextrepl Test (Python)
TF+TB
end