tensorboard.rst 1.96 KB
Newer Older
1
2
Visualize Trial with TensorBoard
================================
J-shang's avatar
J-shang committed
3

4
5

You can launch a tensorboard process cross one or multi trials within webportal since NNI v2.2. This feature supports local training service and reuse mode training service with shared storage for now, and will support more scenarios in later nni version.
J-shang's avatar
J-shang committed
6
7
8
9
10
11
12
13
14

Preparation
-----------

Make sure tensorboard installed in your environment. If you never used tensorboard, here are getting start tutorials for your reference, `tensorboard with tensorflow <https://www.tensorflow.org/tensorboard/get_started>`__, `tensorboard with pytorch <https://pytorch.org/tutorials/recipes/recipes/tensorboard_with_pytorch.html>`__.

Use WebUI Launch Tensorboard
----------------------------

15
16
Save Logs
^^^^^^^^^
J-shang's avatar
J-shang committed
17
18
19
20
21
22
23

NNI will automatically fetch the ``tensorboard`` subfolder under trial's output folder as tensorboard logdir. So in trial's source code, you need to save the tensorboard logs under ``NNI_OUTPUT_DIR/tensorboard``. This log path can be joined as:

.. code-block:: python

    log_dir = os.path.join(os.environ["NNI_OUTPUT_DIR"], 'tensorboard')

24
25
Launch Tensorboard
^^^^^^^^^^^^^^^^^^
J-shang's avatar
J-shang committed
26

27
* Like compare, select the trials you want to combine to launch the tensorboard at first, then click the ``Tensorboard`` button.
J-shang's avatar
J-shang committed
28

29
30
.. image:: ../../../img/Tensorboard_1.png
   :target: ../../../img/Tensorboard_1.png
J-shang's avatar
J-shang committed
31
32
   :alt: 

33
* After click the ``OK`` button in the pop-up box, you will jump to the tensorboard portal.
J-shang's avatar
J-shang committed
34

35
36
.. image:: ../../../img/Tensorboard_2.png
   :target: ../../../img/Tensorboard_2.png
J-shang's avatar
J-shang committed
37
38
   :alt: 

39
* You can see the ``SequenceID-TrialID`` on the tensorboard portal.
J-shang's avatar
J-shang committed
40

41
42
.. image:: ../../../img/Tensorboard_3.png
   :target: ../../../img/Tensorboard_3.png
J-shang's avatar
J-shang committed
43
44
   :alt: 

45
46
47
Stop All
^^^^^^^^

J-shang's avatar
J-shang committed
48
49
50

If you want to open the portal you have already launched, click the tensorboard id. If you don't need the tensorboard anymore, click ``Stop all tensorboard`` button.

51
52
.. image:: ../../../img/Tensorboard_4.png
   :target: ../../../img/Tensorboard_4.png
J-shang's avatar
J-shang committed
53
   :alt: 
54
55