-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
43 lines (37 loc) · 1.24 KB
/
test.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
import gym
import json
from pathlib import Path
# import wandb
import hydra
from omegaconf import DictConfig, OmegaConf
import logging
import os.path
import sys
from carla_gym.utils import config_utils
@hydra.main(config_path='config', config_name='benchmark')
def main(cfg: DictConfig):
agents_dict = {}
obs_configs = {}
reward_configs = {}
terminal_configs = {}
agent_names = []
# for k, v in cfg.items():
# print(f"{k} {v}")
for ev_id, ev_cfg in cfg.actors.items():
# print(f"ev id: {ev_id} ev config: {ev_cfg}")
agent_names.append(ev_cfg.agent)
cfg_agent = cfg.agent[ev_cfg.agent]
print(cfg.agent)
print(ev_cfg.agent)
print(cfg_agent)
# print(cfg_agent)
OmegaConf.save(config=cfg_agent, f='./config_agent.yaml')
AgentClass = config_utils.load_entry_point(cfg_agent.entry_point)
agents_dict[ev_id] = AgentClass('./config_agent.yaml')
obs_configs[ev_id] = agents_dict[ev_id].obs_configs
print(obs_configs)
# # get obs_configs from agent
# reward_configs[ev_id] = OmegaConf.to_container(ev_cfg.reward)
# terminal_configs[ev_id] = OmegaConf.to_container(ev_cfg.terminal)
if __name__=='__main__':
main()