> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gpuhub.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Visdom

> Visdom is a visualization tool that generates rich visualizations of live data to help researchers and developers stay on top of their scientific experiments that are run on remote servers.

<img src="https://mintcdn.com/gpuhub/r1V0ko0l9sh4RwWM/images/logo-visdom.png?fit=max&auto=format&n=r1V0ko0l9sh4RwWM&q=85&s=5f0dfe78d118bd8c0a5fef3fd7fda8e5" alt="" width="64" height="64" data-path="images/logo-visdom.png" />

## SSH Tunneling Method

1. Start Visdom in the instance (it will listen on port 8097 by default).
2. In the terminal on your local computer, execute the command:

```bash bash theme={null}
ssh -CNgv -L 8097:127.0.0.1:8097 root@region-1.gpuhub.com -p 37881
```

In here, `8097:127.0.0.1:8097` means forwarding the Visdom Server's port `8097` to your local port `8097`, and `root@region-1.gpuhub.com` and `37881` are the access address and port of the instance's SSH command, respectively. Please replace them accordingly.

<Note>
  It is normal not to see any logs after executing the above ssh command, as long as it does not prompt you to re-enter your password or exit.
</Note>

Example:

```
 @seeta:~$ ssh -CNg -L 8097:127.0.0.1:8097 root@region-1.gpuhub.com -p 37881
The authenticity of host '[region-1.gpuhub.com]:37881 ([120.92.100.9]:37881)' can't be established.
ECDSA key fingerprint is SHA256:eNwieuMEZiNCONaDJXFsAJRBfTnU7f3gQWZ+A2n1j1o.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[region-1.gpuhub.com]:37881,[120.92.100.9]:37881' (ECDSA) to the list of known hosts.
root@region-1.gpuhub.com's password:
```

Access `127.0.0.1:8097` in your local web browser to open Visdom.

<img src="https://mintcdn.com/gpuhub/yLmjMPcqL-OhC9CD/images/bestpractices-visdom-1.png?fit=max&auto=format&n=yLmjMPcqL-OhC9CD&q=85&s=162e6c3d2e7e35c52fcd30d12d7cd7be" alt="" width="1076" height="350" data-path="images/bestpractices-visdom-1.png" />

## Custom Service Method

Start the instance and locate the "Custom Services" entry point.

<img src="https://mintcdn.com/gpuhub/A2ZFUcrXY6_96IJm/images/bestpractices-visdom-2.png?fit=max&auto=format&n=A2ZFUcrXY6_96IJm&q=85&s=076b53ef61a25950eaee2373fd2c05c2" alt="" width="1642" height="656" data-path="images/bestpractices-visdom-2.png" />

From the prompt, it is clear that we only need to start Visdom on port 6006 to access it via the "Custom Services" portal:
Start Visdom in the instance and specify the port as `6006`.

```
# If Visdom is not installed, first execute pip install visdom to install it
# visdom -port 6006
Checking for scripts.
It's Alive!
INFO:root:Application Started
You can navigate to http://container-7e5111bf0c-8a82bc6b:6006
```

Additionally, since the Visdom client defaults to connecting to the Visdom server on the original port, you need to modify the construction of the Visdom object in the client code as follows:

```python python theme={null}
vis = Visdom(server='http://localhost', port='6006', env='main')
```

After starting, access the custom service in your local browser.

<img src="https://mintcdn.com/gpuhub/yLmjMPcqL-OhC9CD/images/bestpractices-visdom-3.png?fit=max&auto=format&n=yLmjMPcqL-OhC9CD&q=85&s=e73b3130fa33497655a64a8ce4b9cf16" alt="" width="1408" height="427" data-path="images/bestpractices-visdom-3.png" />
