Skip to content

Commit

Permalink
Move tensorboard to the dev only dependency in vissl (facebookresearc…
Browse files Browse the repository at this point in the history
…h#205)

Summary:
Pull Request resolved: facebookresearch#205

making tensorboard dev only dependency and when user uses tensorboard, we will throw the assert if tensorboard is not installed. In the assert message, we give instruction for how to install tensorboard.

Reviewed By: bottler

Differential Revision: D26725359

fbshipit-source-id: 6b2c663583c22a98aad5b389016575f2237fe34a
  • Loading branch information
prigoyal authored and facebook-github-bot committed Mar 1, 2021
1 parent 179e293 commit 962be15
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 19 deletions.
1 change: 0 additions & 1 deletion dev/packaging/vissl_conda/vissl/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ requirements:
- pytorch
- apex
- torchvision>=0.5
- tensorboard>=1.15
- scipy
- scikit-learn
- parameterized
Expand Down
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ sphinx_rtd_theme
sphinx_markdown_tables
mock
opencv-python
tensorboard==1.15.0
tensorboard
hydra-core>=1.0
faiss-gpu
cython
Expand Down
35 changes: 20 additions & 15 deletions docs/source/visualization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,26 @@ parameters exposed by VISSL for Tensorboard:

.. code-block:: yaml
TENSORBOARD_SETUP:
# whether to use tensorboard for the visualization
USE_TENSORBOARD: False
# log directory for tensorboard events
LOG_DIR: "."
EXPERIMENT_LOG_DIR: "tensorboard"
# flush logs every n minutes
FLUSH_EVERY_N_MIN: 5
# whether to log the model parameters to tensorboard
LOG_PARAMS: True
# whether ttp log the model parameters gradients to tensorboard
LOG_PARAMS_GRADIENTS: True
# if we want to log the model parameters every few iterations, set the iteration
# frequency. -1 means the params will be logged only at the end of epochs.
LOG_PARAMS_EVERY_N_ITERS: 310
HOOKS:
TENSORBOARD_SETUP:
# whether to use tensorboard for the visualization
USE_TENSORBOARD: False
# log directory for tensorboard events
LOG_DIR: "."
EXPERIMENT_LOG_DIR: "tensorboard"
# flush logs every n minutes
FLUSH_EVERY_N_MIN: 5
# whether to log the model parameters to tensorboard
LOG_PARAMS: True
# whether ttp log the model parameters gradients to tensorboard
LOG_PARAMS_GRADIENTS: True
# if we want to log the model parameters every few iterations, set the iteration
# frequency. -1 means the params will be logged only at the end of epochs.
LOG_PARAMS_EVERY_N_ITERS: 310
.. note::

Please install tensorboard manually: if pip environment: :code:`pip install tensorboard` or if using conda and you prefer conda install of tensorboard: :code:`conda install -c conda-forge tensorboard`.

Example usage
---------------
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
tensorboard==1.15.0
hydra-core>=1.0
cython
scikit-learn
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def get_version():
"bs4",
"faiss-gpu",
"pycocotools>=2.0.1",
"tensorboard>=1.15",
]
},
)
7 changes: 6 additions & 1 deletion vissl/hooks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,12 @@ def default_hook_generator(cfg: AttrDict) -> List[ClassyHook]:
if cfg.HOOKS.MEMORY_SUMMARY.PRINT_MEMORY_SUMMARY:
hooks.extend([LogGpuMemoryHook(cfg.HOOKS.MEMORY_SUMMARY.LOG_ITERATION_NUM)])
if cfg.HOOKS.TENSORBOARD_SETUP.USE_TENSORBOARD:
assert is_tensorboard_available(), "Tensorboard must be installed to use it."
assert is_tensorboard_available(), (
"Tensorboard must be installed to use it. Please install tensorboard using:"
"If pip environment: `pip install tensorboard` "
"If using conda and you prefer conda install of tensorboard: "
"`conda install -c conda-forge tensorboard`"
)
tb_hook = get_tensorboard_hook(cfg)
hooks.extend([tb_hook])
if cfg.MODEL.GRAD_CLIP.USE_GRAD_CLIP:
Expand Down

0 comments on commit 962be15

Please sign in to comment.