kinalmehta commited on
Commit
742db8d
1 Parent(s): 450fd4f

pushing model

Browse files
.gitattributes CHANGED
@@ -32,3 +32,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
32
  *.zip filter=lfs diff=lfs merge=lfs -text
33
  *.zst filter=lfs diff=lfs merge=lfs -text
34
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
32
  *.zip filter=lfs diff=lfs merge=lfs -text
33
  *.zst filter=lfs diff=lfs merge=lfs -text
34
  *tfevents* filter=lfs diff=lfs merge=lfs -text
35
+ c51_atari.cleanrl_model filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - BreakoutNoFrameskip-v4
4
+ - deep-reinforcement-learning
5
+ - reinforcement-learning
6
+ - custom-implementation
7
+ library_name: cleanrl
8
+ model-index:
9
+ - name: C51
10
+ results:
11
+ - task:
12
+ type: reinforcement-learning
13
+ name: reinforcement-learning
14
+ dataset:
15
+ name: BreakoutNoFrameskip-v4
16
+ type: BreakoutNoFrameskip-v4
17
+ metrics:
18
+ - type: mean_reward
19
+ value: 381.00 +/- 56.35
20
+ name: mean_reward
21
+ verified: false
22
+ ---
23
+
24
+ # (CleanRL) **C51** Agent Playing **BreakoutNoFrameskip-v4**
25
+
26
+ This is a trained model of a C51 agent playing BreakoutNoFrameskip-v4.
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/c51_atari.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[c51_atari]"
36
+ python -m cleanrl_utils.enjoy --exp-name c51_atari --env-id BreakoutNoFrameskip-v4
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/kinalmehta/BreakoutNoFrameskip-v4-c51_atari-seed1/raw/main/c51_atari.py
46
+ curl -OL https://huggingface.co/kinalmehta/BreakoutNoFrameskip-v4-c51_atari-seed1/raw/main/pyproject.toml
47
+ curl -OL https://huggingface.co/kinalmehta/BreakoutNoFrameskip-v4-c51_atari-seed1/raw/main/poetry.lock
48
+ poetry install --all-extras
49
+ python c51_atari.py --save-model --upload-model --hf-entity kinalmehta --env-id BreakoutNoFrameskip-v4
50
+ ```
51
+
52
+ # Hyperparameters
53
+ ```python
54
+ {'batch_size': 32,
55
+ 'buffer_size': 1000000,
56
+ 'capture_video': False,
57
+ 'cuda': True,
58
+ 'end_e': 0.01,
59
+ 'env_id': 'BreakoutNoFrameskip-v4',
60
+ 'exp_name': 'c51_atari',
61
+ 'exploration_fraction': 0.1,
62
+ 'gamma': 0.99,
63
+ 'hf_entity': 'kinalmehta',
64
+ 'learning_rate': 0.00025,
65
+ 'learning_starts': 80000,
66
+ 'n_atoms': 51,
67
+ 'save_model': True,
68
+ 'seed': 1,
69
+ 'start_e': 1,
70
+ 'target_network_frequency': 10000,
71
+ 'torch_deterministic': True,
72
+ 'total_timesteps': 10000000,
73
+ 'track': False,
74
+ 'train_frequency': 4,
75
+ 'upload_model': True,
76
+ 'v_max': 10,
77
+ 'v_min': -10,
78
+ 'wandb_entity': None,
79
+ 'wandb_project_name': 'cleanRL'}
80
+ ```
81
+
c51_atari.cleanrl_model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2470c5e21940d8e9a069e39a575a33eca43ca242b5effe14dfa300c7fde6f615
3
+ size 7159300
c51_atari.py ADDED
@@ -0,0 +1,300 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # docs and experiment results can be found at https://docs.cleanrl.dev/rl-algorithms/c51/#c51_ataripy
2
+ import argparse
3
+ import os
4
+ import random
5
+ import time
6
+ from distutils.util import strtobool
7
+
8
+ import gym
9
+ import numpy as np
10
+ import torch
11
+ import torch.nn as nn
12
+ import torch.optim as optim
13
+ from stable_baselines3.common.atari_wrappers import (
14
+ ClipRewardEnv,
15
+ EpisodicLifeEnv,
16
+ FireResetEnv,
17
+ MaxAndSkipEnv,
18
+ NoopResetEnv,
19
+ )
20
+ from stable_baselines3.common.buffers import ReplayBuffer
21
+ from torch.utils.tensorboard import SummaryWriter
22
+
23
+
24
+ def parse_args():
25
+ # fmt: off
26
+ parser = argparse.ArgumentParser()
27
+ parser.add_argument("--exp-name", type=str, default=os.path.basename(__file__).rstrip(".py"),
28
+ help="the name of this experiment")
29
+ parser.add_argument("--seed", type=int, default=1,
30
+ help="seed of the experiment")
31
+ parser.add_argument("--torch-deterministic", type=lambda x: bool(strtobool(x)), default=True, nargs="?", const=True,
32
+ help="if toggled, `torch.backends.cudnn.deterministic=False`")
33
+ parser.add_argument("--cuda", type=lambda x: bool(strtobool(x)), default=True, nargs="?", const=True,
34
+ help="if toggled, cuda will be enabled by default")
35
+ parser.add_argument("--track", type=lambda x: bool(strtobool(x)), default=False, nargs="?", const=True,
36
+ help="if toggled, this experiment will be tracked with Weights and Biases")
37
+ parser.add_argument("--wandb-project-name", type=str, default="cleanRL",
38
+ help="the wandb's project name")
39
+ parser.add_argument("--wandb-entity", type=str, default=None,
40
+ help="the entity (team) of wandb's project")
41
+ parser.add_argument("--capture-video", type=lambda x: bool(strtobool(x)), default=False, nargs="?", const=True,
42
+ help="whether to capture videos of the agent performances (check out `videos` folder)")
43
+ parser.add_argument("--save-model", type=lambda x: bool(strtobool(x)), default=False, nargs="?", const=True,
44
+ help="whether to save model into the `runs/{run_name}` folder")
45
+ parser.add_argument("--upload-model", type=lambda x: bool(strtobool(x)), default=False, nargs="?", const=True,
46
+ help="whether to upload the saved model to huggingface")
47
+ parser.add_argument("--hf-entity", type=str, default="",
48
+ help="the user or org name of the model repository from the Hugging Face Hub")
49
+
50
+ # Algorithm specific arguments
51
+ parser.add_argument("--env-id", type=str, default="BreakoutNoFrameskip-v4",
52
+ help="the id of the environment")
53
+ parser.add_argument("--total-timesteps", type=int, default=10000000,
54
+ help="total timesteps of the experiments")
55
+ parser.add_argument("--learning-rate", type=float, default=2.5e-4,
56
+ help="the learning rate of the optimizer")
57
+ parser.add_argument("--n-atoms", type=int, default=51,
58
+ help="the number of atoms")
59
+ parser.add_argument("--v-min", type=float, default=-10,
60
+ help="the number of atoms")
61
+ parser.add_argument("--v-max", type=float, default=10,
62
+ help="the number of atoms")
63
+ parser.add_argument("--buffer-size", type=int, default=1000000,
64
+ help="the replay memory buffer size")
65
+ parser.add_argument("--gamma", type=float, default=0.99,
66
+ help="the discount factor gamma")
67
+ parser.add_argument("--target-network-frequency", type=int, default=10000,
68
+ help="the timesteps it takes to update the target network")
69
+ parser.add_argument("--batch-size", type=int, default=32,
70
+ help="the batch size of sample from the reply memory")
71
+ parser.add_argument("--start-e", type=float, default=1,
72
+ help="the starting epsilon for exploration")
73
+ parser.add_argument("--end-e", type=float, default=0.01,
74
+ help="the ending epsilon for exploration")
75
+ parser.add_argument("--exploration-fraction", type=float, default=0.1,
76
+ help="the fraction of `total-timesteps` it takes from start-e to go end-e")
77
+ parser.add_argument("--learning-starts", type=int, default=80000,
78
+ help="timestep to start learning")
79
+ parser.add_argument("--train-frequency", type=int, default=4,
80
+ help="the frequency of training")
81
+ args = parser.parse_args()
82
+ # fmt: on
83
+ return args
84
+
85
+
86
+ def make_env(env_id, seed, idx, capture_video, run_name):
87
+ def thunk():
88
+ env = gym.make(env_id)
89
+ env = gym.wrappers.RecordEpisodeStatistics(env)
90
+ if capture_video:
91
+ if idx == 0:
92
+ env = gym.wrappers.RecordVideo(env, f"videos/{run_name}")
93
+ env = NoopResetEnv(env, noop_max=30)
94
+ env = MaxAndSkipEnv(env, skip=4)
95
+ env = EpisodicLifeEnv(env)
96
+ if "FIRE" in env.unwrapped.get_action_meanings():
97
+ env = FireResetEnv(env)
98
+ env = ClipRewardEnv(env)
99
+ env = gym.wrappers.ResizeObservation(env, (84, 84))
100
+ env = gym.wrappers.GrayScaleObservation(env)
101
+ env = gym.wrappers.FrameStack(env, 4)
102
+ env.seed(seed)
103
+ env.action_space.seed(seed)
104
+ env.observation_space.seed(seed)
105
+ return env
106
+
107
+ return thunk
108
+
109
+
110
+ # ALGO LOGIC: initialize agent here:
111
+ class QNetwork(nn.Module):
112
+ def __init__(self, env, n_atoms=101, v_min=-100, v_max=100):
113
+ super().__init__()
114
+ self.env = env
115
+ self.n_atoms = n_atoms
116
+ self.register_buffer("atoms", torch.linspace(v_min, v_max, steps=n_atoms))
117
+ self.n = env.single_action_space.n
118
+ self.network = nn.Sequential(
119
+ nn.Conv2d(4, 32, 8, stride=4),
120
+ nn.ReLU(),
121
+ nn.Conv2d(32, 64, 4, stride=2),
122
+ nn.ReLU(),
123
+ nn.Conv2d(64, 64, 3, stride=1),
124
+ nn.ReLU(),
125
+ nn.Flatten(),
126
+ nn.Linear(3136, 512),
127
+ nn.ReLU(),
128
+ nn.Linear(512, self.n * n_atoms),
129
+ )
130
+
131
+ def get_action(self, x, action=None):
132
+ logits = self.network(x / 255.0)
133
+ # probability mass function for each action
134
+ pmfs = torch.softmax(logits.view(len(x), self.n, self.n_atoms), dim=2)
135
+ q_values = (pmfs * self.atoms).sum(2)
136
+ if action is None:
137
+ action = torch.argmax(q_values, 1)
138
+ return action, pmfs[torch.arange(len(x)), action]
139
+
140
+
141
+ def linear_schedule(start_e: float, end_e: float, duration: int, t: int):
142
+ slope = (end_e - start_e) / duration
143
+ return max(slope * t + start_e, end_e)
144
+
145
+
146
+ if __name__ == "__main__":
147
+ args = parse_args()
148
+ run_name = f"{args.env_id}__{args.exp_name}__{args.seed}__{int(time.time())}"
149
+ if args.track:
150
+ import wandb
151
+
152
+ wandb.init(
153
+ project=args.wandb_project_name,
154
+ entity=args.wandb_entity,
155
+ sync_tensorboard=True,
156
+ config=vars(args),
157
+ name=run_name,
158
+ monitor_gym=True,
159
+ save_code=True,
160
+ )
161
+ writer = SummaryWriter(f"runs/{run_name}")
162
+ writer.add_text(
163
+ "hyperparameters",
164
+ "|param|value|\n|-|-|\n%s" % ("\n".join([f"|{key}|{value}|" for key, value in vars(args).items()])),
165
+ )
166
+
167
+ # TRY NOT TO MODIFY: seeding
168
+ random.seed(args.seed)
169
+ np.random.seed(args.seed)
170
+ torch.manual_seed(args.seed)
171
+ torch.backends.cudnn.deterministic = args.torch_deterministic
172
+
173
+ device = torch.device("cuda" if torch.cuda.is_available() and args.cuda else "cpu")
174
+
175
+ # env setup
176
+ envs = gym.vector.SyncVectorEnv([make_env(args.env_id, args.seed, 0, args.capture_video, run_name)])
177
+ assert isinstance(envs.single_action_space, gym.spaces.Discrete), "only discrete action space is supported"
178
+
179
+ q_network = QNetwork(envs, n_atoms=args.n_atoms, v_min=args.v_min, v_max=args.v_max).to(device)
180
+ optimizer = optim.Adam(q_network.parameters(), lr=args.learning_rate, eps=0.01 / args.batch_size)
181
+ target_network = QNetwork(envs, n_atoms=args.n_atoms, v_min=args.v_min, v_max=args.v_max).to(device)
182
+ target_network.load_state_dict(q_network.state_dict())
183
+
184
+ rb = ReplayBuffer(
185
+ args.buffer_size,
186
+ envs.single_observation_space,
187
+ envs.single_action_space,
188
+ device,
189
+ optimize_memory_usage=True,
190
+ handle_timeout_termination=True,
191
+ )
192
+ start_time = time.time()
193
+
194
+ # TRY NOT TO MODIFY: start the game
195
+ obs = envs.reset()
196
+ for global_step in range(args.total_timesteps):
197
+ # ALGO LOGIC: put action logic here
198
+ epsilon = linear_schedule(args.start_e, args.end_e, args.exploration_fraction * args.total_timesteps, global_step)
199
+ if random.random() < epsilon:
200
+ actions = np.array([envs.single_action_space.sample() for _ in range(envs.num_envs)])
201
+ else:
202
+ actions, pmf = q_network.get_action(torch.Tensor(obs).to(device))
203
+ actions = actions.cpu().numpy()
204
+
205
+ # TRY NOT TO MODIFY: execute the game and log data.
206
+ next_obs, rewards, dones, infos = envs.step(actions)
207
+
208
+ # TRY NOT TO MODIFY: record rewards for plotting purposes
209
+ for info in infos:
210
+ if "episode" in info.keys():
211
+ print(f"global_step={global_step}, episodic_return={info['episode']['r']}")
212
+ writer.add_scalar("charts/episodic_return", info["episode"]["r"], global_step)
213
+ writer.add_scalar("charts/episodic_length", info["episode"]["l"], global_step)
214
+ writer.add_scalar("charts/epsilon", epsilon, global_step)
215
+ break
216
+
217
+ # TRY NOT TO MODIFY: save data to reply buffer; handle `terminal_observation`
218
+ real_next_obs = next_obs.copy()
219
+ for idx, d in enumerate(dones):
220
+ if d:
221
+ real_next_obs[idx] = infos[idx]["terminal_observation"]
222
+ rb.add(obs, real_next_obs, actions, rewards, dones, infos)
223
+
224
+ # TRY NOT TO MODIFY: CRUCIAL step easy to overlook
225
+ obs = next_obs
226
+
227
+ # ALGO LOGIC: training.
228
+ if global_step > args.learning_starts:
229
+ if global_step % args.train_frequency == 0:
230
+ data = rb.sample(args.batch_size)
231
+ with torch.no_grad():
232
+ _, next_pmfs = target_network.get_action(data.next_observations)
233
+ next_atoms = data.rewards + args.gamma * target_network.atoms * (1 - data.dones)
234
+ # projection
235
+ delta_z = target_network.atoms[1] - target_network.atoms[0]
236
+ tz = next_atoms.clamp(args.v_min, args.v_max)
237
+
238
+ b = (tz - args.v_min) / delta_z
239
+ l = b.floor().clamp(0, args.n_atoms - 1)
240
+ u = b.ceil().clamp(0, args.n_atoms - 1)
241
+ # (l == u).float() handles the case where bj is exactly an integer
242
+ # example bj = 1, then the upper ceiling should be uj= 2, and lj= 1
243
+ d_m_l = (u + (l == u).float() - b) * next_pmfs
244
+ d_m_u = (b - l) * next_pmfs
245
+ target_pmfs = torch.zeros_like(next_pmfs)
246
+ for i in range(target_pmfs.size(0)):
247
+ target_pmfs[i].index_add_(0, l[i].long(), d_m_l[i])
248
+ target_pmfs[i].index_add_(0, u[i].long(), d_m_u[i])
249
+
250
+ _, old_pmfs = q_network.get_action(data.observations, data.actions.flatten())
251
+ loss = (-(target_pmfs * old_pmfs.clamp(min=1e-5, max=1 - 1e-5).log()).sum(-1)).mean()
252
+
253
+ if global_step % 100 == 0:
254
+ writer.add_scalar("losses/loss", loss.item(), global_step)
255
+ old_val = (old_pmfs * q_network.atoms).sum(1)
256
+ writer.add_scalar("losses/q_values", old_val.mean().item(), global_step)
257
+ print("SPS:", int(global_step / (time.time() - start_time)))
258
+ writer.add_scalar("charts/SPS", int(global_step / (time.time() - start_time)), global_step)
259
+
260
+ # optimize the model
261
+ optimizer.zero_grad()
262
+ loss.backward()
263
+ optimizer.step()
264
+
265
+ # update the target network
266
+ if global_step % args.target_network_frequency == 0:
267
+ target_network.load_state_dict(q_network.state_dict())
268
+
269
+ if args.save_model:
270
+ model_path = f"runs/{run_name}/{args.exp_name}.cleanrl_model"
271
+ model_data = {
272
+ "model_weights": q_network.state_dict(),
273
+ "args": vars(args),
274
+ }
275
+ torch.save(model_data, model_path)
276
+ print(f"model saved to {model_path}")
277
+ from cleanrl_utils.evals.c51_eval import evaluate
278
+
279
+ episodic_returns = evaluate(
280
+ model_path,
281
+ make_env,
282
+ args.env_id,
283
+ eval_episodes=10,
284
+ run_name=f"{run_name}-eval",
285
+ Model=QNetwork,
286
+ device=device,
287
+ epsilon=0.05,
288
+ )
289
+ for idx, episodic_return in enumerate(episodic_returns):
290
+ writer.add_scalar("eval/episodic_return", episodic_return, idx)
291
+
292
+ if args.upload_model:
293
+ from cleanrl_utils.huggingface import push_to_hub
294
+
295
+ repo_name = f"{args.env_id}-{args.exp_name}-seed{args.seed}"
296
+ repo_id = f"{args.hf_entity}/{repo_name}" if args.hf_entity else repo_name
297
+ push_to_hub(args, episodic_returns, repo_id, "C51", f"runs/{run_name}", f"videos/{run_name}-eval")
298
+
299
+ envs.close()
300
+ writer.close()
events.out.tfevents.1672743811.home-pc.34236.0 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7d4f59db497acdaa7a7b193c5d1cebf6c39829d7e5c8090cde222bc36924df2f
3
+ size 16785921
poetry.lock ADDED
The diff for this file is too large to render. See raw diff
 
pyproject.toml ADDED
@@ -0,0 +1,178 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [tool.poetry]
2
+ name = "cleanrl-test"
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 <costa.huang@outlook.com>"]
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.10"
16
+ tensorboard = "^2.10.0"
17
+ wandb = "^0.13.6"
18
+ gym = "0.23.1"
19
+ torch = ">=1.12.1"
20
+ stable-baselines3 = "1.2.0"
21
+ gymnasium = "^0.26.3"
22
+ moviepy = "^1.0.3"
23
+ pygame = "2.1.0"
24
+ huggingface-hub = "^0.11.1"
25
+
26
+ ale-py = {version = "0.7.4", optional = true}
27
+ AutoROM = {extras = ["accept-rom-license"], version = "^0.4.2"}
28
+ opencv-python = {version = "^4.6.0.66", optional = true}
29
+ pybullet = {version = "3.1.8", optional = true}
30
+ procgen = {version = "^0.10.7", optional = true}
31
+ pytest = {version = "^7.1.3", optional = true}
32
+ mujoco = {version = "^2.2", optional = true}
33
+ imageio = {version = "^2.14.1", optional = true}
34
+ free-mujoco-py = {version = "^2.1.6", optional = true}
35
+ mkdocs-material = {version = "^8.4.3", optional = true}
36
+ markdown-include = {version = "^0.7.0", optional = true}
37
+ jax = {version = "^0.3.17", optional = true}
38
+ jaxlib = {version = "^0.3.15", optional = true}
39
+ flax = {version = "^0.6.0", optional = true}
40
+ optuna = {version = "^3.0.1", optional = true}
41
+ optuna-dashboard = {version = "^0.7.2", optional = true}
42
+ rich = {version = "<12.0", optional = true}
43
+ envpool = {version = "^0.6.4", optional = true}
44
+ PettingZoo = {version = "1.18.1", optional = true}
45
+ SuperSuit = {version = "3.4.0", optional = true}
46
+ multi-agent-ale-py = {version = "0.1.11", optional = true}
47
+ boto3 = {version = "^1.24.70", optional = true}
48
+ awscli = {version = "^1.25.71", optional = true}
49
+ shimmy = {version = "^0.1.0", optional = true}
50
+ dm-control = {version = "^1.0.8", optional = true}
51
+
52
+ [tool.poetry.group.dev.dependencies]
53
+ pre-commit = "^2.20.0"
54
+
55
+ [tool.poetry.group.atari]
56
+ optional = true
57
+ [tool.poetry.group.atari.dependencies]
58
+ ale-py = "0.7.4"
59
+ AutoROM = {extras = ["accept-rom-license"], version = "^0.4.2"}
60
+ opencv-python = "^4.6.0.66"
61
+
62
+ [tool.poetry.group.pybullet]
63
+ optional = true
64
+ [tool.poetry.group.pybullet.dependencies]
65
+ pybullet = "3.1.8"
66
+
67
+ [tool.poetry.group.procgen]
68
+ optional = true
69
+ [tool.poetry.group.procgen.dependencies]
70
+ procgen = "^0.10.7"
71
+
72
+ [tool.poetry.group.pytest]
73
+ optional = true
74
+ [tool.poetry.group.pytest.dependencies]
75
+ pytest = "^7.1.3"
76
+
77
+ [tool.poetry.group.mujoco]
78
+ optional = true
79
+ [tool.poetry.group.mujoco.dependencies]
80
+ mujoco = "^2.2"
81
+ imageio = "^2.14.1"
82
+
83
+ [tool.poetry.group.mujoco_py]
84
+ optional = true
85
+ [tool.poetry.group.mujoco_py.dependencies]
86
+ free-mujoco-py = "^2.1.6"
87
+
88
+ [tool.poetry.group.docs]
89
+ optional = true
90
+ [tool.poetry.group.docs.dependencies]
91
+ mkdocs-material = "^8.4.3"
92
+ markdown-include = "^0.7.0"
93
+
94
+ [tool.poetry.group.jax]
95
+ optional = true
96
+ [tool.poetry.group.jax.dependencies]
97
+ jax = "^0.3.17"
98
+ jaxlib = "^0.3.15"
99
+ flax = "^0.6.0"
100
+
101
+ [tool.poetry.group.optuna]
102
+ optional = true
103
+ [tool.poetry.group.optuna.dependencies]
104
+ optuna = "^3.0.1"
105
+ optuna-dashboard = "^0.7.2"
106
+ rich = "<12.0"
107
+
108
+ [tool.poetry.group.envpool]
109
+ optional = true
110
+ [tool.poetry.group.envpool.dependencies]
111
+ envpool = "^0.6.4"
112
+
113
+ [tool.poetry.group.pettingzoo]
114
+ optional = true
115
+ [tool.poetry.group.pettingzoo.dependencies]
116
+ PettingZoo = "1.18.1"
117
+ SuperSuit = "3.4.0"
118
+ multi-agent-ale-py = "0.1.11"
119
+
120
+ [tool.poetry.group.cloud]
121
+ optional = true
122
+ [tool.poetry.group.cloud.dependencies]
123
+ boto3 = "^1.24.70"
124
+ awscli = "^1.25.71"
125
+
126
+ [tool.poetry.group.isaacgym]
127
+ optional = true
128
+ [tool.poetry.group.isaacgym.dependencies]
129
+ isaacgymenvs = {git = "https://github.com/vwxyzjn/IsaacGymEnvs.git", rev = "poetry"}
130
+ isaacgym = {path = "cleanrl/ppo_continuous_action_isaacgym/isaacgym", develop = true}
131
+
132
+ [tool.poetry.group.dm_control]
133
+ optional = true
134
+ [tool.poetry.group.dm_control.dependencies]
135
+ shimmy = "^0.1.0"
136
+ dm-control = "^1.0.8"
137
+ mujoco = "^2.2"
138
+
139
+ [build-system]
140
+ requires = ["poetry-core"]
141
+ build-backend = "poetry.core.masonry.api"
142
+
143
+ [tool.poetry.extras]
144
+ atari = ["ale-py", "AutoROM", "opencv-python"]
145
+ pybullet = ["pybullet"]
146
+ procgen = ["procgen"]
147
+ plot = ["pandas", "seaborn"]
148
+ pytest = ["pytest"]
149
+ mujoco = ["mujoco", "imageio"]
150
+ mujoco_py = ["free-mujoco-py"]
151
+ jax = ["jax", "jaxlib", "flax"]
152
+ docs = ["mkdocs-material", "markdown-include"]
153
+ envpool = ["envpool"]
154
+ optuna = ["optuna", "optuna-dashboard", "rich"]
155
+ pettingzoo = ["PettingZoo", "SuperSuit", "multi-agent-ale-py"]
156
+ cloud = ["boto3", "awscli"]
157
+ dm_control = ["shimmy", "dm-control", "mujoco"]
158
+
159
+ # dependencies for algorithm variant (useful when you want to run a specific algorithm)
160
+ dqn = []
161
+ dqn_atari = ["ale-py", "AutoROM", "opencv-python"]
162
+ dqn_jax = ["jax", "jaxlib", "flax"]
163
+ dqn_atari_jax = [
164
+ "ale-py", "AutoROM", "opencv-python", # atari
165
+ "jax", "jaxlib", "flax" # jax
166
+ ]
167
+ c51 = []
168
+ c51_atari = ["ale-py", "AutoROM", "opencv-python"]
169
+ c51_jax = ["jax", "jaxlib", "flax"]
170
+ c51_atari_jax = [
171
+ "ale-py", "AutoROM", "opencv-python", # atari
172
+ "jax", "jaxlib", "flax" # jax
173
+ ]
174
+ ppo_atari_envpool_xla_jax_scan = [
175
+ "ale-py", "AutoROM", "opencv-python", # atari
176
+ "jax", "jaxlib", "flax", # jax
177
+ "envpool", # envpool
178
+ ]
replay.mp4 ADDED
Binary file (490 kB). View file
 
videos/BreakoutNoFrameskip-v4__c51_atari__1__1672743811-eval/rl-video-episode-0.mp4 ADDED
Binary file (338 kB). View file
 
videos/BreakoutNoFrameskip-v4__c51_atari__1__1672743811-eval/rl-video-episode-1.mp4 ADDED
Binary file (504 kB). View file
 
videos/BreakoutNoFrameskip-v4__c51_atari__1__1672743811-eval/rl-video-episode-8.mp4 ADDED
Binary file (490 kB). View file