Skip to content

Make coding_ddpg runnable in CoLab end to end #2748

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions advanced_source/coding_ddpg.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,26 +58,24 @@
# 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

###############################################################################
Expand Down