In this note we will cover the use of the TensorBoard callback <.TensorBoard>
to log to visdom. See the tensorboard note for more on the callback in general.
We'll use the same setup as the tensorboard note.
/_static/examples/visdom_note.py
/_static/examples/visdom_note.py
Visdom does not support logging model graphs so we shall start with logging epoch and batch metrics. The only change we need to make to the tensorboard example is setting visdom=True
in the TensorBoard callback <.TensorBoard>
constructor.
/_static/examples/visdom_note.py
If your visdom server is running then you should see something similar to the figure below:
The visdom client defaults to logging to localhost:8097 in the main environment however this is rather restrictive. We would like to be able to log to any server on any port and in any environment. To do this we need to edit the .VisdomParams
class.
class VisdomParams:
""" ... """
SERVER = 'http://localhost'
ENDPOINT = 'events'
PORT = 8097
IPV6 = True
HTTP_PROXY_HOST = None
HTTP_PROXY_PORT = None
ENV = 'main'
SEND = True
RAISE_EXCEPTIONS = None
USE_INCOMING_SOCKET = True
LOG_TO_FILENAME = None
We first import the tensorboard file.
/_static/examples/visdom_note.py
We can then edit the visdom client parameters, for example, changing the environment to "Test".
/_static/examples/visdom_note.py
Running another fit call, we can see we are now logging to the "Test" environment.
The only paramenter that the TensorBoard callback <.TensorBoard>
sets explicity (and cannot be overrided) is the LOG_TO_FILENAME parameter. This is set to the log_dir given on the callback init.
The source code for this example is given below:
Download Python source code: visdom.py </_static/examples/visdom_note.py>