ray/doc/source
matthewdeng 8f9e0d7f6b
[train] add TorchTensorboardProfilerCallback (#22345)
The [original PR](https://github.com/ray-project/ray/pull/21864) was [reverted](https://github.com/ray-project/ray/pull/22117) because it caused `torch` (more specifically, `torch>=1.8.1`) to be required to use `ray.train`.

```
  | File "ray_sgd_training.py", line 18, in <module>
  | from ray import train
  | File "/home/ray/anaconda3/lib/python3.7/site-packages/ray/train/__init__.py", line 2, in <module>
  | from ray.train.callbacks import TrainingCallback
  | File "/home/ray/anaconda3/lib/python3.7/site-packages/ray/train/callbacks/__init__.py", line 8, in <module>
  | from ray.train.callbacks.profile import TorchTensorboardProfilerCallback
  | File "/home/ray/anaconda3/lib/python3.7/site-packages/ray/train/callbacks/profile.py", line 6, in <module>
  | from torch.profiler import profile
  | ModuleNotFoundError: No module named 'torch.profiler'
```

A [minimal installation test suite](https://github.com/ray-project/ray/pull/22300) was added to detect this. Further, in this PR we make the following changes:
1. Move `TorchWorkerProfiler` to `ray.train.torch` so all torch imports are centralized.
2. Add import validation logic to `TorchWorkerProfiler.__init__` so an exception will only be raised if the user tries to initialize a `TorchWorkerProfiler` without having a valid version of `torch` installed:

```
>>> import ray
>>> import ray.train
>>> import ray.train.torch
>>> from ray.train.torch import TorchWorkerProfiler
>>> twp = TorchWorkerProfiler()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/matt/workspace/ray/python/ray/train/torch.py", line 365, in __init__
    "Torch Profiler requires torch>=1.8.1. "
ImportError: Torch Profiler requires torch>=1.8.1. Run `pip install 'torch>=1.8.1'` to use TorchWorkerProfiler.
```
2022-02-14 16:16:55 -08:00
..
_includes [docs] landing page (fixes #21750) (#21859) 2022-01-26 17:14:25 -08:00
_static [docs] landing page (fixes #21750) (#21859) 2022-01-26 17:14:25 -08:00
_templates [Docs] Trial Fathom analytics for doc pages (#17056) 2021-07-14 14:11:52 -07:00
cluster [docs][autoscaler] Add maintainers for node providers (#22237) 2022-02-12 11:31:32 -08:00
data [Datasets] Expose TableRow as public API; minimize copies/type conversions on row-based ops. (#22305) 2022-02-14 12:56:17 -08:00
images [docs] landing page (fixes #21750) (#21859) 2022-01-26 17:14:25 -08:00
ray-contribute [Doc] Correct information about code style (#21985) 2022-02-01 10:37:21 -08:00
ray-core [runtime env] [Doc] Add two ways of installing dependencies: cluster launcher, and runtime env (#20780) 2022-02-14 16:03:48 -06:00
ray-design-patterns [docs] Make design pattern example self contained (#20981) 2021-12-09 20:19:38 -08:00
ray-more-libs [docs] new structure (#21776) 2022-01-21 15:42:05 -08:00
ray-observability [RFC] [Core] Support disabling log redirection via RAY_LOG_TO_STDERR environment variable. (#21767) 2022-01-25 10:52:53 -08:00
ray-overview [Doc] Fix bad links of dask and mars in ray-libraries.rst (#22210) 2022-02-08 19:02:49 +08:00
ray-references [Docs ] Tune docs overhaul (first part) (#22112) 2022-02-07 15:47:03 +00:00
raysgd [Docs ] Tune docs overhaul (first part) (#22112) 2022-02-07 15:47:03 +00:00
rllib [RLlib] Discussion 2022: Fix batch_mode="complete_episodes" documentation inaccuracy. (#22074) 2022-02-10 02:57:27 +01:00
serve [serve] Support user-provided health check via def check_health(self) method (#22178) 2022-02-11 12:53:37 -06:00
train [train] add TorchTensorboardProfilerCallback (#22345) 2022-02-14 16:16:55 -08:00
tune [docs] [tune] hyperopt notebook (#22315) 2022-02-12 02:46:03 -08:00
workflows [docs] landing page (fixes #21750) (#21859) 2022-01-26 17:14:25 -08:00
_toc.yml [Docs ] Tune docs overhaul (first part) (#22112) 2022-02-07 15:47:03 +00:00
conf.py [Docs ] Tune docs overhaul (first part) (#22112) 2022-02-07 15:47:03 +00:00
custom_directives.py [train] add TorchTensorboardProfilerCallback (#22345) 2022-02-14 16:16:55 -08:00
index.md [Docs] Ray Data docs target state (#21931) 2022-01-27 13:14:36 -08:00