From 10b959055e1dbc1607a01cae0e508df740e9748d Mon Sep 17 00:00:00 2001 From: Nikita Shulga <2453524+malfet@users.noreply.github.com> Date: Fri, 26 Jan 2024 17:29:14 -0800 Subject: [PATCH 1/2] Make coding_ddpg runnable in CoLab end to end By adding `pip install` cell as well as unhiding `from typing import Tuple` --- advanced_source/coding_ddpg.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/advanced_source/coding_ddpg.py b/advanced_source/coding_ddpg.py index 41f02628213..f7c76455978 100644 --- a/advanced_source/coding_ddpg.py +++ b/advanced_source/coding_ddpg.py @@ -58,26 +58,25 @@ # Imports and setup # ----------------- # +# %% +# .. code-block:: bash +# +# %%bash +# pip3 install torchrl mujoco glfw import torchrl +import torch +import tqdm +from typing import Tuple # sphinx_gallery_start_ignore import warnings -from typing import Tuple - warnings.filterwarnings("ignore") # sphinx_gallery_end_ignore -import torch.cuda -import tqdm - -import torch.multiprocessing - ############################################################################### # We will execute the policy on CUDA if available -device = ( - torch.device("cpu") if torch.cuda.device_count() == 0 else torch.device("cuda:0") -) +device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") collector_device = torch.device("cpu") # Change the device to ``cuda`` to use CUDA ############################################################################### From 3b9850bf40a193b78529a5aeac7572f37b380f9a Mon Sep 17 00:00:00 2001 From: Nikita Shulga <2453524+malfet@users.noreply.github.com> Date: Fri, 26 Jan 2024 19:08:11 -0800 Subject: [PATCH 2/2] Update coding_ddpg.py --- advanced_source/coding_ddpg.py | 1 - 1 file changed, 1 deletion(-) diff --git a/advanced_source/coding_ddpg.py b/advanced_source/coding_ddpg.py index f7c76455978..7486b6e0e94 100644 --- a/advanced_source/coding_ddpg.py +++ b/advanced_source/coding_ddpg.py @@ -58,7 +58,6 @@ # Imports and setup # ----------------- # -# %% # .. code-block:: bash # # %%bash