-
Notifications
You must be signed in to change notification settings - Fork 57
/
eval_sl.py
45 lines (35 loc) · 1.53 KB
/
eval_sl.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
import os
USED_DEVICES = "-1" # if your want to use CPU in a server with GPU, change "0" to "-1"
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = USED_DEVICES
os.environ["CUDA_LAUNCH_BLOCKING"] = "1"
import alphastarmini
import torch
from alphastarmini.core.arch import entity_encoder
from alphastarmini.core.arch import scalar_encoder
from alphastarmini.core.arch import spatial_encoder
from alphastarmini.core.arch import arch_model
from alphastarmini.core.arch import action_type_head
from alphastarmini.core.arch import selected_units_head
from alphastarmini.core.arch import target_unit_head
from alphastarmini.core.arch import delay_head
from alphastarmini.core.arch import queue_head
from alphastarmini.core.arch import location_head
from alphastarmini.core.arch import agent
from alphastarmini.core.arch import baseline
from alphastarmini.core.sl import load_pickle
from alphastarmini.core.rl import action
from alphastarmini.core.rl import env_utils
from alphastarmini.core.rl import actor
from alphastarmini.core.rl import against_computer
from alphastarmini.core.rl import pseudo_reward
import param as P
if __name__ == '__main__':
# if we don't add this line, it may cause running time error while in Windows
# torch.multiprocessing.freeze_support()
print("run init")
# ------------------------
# 3. we use RL environment to multi-process (thread) evaluate SL model
from alphastarmini.core.rl import mp_rl_eval_sl
mp_rl_eval_sl.test(on_server=P.on_server)
print('run over')