-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy patheval_meltingpot.sh
294 lines (285 loc) · 14.1 KB
/
eval_meltingpot.sh
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
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
#!/bin/bash
conda init bash
conda shell.bash activate marl
wandb login a2a1bab96ebbc3869c65e3632485e02fcae9cc42
conda activate marl
environment=$1
seed=$2
module=$3
hidden=$4
units=$5
topk=$6
skill=$7
optimizer=$8
scenario=$9
# Default values in case the environment does not match
agents=0
substrate=""
episode_length=0
bottom=0
sup=0
# Set agents and substrate name based on the environment
# Set agents and substrate name based on the environment
case "$environment" in
"HARVEST")
echo "RUNNING HARVEST"
agents=16
substrate="allelopathic_harvest__open"
episode_length=2000
bottom=32
sup=24
;;
"TERRITORY_O" | "TERRITORY_R" | "TERRITORY_I")
case "$environment" in
"TERRITORY_O")
echo "RUNNING territory__open"
substrate="territory__open"
agents=9
bottom=18 # Adjust these values as necessary for the environment
sup=15
;;
"TERRITORY_R")
echo "RUNNING territory__rooms"
substrate="territory__rooms"
agents=9
bottom=18 # Adjust these values as necessary for the environment
sup=15
;;
"TERRITORY_I")
echo "RUNNING territory__inside_out"
substrate="territory__inside_out"
agents=5
bottom=10 # Adjust these values as necessary for the environment
sup=8
;;
esac
episode_length=1000
;;
"PREDATOR_RF" | "PREDATOR_O" | "PREDATOR_AH" | "PREDATOR_OR")
case "$environment" in
"PREDATOR_RF")
echo "RUNNING predator_prey__random_forest"
substrate="predator_prey__random_forest"
agents=12
bottom=24 # Adjust these values as necessary for the environment
sup=18
;;
"PREDATOR_O")
echo "RUNNING predator_prey__open"
substrate="predator_prey__open"
agents=12
bottom=24 # Adjust these values as necessary for the environment
sup=18
;;
"PREDATOR_AH")
echo "RUNNING predator_prey__alley_hunt"
substrate="predator_prey__alley_hunt"
agents=10
bottom=20 # Adjust these values as necessary for the environment
sup=15
;;
"PREDATOR_OR")
echo "RUNNING predator_prey__orchard"
substrate="predator_prey__orchard"
agents=12
bottom=24 # Adjust these values as necessary for the environment
sup=18
;;
esac
episode_length=1000
;;
"CHICKEN_A" | "CHICKEN_R")
case "$environment" in
"CHICKEN_A")
echo "RUNNING chicken_in_the_matrix__arena"
substrate="chicken_in_the_matrix__arena"
agents=8
bottom=16 # Adjust these values as necessary for the environment
sup=12
;;
"CHICKEN_R")
echo "RUNNING chicken_in_the_matrix__repeated"
substrate="chicken_in_the_matrix__repeated"
agents=2
bottom=4 # Adjust these values as necessary for the environment
sup=3
;;
esac
episode_length=1000
;;
"COOKING_ASY" | "COOKING_CRAMPED" | "COOKING_RING" | "COOKING_CIRCUIT" | "COOKING_FORCED" | "COOKING_EIGHT" | "COOKING_CROWDED")
case "$environment" in
"COOKING_ASY")
echo "RUNNING collaborative_cooking__asymmetric"
substrate="collaborative_cooking__asymmetric"
agents=2
bottom=4 # Adjust these values as necessary for the environment
sup=3
;;
"COOKING_CRAMPED")
echo "RUNNING collaborative_cooking__cramped"
substrate="collaborative_cooking__cramped"
agents=2
bottom=4 # Adjust these values as necessary for the environment
sup=3
;;
"COOKING_RING")
echo "RUNNING collaborative_cooking__ring"
substrate="collaborative_cooking__ring"
agents=2
bottom=4 # Adjust these values as necessary for the environment
sup=3
;;
"COOKING_CIRCUIT")
echo "RUNNING collaborative_cooking__circuit"
substrate="collaborative_cooking__circuit"
agents=2
bottom=4 # Adjust these values as necessary for the environment
sup=3
;;
"COOKING_FORCED")
echo "RUNNING collaborative_cooking__forced"
substrate="collaborative_cooking__forced"
agents=2
bottom=4 # Adjust these values as necessary for the environment
sup=3
;;
"COOKING_EIGHT")
echo "RUNNING collaborative_cooking__figure_eight"
substrate="collaborative_cooking__figure_eight"
agents=6
bottom=12 # Adjust these values as necessary for the environment
sup=9
;;
"COOKING_CROWDED")
echo "RUNNING collaborative_cooking__crowded"
substrate="collaborative_cooking__crowded"
agents=9
bottom=18 # Adjust these values as necessary for the environment
sup=14
;;
esac
episode_length=1000
;;
"SCISSORS_A" | "SCISSORS_R" | "SCISSORS_O")
case "$environment" in
"SCISSORS_A")
echo "RUNNING running_with_scissors_in_the_matrix__arena"
substrate="running_with_scissors_in_the_matrix__arena"
agents=8
bottom=16 # Adjust these values as necessary for the environment
sup=12
;;
"SCISSORS_R")
echo "RUNNING running_with_scissors_in_the_matrix__repeated"
substrate="running_with_scissors_in_the_matrix__repeated"
agents=2
bottom=4 # Adjust these values as necessary for the environment
sup=3
;;
"SCISSORS_O")
echo "RUNNING running_with_scissors_in_the_matrix__one_shot"
substrate="running_with_scissors_in_the_matrix__one_shot"
agents=2
bottom=4 # Adjust these values as necessary for the environment
sup=3
;;
esac
episode_length=1000
;;
"STAG_HUNT")
echo "RUNNING stag_hunt_in_the_matrix__arena"
substrate="stag_hunt_in_the_matrix__arena"
agents=8
episode_length=1000
bottom=16 # Adjust these values as necessary for the environment
sup=12
;;
"CLEAN")
echo "RUNNING clean_up"
agents=7
substrate="clean_up"
episode_length=1000
bottom=14
sup=11
;;
"CHEMISTRY")
echo "RUNNING chemistry"
agents=8
substrate="chemistry__three_metabolic_cycles_with_plentiful_distractors"
episode_length=1000
bottom=16
sup=12
;;
"STRAVINSKY")
echo "RUNNING bach or stravinsky"
agents=8
substrate="bach_or_stravinsky_in_the_matrix__arena"
episode_length=1000
bottom=16
sup=12
;;
"COOKING")
echo "RUNNING coolaborative cooking"
agents=2
substrate="collaborative_cooking__cramped"
episode_length=1000
bottom=4
sup=3
;;
"PRISONERS")
echo "RUNNING prisoners_dilemma_in_the_matrix__arena"
agents=8
substrate="prisoners_dilemma_in_the_matrix__arena"
episode_length=1000
bottom=16
sup=12
;;
*)
echo "Unknown environment: $environment"
exit 1
;;
esac
substrate="${substrate}_${scenario}"
echo "Agents: $agents"
echo "Substrate: $substrate"
echo "Environment: $environment"
echo "Seed: $seed"
echo "Module: $module"
echo "Hidden: $hidden"
echo "Units: $units"
echo "using: $skills"
echo "Optimizer: $optimizer"
if [ "$skill" = "SKILLS" ]; then
export PYTHONPATH="$PYTHONPATH:/home/zsheikhb/MARL/master_skills"
echo "Using skill"
# Execute the program based on the module
if [ "$module" = "RIM" ]; then
echo "Executing program for RIM"
CUDA_VISIBLE_DEVICES=0,1 python /home/zsheikhb/MARL/master_skills/onpolicy/scripts/eval/eval_meltingpot.py --num_env_steps ${episode_length} --bottom_up_form_num_of_objects ${bottom} --sup_attention_num_keypoints ${sup} --rim_num_units ${units} --rim_topk ${topk} --use_valuenorm False --use_popart True --env_name "Meltingpot" --experiment_name "check" --substrate_name "${substrate}" --num_agents ${agents} --seed ${seed} --n_rollout_threads 1 --use_wandb True --share_policy False --use_centralized_V False --use_attention True --use_naive_recurrent_policy False --use_recurrent_policy False --hidden_size ${hidden} --use_gae True --episode_length ${episode_length} --attention_module ${module} --algorithm_name mappo --lr 0.00002 --max_grad_norm 0.2 --num_bands_positional_encoding 32 --skill_dim 128 --num_training_skill_dynamics 1 --entropy_coef 0.004 --skill_discriminator_lr 0.00001 --coefficient_skill_return 0.005
elif [ "$module" = "SCOFF" ]; then
echo "Executing program for SCOFF"
CUDA_VISIBLE_DEVICES=0,1 python /home/zsheikhb/MARL/master_skills/onpolicy/scripts/eval/eval_meltingpot.py --num_env_steps ${episode_length} --bottom_up_form_num_of_objects ${bottom} --sup_attention_num_keypoints ${sup} --scoff_num_units ${units} --scoff_topk ${topk} --use_valuenorm False --use_popart True --env_name "Meltingpot" --experiment_name "check" --substrate_name "${substrate}" --num_agents ${agents} --seed ${seed} --n_rollout_threads 1 --use_wandb True --share_policy False --use_centralized_V False --use_attention True --use_naive_recurrent_policy False --use_recurrent_policy False --hidden_size ${hidden} --use_gae True --episode_length ${episode_length} --attention_module ${module} --algorithm_name mappo --lr 0.00002 --max_grad_norm 0.2 --num_bands_positional_encoding 32 --skill_dim 128 --num_training_skill_dynamics 1 --entropy_coef 0.004 --skill_discriminator_lr 0.00001 --coefficient_skill_return 0.005
elif [ "$module" = "LSTM" ]; then
echo "Executing program for LSTM"
CUDA_VISIBLE_DEVICES=0,1 python /home/zsheikhb/MARL/master_skills/onpolicy/scripts/eval/eval_meltingpot.py --num_env_steps ${episode_length} --bottom_up_form_num_of_objects ${bottom} --sup_attention_num_keypoints ${sup} --use_valuenorm False --use_popart True --env_name "Meltingpot" --experiment_name "check" --substrate_name "${substrate}" --num_agents ${agents} --seed ${seed} --n_rollout_threads 1 --use_wandb True --share_policy False --use_centralized_V False --use_attention False --use_naive_recurrent_policy True --use_recurrent_policy True --hidden_size ${hidden} --use_gae True --episode_length ${episode_length} --attention_module ${module} --algorithm_name mappo --lr 0.00002 --max_grad_norm 0.2 --num_bands_positional_encoding 32 --skill_dim 128 --num_training_skill_dynamics 1 --entropy_coef 0.004 --skill_discriminator_lr 0.00001 --coefficient_skill_return 0.005
else
echo "Module is neither RIM nor SCOFF, nor LSTM"
fi
else
export PYTHONPATH="$PYTHONPATH:/home/zsheikhb/MARL/master"
echo "Not using skill"
# Execute the program based on the module
if [ "$module" = "RIM" ]; then
echo "Executing program for RIM"
CUDA_VISIBLE_DEVICES=0,1 python /home/zsheikhb/MARL/master/onpolicy/scripts/eval/eval_meltingpot.py --num_env_steps ${episode_length} --optimizer ${optimizer} --rim_num_units ${units} --rim_topk ${topk} --use_valuenorm False --use_popart True --env_name "Meltingpot" --experiment_name "check" --substrate_name "${substrate}" --num_agents ${agents} --seed ${seed} --n_rollout_threads 1 --use_wandb True --share_policy False --use_centralized_V False --use_attention True --use_naive_recurrent_policy False --use_recurrent_policy False --hidden_size ${hidden} --use_gae True --episode_length ${episode_length} --attention_module ${module} --algorithm_name mappo --lr 0.00002 --max_grad_norm 0.2 --entropy_coef 0.004
elif [ "$module" = "SCOFF" ]; then
echo "Executing program for SCOFF"
CUDA_VISIBLE_DEVICES=0,1 python /home/zsheikhb/MARL/master/onpolicy/scripts/eval/eval_meltingpot.py --num_env_steps ${episode_length} --optimizer ${optimizer} --scoff_num_units ${units} --scoff_topk ${topk} --use_valuenorm False --use_popart True --env_name "Meltingpot" --experiment_name "check" --substrate_name "${substrate}" --num_agents ${agents} --seed ${seed} --n_rollout_threads 1 --use_wandb True --share_policy False --use_centralized_V False --use_attention True --use_naive_recurrent_policy False --use_recurrent_policy False --hidden_size ${hidden} --use_gae True --episode_length ${episode_length} --attention_module ${module} --algorithm_name mappo --lr 0.00002 --max_grad_norm 0.2 --entropy_coef 0.004
elif [ "$module" = "LSTM" ]; then
echo "Executing program for LSTM"
CUDA_VISIBLE_DEVICES=0,1 python /home/zsheikhb/MARL/master/onpolicy/scripts/eval/eval_meltingpot.py --num_env_steps ${episode_length} --optimizer ${optimizer} --use_valuenorm False --use_popart True --env_name "Meltingpot" --experiment_name "check" --substrate_name "${substrate}" --num_agents ${agents} --seed ${seed} --n_rollout_threads 1 --use_wandb True --share_policy False --use_centralized_V False --use_attention False --use_naive_recurrent_policy True --use_recurrent_policy True --hidden_size ${hidden} --use_gae True --episode_length ${episode_length} --attention_module ${module} --algorithm_name mappo --lr 0.00002 --max_grad_norm 0.2 --entropy_coef 0.004
else
echo "Module is neither RIM nor SCOFF, nor LSTM"
fi
fi