Skip to content

Commit

Permalink
[BugFix] fix formatting for VideoRecorder docstring (#1985)
Browse files Browse the repository at this point in the history
  • Loading branch information
sriramsk1999 authored Mar 3, 2024
1 parent 6abc9bf commit 52c7e39
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions torchrl/record/recorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,27 @@ class VideoRecorder(ObservationTransform):
Examples:
The following example shows how to save a rollout under a video. First a few imports:
>>> from torchrl.record import VideoRecorder
>>> from torchrl.record.loggers.csv import CSVLogger
>>> from torchrl.envs import TransformedEnv, DMControlEnv
The video format is chosen in the logger. Wandb and tensorboard will take care of that
on their own, CSV accepts various video formats.
>>> logger = CSVLogger(exp_name="cheetah", log_dir="cheetah_videos", video_format="mp4")
Some envs (eg, Atari games) natively return images, some require the user to ask for them.
Check :class:`~torchrl.env.GymEnv` or :class:`~torchrl.envs.DMControlEnv` to see how to render images
Check :class:`~torchrl.envs.GymEnv` or :class:`~torchrl.envs.DMControlEnv` to see how to render images
in these contexts.
>>> base_env = DMControlEnv("cheetah", "run", from_pixels=True)
>>> env = TransformedEnv(base_env, VideoRecorder(logger=logger, tag="run_video"))
>>> env.rollout(100)
All transforms have a dump function, mostly a no-op except for ``VideoRecorder``, and :class:`~torchrl.envs.transforms.Composite`
All transforms have a dump function, mostly a no-op except for ``VideoRecorder``, and :class:`~torchrl.envs.transforms.Compose`
which will dispatch the `dumps` to all its members.
>>> env.transform.dump()
Our video is available under ``./cheetah_videos/cheetah/videos/run_video_0.mp4``!
Expand Down

0 comments on commit 52c7e39

Please sign in to comment.