pushing model
Browse files- README.md +77 -0
- ddpg_continuous_action.cleanrl_model +0 -0
- ddpg_continuous_action.py +283 -0
- events.out.tfevents.1688065015.3090-172.1344199.0 +3 -0
- poetry.lock +0 -0
- pyproject.toml +113 -0
- replay.mp4 +0 -0
- videos/Walker2d-v2__ddpg_continuous_action__1__1688065009-eval/rl-video-episode-0.mp4 +0 -0
- videos/Walker2d-v2__ddpg_continuous_action__1__1688065009-eval/rl-video-episode-1.mp4 +0 -0
- videos/Walker2d-v2__ddpg_continuous_action__1__1688065009-eval/rl-video-episode-8.mp4 +0 -0
README.md
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
tags:
|
3 |
+
- Walker2d-v2
|
4 |
+
- deep-reinforcement-learning
|
5 |
+
- reinforcement-learning
|
6 |
+
- custom-implementation
|
7 |
+
library_name: cleanrl
|
8 |
+
model-index:
|
9 |
+
- name: DDPG
|
10 |
+
results:
|
11 |
+
- task:
|
12 |
+
type: reinforcement-learning
|
13 |
+
name: reinforcement-learning
|
14 |
+
dataset:
|
15 |
+
name: Walker2d-v2
|
16 |
+
type: Walker2d-v2
|
17 |
+
metrics:
|
18 |
+
- type: mean_reward
|
19 |
+
value: 993.74 +/- 1095.19
|
20 |
+
name: mean_reward
|
21 |
+
verified: false
|
22 |
+
---
|
23 |
+
|
24 |
+
# (CleanRL) **DDPG** Agent Playing **Walker2d-v2**
|
25 |
+
|
26 |
+
This is a trained model of a DDPG agent playing Walker2d-v2.
|
27 |
+
The model was trained by using [CleanRL](https://github.com/vwxyzjn/cleanrl) and the most up-to-date training code can be
|
28 |
+
found [here](https://github.com/vwxyzjn/cleanrl/blob/master/cleanrl/ddpg_continuous_action.py).
|
29 |
+
|
30 |
+
## Get Started
|
31 |
+
|
32 |
+
To use this model, please install the `cleanrl` package with the following command:
|
33 |
+
|
34 |
+
```
|
35 |
+
pip install "cleanrl[ddpg_continuous_action]"
|
36 |
+
python -m cleanrl_utils.enjoy --exp-name ddpg_continuous_action --env-id Walker2d-v2
|
37 |
+
```
|
38 |
+
|
39 |
+
Please refer to the [documentation](https://docs.cleanrl.dev/get-started/zoo/) for more detail.
|
40 |
+
|
41 |
+
|
42 |
+
## Command to reproduce the training
|
43 |
+
|
44 |
+
```bash
|
45 |
+
curl -OL https://huggingface.co/cleanrl/Walker2d-v2-ddpg_continuous_action-seed1/raw/main/ddpg_continuous_action.py
|
46 |
+
curl -OL https://huggingface.co/cleanrl/Walker2d-v2-ddpg_continuous_action-seed1/raw/main/pyproject.toml
|
47 |
+
curl -OL https://huggingface.co/cleanrl/Walker2d-v2-ddpg_continuous_action-seed1/raw/main/poetry.lock
|
48 |
+
poetry install --all-extras
|
49 |
+
python ddpg_continuous_action.py --track --capture-video --save-model --hf-entity cleanrl --upload-model --env-id Walker2d-v2 --seed 1
|
50 |
+
```
|
51 |
+
|
52 |
+
# Hyperparameters
|
53 |
+
```python
|
54 |
+
{'batch_size': 256,
|
55 |
+
'buffer_size': 1000000,
|
56 |
+
'capture_video': True,
|
57 |
+
'cuda': True,
|
58 |
+
'env_id': 'Walker2d-v2',
|
59 |
+
'exp_name': 'ddpg_continuous_action',
|
60 |
+
'exploration_noise': 0.1,
|
61 |
+
'gamma': 0.99,
|
62 |
+
'hf_entity': 'cleanrl',
|
63 |
+
'learning_rate': 0.0003,
|
64 |
+
'learning_starts': 25000.0,
|
65 |
+
'noise_clip': 0.5,
|
66 |
+
'policy_frequency': 2,
|
67 |
+
'save_model': True,
|
68 |
+
'seed': 1,
|
69 |
+
'tau': 0.005,
|
70 |
+
'torch_deterministic': True,
|
71 |
+
'total_timesteps': 1000000,
|
72 |
+
'track': True,
|
73 |
+
'upload_model': True,
|
74 |
+
'wandb_entity': None,
|
75 |
+
'wandb_project_name': 'cleanRL'}
|
76 |
+
```
|
77 |
+
|
ddpg_continuous_action.cleanrl_model
ADDED
Binary file (581 kB). View file
|
|
ddpg_continuous_action.py
ADDED
@@ -0,0 +1,283 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# docs and experiment results can be found at https://docs.cleanrl.dev/rl-algorithms/ddpg/#ddpg_continuous_actionpy
|
2 |
+
import argparse
|
3 |
+
import os
|
4 |
+
import random
|
5 |
+
import time
|
6 |
+
from distutils.util import strtobool
|
7 |
+
|
8 |
+
import gymnasium as gym
|
9 |
+
import numpy as np
|
10 |
+
import torch
|
11 |
+
import torch.nn as nn
|
12 |
+
import torch.nn.functional as F
|
13 |
+
import torch.optim as optim
|
14 |
+
from stable_baselines3.common.buffers import ReplayBuffer
|
15 |
+
from torch.utils.tensorboard import SummaryWriter
|
16 |
+
|
17 |
+
|
18 |
+
def parse_args():
|
19 |
+
# fmt: off
|
20 |
+
parser = argparse.ArgumentParser()
|
21 |
+
parser.add_argument("--exp-name", type=str, default=os.path.basename(__file__).rstrip(".py"),
|
22 |
+
help="the name of this experiment")
|
23 |
+
parser.add_argument("--seed", type=int, default=1,
|
24 |
+
help="seed of the experiment")
|
25 |
+
parser.add_argument("--torch-deterministic", type=lambda x: bool(strtobool(x)), default=True, nargs="?", const=True,
|
26 |
+
help="if toggled, `torch.backends.cudnn.deterministic=False`")
|
27 |
+
parser.add_argument("--cuda", type=lambda x: bool(strtobool(x)), default=True, nargs="?", const=True,
|
28 |
+
help="if toggled, cuda will be enabled by default")
|
29 |
+
parser.add_argument("--track", type=lambda x: bool(strtobool(x)), default=False, nargs="?", const=True,
|
30 |
+
help="if toggled, this experiment will be tracked with Weights and Biases")
|
31 |
+
parser.add_argument("--wandb-project-name", type=str, default="cleanRL",
|
32 |
+
help="the wandb's project name")
|
33 |
+
parser.add_argument("--wandb-entity", type=str, default=None,
|
34 |
+
help="the entity (team) of wandb's project")
|
35 |
+
parser.add_argument("--capture-video", type=lambda x: bool(strtobool(x)), default=False, nargs="?", const=True,
|
36 |
+
help="whether to capture videos of the agent performances (check out `videos` folder)")
|
37 |
+
parser.add_argument("--save-model", type=lambda x: bool(strtobool(x)), default=False, nargs="?", const=True,
|
38 |
+
help="whether to save model into the `runs/{run_name}` folder")
|
39 |
+
parser.add_argument("--upload-model", type=lambda x: bool(strtobool(x)), default=False, nargs="?", const=True,
|
40 |
+
help="whether to upload the saved model to huggingface")
|
41 |
+
parser.add_argument("--hf-entity", type=str, default="",
|
42 |
+
help="the user or org name of the model repository from the Hugging Face Hub")
|
43 |
+
|
44 |
+
# Algorithm specific arguments
|
45 |
+
parser.add_argument("--env-id", type=str, default="HalfCheetah-v4",
|
46 |
+
help="the id of the environment")
|
47 |
+
parser.add_argument("--total-timesteps", type=int, default=1000000,
|
48 |
+
help="total timesteps of the experiments")
|
49 |
+
parser.add_argument("--learning-rate", type=float, default=3e-4,
|
50 |
+
help="the learning rate of the optimizer")
|
51 |
+
parser.add_argument("--buffer-size", type=int, default=int(1e6),
|
52 |
+
help="the replay memory buffer size")
|
53 |
+
parser.add_argument("--gamma", type=float, default=0.99,
|
54 |
+
help="the discount factor gamma")
|
55 |
+
parser.add_argument("--tau", type=float, default=0.005,
|
56 |
+
help="target smoothing coefficient (default: 0.005)")
|
57 |
+
parser.add_argument("--batch-size", type=int, default=256,
|
58 |
+
help="the batch size of sample from the reply memory")
|
59 |
+
parser.add_argument("--exploration-noise", type=float, default=0.1,
|
60 |
+
help="the scale of exploration noise")
|
61 |
+
parser.add_argument("--learning-starts", type=int, default=25e3,
|
62 |
+
help="timestep to start learning")
|
63 |
+
parser.add_argument("--policy-frequency", type=int, default=2,
|
64 |
+
help="the frequency of training policy (delayed)")
|
65 |
+
parser.add_argument("--noise-clip", type=float, default=0.5,
|
66 |
+
help="noise clip parameter of the Target Policy Smoothing Regularization")
|
67 |
+
args = parser.parse_args()
|
68 |
+
# fmt: on
|
69 |
+
return args
|
70 |
+
|
71 |
+
|
72 |
+
def make_env(env_id, seed, idx, capture_video, run_name):
|
73 |
+
def thunk():
|
74 |
+
if capture_video:
|
75 |
+
env = gym.make(env_id, render_mode="rgb_array")
|
76 |
+
else:
|
77 |
+
env = gym.make(env_id)
|
78 |
+
env = gym.wrappers.RecordEpisodeStatistics(env)
|
79 |
+
if capture_video:
|
80 |
+
if idx == 0:
|
81 |
+
env = gym.wrappers.RecordVideo(env, f"videos/{run_name}")
|
82 |
+
env.action_space.seed(seed)
|
83 |
+
env.observation_space.seed(seed)
|
84 |
+
return env
|
85 |
+
|
86 |
+
return thunk
|
87 |
+
|
88 |
+
|
89 |
+
# ALGO LOGIC: initialize agent here:
|
90 |
+
class QNetwork(nn.Module):
|
91 |
+
def __init__(self, env):
|
92 |
+
super().__init__()
|
93 |
+
self.fc1 = nn.Linear(np.array(env.single_observation_space.shape).prod() + np.prod(env.single_action_space.shape), 256)
|
94 |
+
self.fc2 = nn.Linear(256, 256)
|
95 |
+
self.fc3 = nn.Linear(256, 1)
|
96 |
+
|
97 |
+
def forward(self, x, a):
|
98 |
+
x = torch.cat([x, a], 1)
|
99 |
+
x = F.relu(self.fc1(x))
|
100 |
+
x = F.relu(self.fc2(x))
|
101 |
+
x = self.fc3(x)
|
102 |
+
return x
|
103 |
+
|
104 |
+
|
105 |
+
class Actor(nn.Module):
|
106 |
+
def __init__(self, env):
|
107 |
+
super().__init__()
|
108 |
+
self.fc1 = nn.Linear(np.array(env.single_observation_space.shape).prod(), 256)
|
109 |
+
self.fc2 = nn.Linear(256, 256)
|
110 |
+
self.fc_mu = nn.Linear(256, np.prod(env.single_action_space.shape))
|
111 |
+
# action rescaling
|
112 |
+
self.register_buffer(
|
113 |
+
"action_scale", torch.tensor((env.action_space.high - env.action_space.low) / 2.0, dtype=torch.float32)
|
114 |
+
)
|
115 |
+
self.register_buffer(
|
116 |
+
"action_bias", torch.tensor((env.action_space.high + env.action_space.low) / 2.0, dtype=torch.float32)
|
117 |
+
)
|
118 |
+
|
119 |
+
def forward(self, x):
|
120 |
+
x = F.relu(self.fc1(x))
|
121 |
+
x = F.relu(self.fc2(x))
|
122 |
+
x = torch.tanh(self.fc_mu(x))
|
123 |
+
return x * self.action_scale + self.action_bias
|
124 |
+
|
125 |
+
|
126 |
+
if __name__ == "__main__":
|
127 |
+
import stable_baselines3 as sb3
|
128 |
+
|
129 |
+
if sb3.__version__ < "2.0":
|
130 |
+
raise ValueError(
|
131 |
+
"""Ongoing migration: run the following command to install the new dependencies:
|
132 |
+
|
133 |
+
poetry run pip install "stable_baselines3==2.0.0a1"
|
134 |
+
"""
|
135 |
+
)
|
136 |
+
args = parse_args()
|
137 |
+
run_name = f"{args.env_id}__{args.exp_name}__{args.seed}__{int(time.time())}"
|
138 |
+
if args.track:
|
139 |
+
import wandb
|
140 |
+
|
141 |
+
wandb.init(
|
142 |
+
project=args.wandb_project_name,
|
143 |
+
entity=args.wandb_entity,
|
144 |
+
sync_tensorboard=True,
|
145 |
+
config=vars(args),
|
146 |
+
name=run_name,
|
147 |
+
monitor_gym=True,
|
148 |
+
save_code=True,
|
149 |
+
)
|
150 |
+
writer = SummaryWriter(f"runs/{run_name}")
|
151 |
+
writer.add_text(
|
152 |
+
"hyperparameters",
|
153 |
+
"|param|value|\n|-|-|\n%s" % ("\n".join([f"|{key}|{value}|" for key, value in vars(args).items()])),
|
154 |
+
)
|
155 |
+
|
156 |
+
# TRY NOT TO MODIFY: seeding
|
157 |
+
random.seed(args.seed)
|
158 |
+
np.random.seed(args.seed)
|
159 |
+
torch.manual_seed(args.seed)
|
160 |
+
torch.backends.cudnn.deterministic = args.torch_deterministic
|
161 |
+
|
162 |
+
device = torch.device("cuda" if torch.cuda.is_available() and args.cuda else "cpu")
|
163 |
+
|
164 |
+
# env setup
|
165 |
+
envs = gym.vector.SyncVectorEnv([make_env(args.env_id, args.seed, 0, args.capture_video, run_name)])
|
166 |
+
assert isinstance(envs.single_action_space, gym.spaces.Box), "only continuous action space is supported"
|
167 |
+
|
168 |
+
actor = Actor(envs).to(device)
|
169 |
+
qf1 = QNetwork(envs).to(device)
|
170 |
+
qf1_target = QNetwork(envs).to(device)
|
171 |
+
target_actor = Actor(envs).to(device)
|
172 |
+
target_actor.load_state_dict(actor.state_dict())
|
173 |
+
qf1_target.load_state_dict(qf1.state_dict())
|
174 |
+
q_optimizer = optim.Adam(list(qf1.parameters()), lr=args.learning_rate)
|
175 |
+
actor_optimizer = optim.Adam(list(actor.parameters()), lr=args.learning_rate)
|
176 |
+
|
177 |
+
envs.single_observation_space.dtype = np.float32
|
178 |
+
rb = ReplayBuffer(
|
179 |
+
args.buffer_size,
|
180 |
+
envs.single_observation_space,
|
181 |
+
envs.single_action_space,
|
182 |
+
device,
|
183 |
+
handle_timeout_termination=False,
|
184 |
+
)
|
185 |
+
start_time = time.time()
|
186 |
+
|
187 |
+
# TRY NOT TO MODIFY: start the game
|
188 |
+
obs, _ = envs.reset(seed=args.seed)
|
189 |
+
for global_step in range(args.total_timesteps):
|
190 |
+
# ALGO LOGIC: put action logic here
|
191 |
+
if global_step < args.learning_starts:
|
192 |
+
actions = np.array([envs.single_action_space.sample() for _ in range(envs.num_envs)])
|
193 |
+
else:
|
194 |
+
with torch.no_grad():
|
195 |
+
actions = actor(torch.Tensor(obs).to(device))
|
196 |
+
actions += torch.normal(0, actor.action_scale * args.exploration_noise)
|
197 |
+
actions = actions.cpu().numpy().clip(envs.single_action_space.low, envs.single_action_space.high)
|
198 |
+
|
199 |
+
# TRY NOT TO MODIFY: execute the game and log data.
|
200 |
+
next_obs, rewards, terminateds, truncateds, infos = envs.step(actions)
|
201 |
+
|
202 |
+
# TRY NOT TO MODIFY: record rewards for plotting purposes
|
203 |
+
|
204 |
+
if "final_info" in infos:
|
205 |
+
for info in infos["final_info"]:
|
206 |
+
print(f"global_step={global_step}, episodic_return={info['episode']['r']}")
|
207 |
+
writer.add_scalar("charts/episodic_return", info["episode"]["r"], global_step)
|
208 |
+
writer.add_scalar("charts/episodic_length", info["episode"]["l"], global_step)
|
209 |
+
break
|
210 |
+
|
211 |
+
# TRY NOT TO MODIFY: save data to reply buffer; handle `terminal_observation`
|
212 |
+
real_next_obs = next_obs.copy()
|
213 |
+
for idx, d in enumerate(truncateds):
|
214 |
+
if d:
|
215 |
+
real_next_obs[idx] = infos["final_observation"][idx]
|
216 |
+
rb.add(obs, real_next_obs, actions, rewards, terminateds, infos)
|
217 |
+
|
218 |
+
# TRY NOT TO MODIFY: CRUCIAL step easy to overlook
|
219 |
+
obs = next_obs
|
220 |
+
|
221 |
+
# ALGO LOGIC: training.
|
222 |
+
if global_step > args.learning_starts:
|
223 |
+
data = rb.sample(args.batch_size)
|
224 |
+
with torch.no_grad():
|
225 |
+
next_state_actions = target_actor(data.next_observations)
|
226 |
+
qf1_next_target = qf1_target(data.next_observations, next_state_actions)
|
227 |
+
next_q_value = data.rewards.flatten() + (1 - data.dones.flatten()) * args.gamma * (qf1_next_target).view(-1)
|
228 |
+
|
229 |
+
qf1_a_values = qf1(data.observations, data.actions).view(-1)
|
230 |
+
qf1_loss = F.mse_loss(qf1_a_values, next_q_value)
|
231 |
+
|
232 |
+
# optimize the model
|
233 |
+
q_optimizer.zero_grad()
|
234 |
+
qf1_loss.backward()
|
235 |
+
q_optimizer.step()
|
236 |
+
|
237 |
+
if global_step % args.policy_frequency == 0:
|
238 |
+
actor_loss = -qf1(data.observations, actor(data.observations)).mean()
|
239 |
+
actor_optimizer.zero_grad()
|
240 |
+
actor_loss.backward()
|
241 |
+
actor_optimizer.step()
|
242 |
+
|
243 |
+
# update the target network
|
244 |
+
for param, target_param in zip(actor.parameters(), target_actor.parameters()):
|
245 |
+
target_param.data.copy_(args.tau * param.data + (1 - args.tau) * target_param.data)
|
246 |
+
for param, target_param in zip(qf1.parameters(), qf1_target.parameters()):
|
247 |
+
target_param.data.copy_(args.tau * param.data + (1 - args.tau) * target_param.data)
|
248 |
+
|
249 |
+
if global_step % 100 == 0:
|
250 |
+
writer.add_scalar("losses/qf1_loss", qf1_loss.item(), global_step)
|
251 |
+
writer.add_scalar("losses/actor_loss", actor_loss.item(), global_step)
|
252 |
+
writer.add_scalar("losses/qf1_values", qf1_a_values.mean().item(), global_step)
|
253 |
+
print("SPS:", int(global_step / (time.time() - start_time)))
|
254 |
+
writer.add_scalar("charts/SPS", int(global_step / (time.time() - start_time)), global_step)
|
255 |
+
|
256 |
+
if args.save_model:
|
257 |
+
model_path = f"runs/{run_name}/{args.exp_name}.cleanrl_model"
|
258 |
+
torch.save((actor.state_dict(), qf1.state_dict()), model_path)
|
259 |
+
print(f"model saved to {model_path}")
|
260 |
+
from cleanrl_utils.evals.ddpg_eval import evaluate
|
261 |
+
|
262 |
+
episodic_returns = evaluate(
|
263 |
+
model_path,
|
264 |
+
make_env,
|
265 |
+
args.env_id,
|
266 |
+
eval_episodes=10,
|
267 |
+
run_name=f"{run_name}-eval",
|
268 |
+
Model=(Actor, QNetwork),
|
269 |
+
device=device,
|
270 |
+
exploration_noise=args.exploration_noise,
|
271 |
+
)
|
272 |
+
for idx, episodic_return in enumerate(episodic_returns):
|
273 |
+
writer.add_scalar("eval/episodic_return", episodic_return, idx)
|
274 |
+
|
275 |
+
if args.upload_model:
|
276 |
+
from cleanrl_utils.huggingface import push_to_hub
|
277 |
+
|
278 |
+
repo_name = f"{args.env_id}-{args.exp_name}-seed{args.seed}"
|
279 |
+
repo_id = f"{args.hf_entity}/{repo_name}" if args.hf_entity else repo_name
|
280 |
+
push_to_hub(args, episodic_returns, repo_id, "DDPG", f"runs/{run_name}", f"videos/{run_name}-eval")
|
281 |
+
|
282 |
+
envs.close()
|
283 |
+
writer.close()
|
events.out.tfevents.1688065015.3090-172.1344199.0
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9cafa0b7baf326d5877ff1fb85ee2079c2e543bbd875018d0c88d137a7f6d7d4
|
3 |
+
size 2767230
|
poetry.lock
ADDED
The diff for this file is too large to render.
See raw diff
|
|
pyproject.toml
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[tool.poetry]
|
2 |
+
name = "cleanrl"
|
3 |
+
version = "1.1.0"
|
4 |
+
description = "High-quality single file implementation of Deep Reinforcement Learning algorithms with research-friendly features"
|
5 |
+
authors = ["Costa Huang <[email protected]>"]
|
6 |
+
packages = [
|
7 |
+
{ include = "cleanrl" },
|
8 |
+
{ include = "cleanrl_utils" },
|
9 |
+
]
|
10 |
+
keywords = ["reinforcement", "machine", "learning", "research"]
|
11 |
+
license="MIT"
|
12 |
+
readme = "README.md"
|
13 |
+
|
14 |
+
[tool.poetry.dependencies]
|
15 |
+
python = ">=3.7.1,<3.11"
|
16 |
+
tensorboard = "^2.10.0"
|
17 |
+
wandb = "^0.13.11"
|
18 |
+
gym = "0.23.1"
|
19 |
+
torch = ">=1.12.1"
|
20 |
+
stable-baselines3 = "1.2.0"
|
21 |
+
gymnasium = ">=0.28.1"
|
22 |
+
moviepy = "^1.0.3"
|
23 |
+
pygame = "2.1.0"
|
24 |
+
huggingface-hub = "^0.11.1"
|
25 |
+
rich = "<12.0"
|
26 |
+
tenacity = "^8.2.2"
|
27 |
+
|
28 |
+
ale-py = {version = "0.7.4", optional = true}
|
29 |
+
AutoROM = {extras = ["accept-rom-license"], version = "^0.4.2", optional = true}
|
30 |
+
opencv-python = {version = "^4.6.0.66", optional = true}
|
31 |
+
procgen = {version = "^0.10.7", optional = true}
|
32 |
+
pytest = {version = "^7.1.3", optional = true}
|
33 |
+
mujoco = {version = "<=2.3.3", optional = true}
|
34 |
+
imageio = {version = "^2.14.1", optional = true}
|
35 |
+
free-mujoco-py = {version = "^2.1.6", optional = true}
|
36 |
+
mkdocs-material = {version = "^8.4.3", optional = true}
|
37 |
+
markdown-include = {version = "^0.7.0", optional = true}
|
38 |
+
openrlbenchmark = {version = "^0.1.1b4", optional = true}
|
39 |
+
jax = {version = "^0.3.17", optional = true}
|
40 |
+
jaxlib = {version = "^0.3.15", optional = true}
|
41 |
+
flax = {version = "^0.6.0", optional = true}
|
42 |
+
optuna = {version = "^3.0.1", optional = true}
|
43 |
+
optuna-dashboard = {version = "^0.7.2", optional = true}
|
44 |
+
envpool = {version = "^0.6.4", optional = true}
|
45 |
+
PettingZoo = {version = "1.18.1", optional = true}
|
46 |
+
SuperSuit = {version = "3.4.0", optional = true}
|
47 |
+
multi-agent-ale-py = {version = "0.1.11", optional = true}
|
48 |
+
boto3 = {version = "^1.24.70", optional = true}
|
49 |
+
awscli = {version = "^1.25.71", optional = true}
|
50 |
+
shimmy = {version = ">=1.0.0", extras = ["dm-control"], optional = true}
|
51 |
+
|
52 |
+
[tool.poetry.group.dev.dependencies]
|
53 |
+
pre-commit = "^2.20.0"
|
54 |
+
|
55 |
+
|
56 |
+
[tool.poetry.group.isaacgym]
|
57 |
+
optional = true
|
58 |
+
[tool.poetry.group.isaacgym.dependencies]
|
59 |
+
isaacgymenvs = {git = "https://github.com/vwxyzjn/IsaacGymEnvs.git", rev = "poetry", python = ">=3.7.1,<3.10"}
|
60 |
+
isaacgym = {path = "cleanrl/ppo_continuous_action_isaacgym/isaacgym", develop = true}
|
61 |
+
|
62 |
+
|
63 |
+
[build-system]
|
64 |
+
requires = ["poetry-core"]
|
65 |
+
build-backend = "poetry.core.masonry.api"
|
66 |
+
|
67 |
+
[tool.poetry.extras]
|
68 |
+
atari = ["ale-py", "AutoROM", "opencv-python"]
|
69 |
+
procgen = ["procgen"]
|
70 |
+
plot = ["pandas", "seaborn"]
|
71 |
+
pytest = ["pytest"]
|
72 |
+
mujoco = ["mujoco", "imageio"]
|
73 |
+
mujoco_py = ["free-mujoco-py"]
|
74 |
+
jax = ["jax", "jaxlib", "flax"]
|
75 |
+
docs = ["mkdocs-material", "markdown-include", "openrlbenchmark"]
|
76 |
+
envpool = ["envpool"]
|
77 |
+
optuna = ["optuna", "optuna-dashboard"]
|
78 |
+
pettingzoo = ["PettingZoo", "SuperSuit", "multi-agent-ale-py"]
|
79 |
+
cloud = ["boto3", "awscli"]
|
80 |
+
dm_control = ["shimmy", "mujoco"]
|
81 |
+
|
82 |
+
# dependencies for algorithm variant (useful when you want to run a specific algorithm)
|
83 |
+
dqn = []
|
84 |
+
dqn_atari = ["ale-py", "AutoROM", "opencv-python"]
|
85 |
+
dqn_jax = ["jax", "jaxlib", "flax"]
|
86 |
+
dqn_atari_jax = [
|
87 |
+
"ale-py", "AutoROM", "opencv-python", # atari
|
88 |
+
"jax", "jaxlib", "flax" # jax
|
89 |
+
]
|
90 |
+
c51 = []
|
91 |
+
c51_atari = ["ale-py", "AutoROM", "opencv-python"]
|
92 |
+
c51_jax = ["jax", "jaxlib", "flax"]
|
93 |
+
c51_atari_jax = [
|
94 |
+
"ale-py", "AutoROM", "opencv-python", # atari
|
95 |
+
"jax", "jaxlib", "flax" # jax
|
96 |
+
]
|
97 |
+
ppo_atari_envpool_xla_jax_scan = [
|
98 |
+
"ale-py", "AutoROM", "opencv-python", # atari
|
99 |
+
"jax", "jaxlib", "flax", # jax
|
100 |
+
"envpool", # envpool
|
101 |
+
]
|
102 |
+
qdagger_dqn_atari_impalacnn = [
|
103 |
+
"ale-py", "AutoROM", "opencv-python"
|
104 |
+
]
|
105 |
+
qdagger_dqn_atari_jax_impalacnn = [
|
106 |
+
"ale-py", "AutoROM", "opencv-python", # atari
|
107 |
+
"jax", "jaxlib", "flax", # jax
|
108 |
+
]
|
109 |
+
|
110 |
+
[[tool.poetry.source]]
|
111 |
+
name = "tsinghua"
|
112 |
+
url = "https://pypi.tuna.tsinghua.edu.cn/simple"
|
113 |
+
default = true
|
replay.mp4
ADDED
Binary file (164 kB). View file
|
|
videos/Walker2d-v2__ddpg_continuous_action__1__1688065009-eval/rl-video-episode-0.mp4
ADDED
Binary file (352 kB). View file
|
|
videos/Walker2d-v2__ddpg_continuous_action__1__1688065009-eval/rl-video-episode-1.mp4
ADDED
Binary file (126 kB). View file
|
|
videos/Walker2d-v2__ddpg_continuous_action__1__1688065009-eval/rl-video-episode-8.mp4
ADDED
Binary file (164 kB). View file
|
|