-
Notifications
You must be signed in to change notification settings - Fork 132
/
default_args.py
266 lines (254 loc) · 8.07 KB
/
default_args.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
def add_default_args(parser):
parser.add_argument(
"--exp_name",
type=str,
default=None,
help="Name experiment will be stored under. When left empty, the name is formatted as:"
"env_model_algorithm",
)
parser.add_argument(
"--env",
type=str,
default="cleanup",
help="Name of the environment to use. Can be switch, cleanup or harvest.",
)
parser.add_argument(
"--algorithm",
type=str,
default="PPO",
help="Name of the rllib algorithm to use. Can be A3C or PPO.",
)
parser.add_argument(
"--model",
type=str,
default="baseline",
help="Name of the model to use. Can be baseline, moa, or scm",
)
parser.add_argument(
"--resume",
action="store_true",
default=False,
help="Resume previous experiment.",
)
parser.add_argument(
"--restore",
default=None,
help="path to checkpoint",
)
parser.add_argument("--num_agents", type=int, default=2, help="Number of agent policies")
parser.add_argument(
"--rollout_fragment_length",
type=int,
default=1000,
help="Size of samples taken from single workers. These are concatenated with samples of"
"other workers to size train_batch_size.",
)
parser.add_argument(
"--train_batch_size",
type=int,
default=None,
help="Size of the total dataset over which one epoch is computed. If not specified,"
"defaults to num_workers * num_envs_per_worker * rollout_fragment_length",
)
parser.add_argument(
"--checkpoint_frequency",
type=int,
default=100,
help="Number of steps before a checkpoint is saved.",
)
parser.add_argument(
"--stop_at_timesteps_total",
type=int,
default=int(5e6),
help="Experiment stops when this total amount of timesteps has been reached",
)
parser.add_argument(
"--stop_at_episode_reward_min",
type=float,
default=None,
help="Experiment stops when this is the minimum episode reward within 1 iteration",
)
parser.add_argument(
"--num_samples",
type=int,
default=1,
help="Amount of times to repeat all experiments",
)
parser.add_argument("--memory", type=int, default=None, help="Amount of total usable memory")
parser.add_argument(
"--object_store_memory",
type=int,
default=None,
help="Amount of memory for the object store",
)
parser.add_argument(
"--redis_max_memory", type=int, default=None, help="Amount of memory for redis"
)
parser.add_argument("--num_workers", type=int, default=4, help="Total number of workers")
parser.add_argument(
"--cpus_for_driver", type=int, default=0, help="Number of CPUs used by the driver"
)
parser.add_argument(
"--gpus_for_driver", type=float, default=1, help="Number of GPUs used by the driver"
)
parser.add_argument(
"--cpus_per_worker", type=int, default=1, help="Number of CPUs used by one worker"
)
parser.add_argument(
"--gpus_per_worker", type=float, default=0, help="Number of GPUs used by one worker"
)
parser.add_argument(
"--num_envs_per_worker",
type=int,
default=8,
help="Number of envs to place on a single worker",
)
parser.add_argument(
"--multi_node",
action="store_true",
default=False,
help="If true the experiments are run in multi-cluster mode",
)
parser.add_argument(
"--local_mode",
action="store_true",
default=False,
help="Force all the computation onto the driver. Useful for debugging.",
)
parser.add_argument(
"--eager_mode",
action="store_true",
default=False,
help="Perform eager execution. Useful for debugging.",
)
parser.add_argument(
"--address",
type=str,
default=None,
help="The address of the Ray cluster to connect to.",
)
parser.add_argument("--use_s3", action="store_true", default=False, help="If true upload to s3")
parser.add_argument(
"--tune_hparams",
action="store_true",
default=False,
help="When provided, run population-based training over hyperparameters",
)
parser.add_argument(
"--grad_clip",
type=float,
default=40,
help="Gradients are clipped by this amount per update.",
)
parser.add_argument(
"--lr",
type=float,
default=0.0001,
help="Default learning rate. Used when lr_schedule_steps/weights are not provided.",
)
parser.add_argument(
"--lr_schedule_steps",
nargs="+",
type=int,
default=None,
help="Amounts of environment steps at which the learning rate has a value specified in"
"--lr_schedule_weights",
)
parser.add_argument(
"--lr_schedule_weights",
nargs="+",
type=float,
default=None,
help="Values for the learning rate schedule. Linearly interpolates using "
"--lr_schedule_steps",
)
parser.add_argument("--entropy_coeff", type=float, default=0.001, help="Entropy reward weight.")
parser.add_argument(
"--use_collective_reward",
action="store_true",
default=False,
help="Train using collective reward instead of individual reward.",
)
# MOA Parameters
parser.add_argument(
"--moa_loss_weight",
type=float,
default=1.0,
help="Loss weight of the moa network",
)
parser.add_argument(
"--influence_reward_weight",
type=float,
default=0.001,
help="The moa reward weight.",
)
parser.add_argument(
"--influence_reward_schedule_steps",
nargs="+",
type=int,
default=None,
help="Amounts of environment steps at which the moa reward has a value specified in"
"--influence_reward_schedule_weights",
)
parser.add_argument(
"--influence_reward_schedule_weights",
nargs="+",
type=float,
default=None,
help="Values for the moa reward schedule. Linearly interpolates using "
"--influence_reward_schedule_steps. The final value is"
" --influence_reward_weight * interpolated_value",
)
# SCM parameters
parser.add_argument(
"--scm_loss_weight",
type=float,
default=1.0,
help="Loss weight of the scm network",
)
parser.add_argument(
"--curiosity_reward_weight",
type=float,
default=0.001,
help="The scm reward weight.",
)
parser.add_argument(
"--curiosity_reward_schedule_steps",
nargs="+",
type=int,
default=None,
help="Amounts of environment steps at which the scm reward has a value specified in"
"--curiosity_reward_schedule_weights",
)
parser.add_argument(
"--curiosity_reward_schedule_weights",
nargs="+",
type=float,
default=None,
help="Values for the scm reward schedule. Linearly interpolates using "
"--curiosity_reward_schedule_steps. The final value is"
" --curiosity_reward_weight * interpolated_value",
)
parser.add_argument(
"--scm_forward_vs_inverse_loss_weight",
type=float,
default=0.2,
help="This weight balances forward and inverse loss weights in the following way:"
"weight * forward_loss + (1 - weight) * inverse_loss"
"Must be in the range [0, 1].",
)
# PPO parameters
parser.add_argument(
"--ppo_sgd_minibatch_size",
type=int,
default=None,
help="Minibatch size for the stochastic gradient descent step in the PPO algorithm. If not"
"specified, defaults to --train_batch_size / 2",
)
# Env-specific parameters
parser.add_argument(
"--num_switches",
type=int,
default=6,
help="Amount of switches in a switch map environment",
)