utils.py 784 B

123456789101112131415161718192021222324
  1. # Copyright (c) Microsoft Corporation.
  2. # SPDX-License-Identifier: Apache-2.0
  3. # DeepSpeed Team
  4. def check_tb_availability():
  5. try:
  6. # torch.utils.tensorboard will fail if `tensorboard` is not available,
  7. # see their docs for more details: https://pytorch.org/docs/1.8.0/tensorboard.html
  8. import tensorboard # noqa: F401 # type: ignore
  9. except ImportError:
  10. print('If you want to use tensorboard logging, please `pip install tensorboard`')
  11. raise
  12. def check_wandb_availability():
  13. try:
  14. import wandb # noqa: F401 # type: ignore
  15. except ImportError:
  16. print(
  17. 'If you want to use wandb logging, please `pip install wandb` and follow the instructions at https://docs.wandb.ai/quickstart'
  18. )
  19. raise