-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheval.py
59 lines (44 loc) · 1.95 KB
/
eval.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
from pogema_toolbox.create_env import create_env_base, Environment
from pogema_toolbox.evaluator import evaluation
from pogema import BatchAStarAgent
from pogema_toolbox.eval_utils import initialize_wandb, save_evaluation_results
from pathlib import Path
import wandb
import yaml
from pogema_toolbox.registry import ToolboxRegistry
from follower.inference import FollowerInference, FollowerInferenceConfig
from follower.preprocessing import follower_preprocessor
from follower_cpp.inference import FollowerConfigCPP, FollowerInferenceCPP
from follower_cpp.preprocessing import follower_cpp_preprocessor
PROJECT_NAME = 'pogema-toolbox'
BASE_PATH = Path('experiments')
def main(disable_wandb=False):
ToolboxRegistry.register_env('Pogema-v0', create_env_base, Environment)
ToolboxRegistry.register_algorithm('A*', BatchAStarAgent)
ToolboxRegistry.register_algorithm('Follower', FollowerInference, FollowerInferenceConfig,
follower_preprocessor)
ToolboxRegistry.register_algorithm('FollowerLite', FollowerInferenceCPP, FollowerConfigCPP,
follower_cpp_preprocessor)
with open("env/test-maps.yaml", 'r') as f:
maps_to_register = yaml.safe_load(f)
ToolboxRegistry.register_maps(maps_to_register)
folder_names = [
'01-random-20x20',
'02-mazes',
'03-den520d',
'04-Paris_1',
'05-warehouse',
]
for folder in folder_names:
config_path = BASE_PATH / folder / f"{Path(folder).name}.yaml"
eval_dir = BASE_PATH / folder
with open(config_path) as f:
evaluation_config = yaml.safe_load(f)
if folder == 'eval-fast':
disable_wandb = True
initialize_wandb(evaluation_config, eval_dir, disable_wandb, PROJECT_NAME)
evaluation(evaluation_config, eval_dir=eval_dir)
save_evaluation_results(eval_dir)
wandb.finish()
if __name__ == '__main__':
main()