-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconstants.py
More file actions
120 lines (105 loc) · 3.63 KB
/
Copy pathconstants.py
File metadata and controls
120 lines (105 loc) · 3.63 KB
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
import os
"""
This file is a Singleton instance that holds project wide constants
Note: This file should NOT be used for experiment configuration, rather these are constants that will rarely, if ever, be changed.
I.e. a reference to the root directory of the project
Use Example
>>> from constants import ROOT_DIR
"""
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
DEMONSTRATION_DIR = os.path.join(ROOT_DIR, 'data', "demonstrations")
# ONLINE RLHF OUTPUTS
ONLINE_EXP_ROOT = os.path.expanduser("~/Documents/VMAS_Experiments/")
DEMO_FILENAMES = {
"obs": "obs.csv",
"act": "actions.csv",
"info": "info.csv",
"reward": "rewards.csv",
"done": "done.csv",
"config": "config.yml",
}
BASE_ENV_CONFIG = {
"device": "cpu",
"continuous_actions": True,
"max_steps": 500,
"scenario_config": {
"n_agents": 3,
},
}
BASE_PPO_CONFIG = {
"framework": "torch",
"num_gpus": 0,
"num_workers": 0,
"train_batch_size": 60000,
"rollout_fragment_length": 125,
"sgd_minibatch_size": 4096,
"explore": False,
"env_config": BASE_ENV_CONFIG,
}
BASE_MULTI_AGENT_CONFIG = {
"activation_fn": "relu",
"heterogeneous": False,
"comm_radius": 0.35,
"pos_start": 0,
"pos_dim": 2,
"vel_start": 2,
"vel_dim": 2,
"trainer": "MultiPPOTrainer",
"share_action_value": False,
"use_beta": False,
"add_agent_index": False,
"aggr": "add",
"gnn_type": "MatPosConv",
}
ALGO_CONFIG = {
"CPPO": {"use_mlp": True, "centralized_critic": False, "share_observations": False, "heterogeneous": False},
"GAPPO": {"use_mlp": False, "centralized_critic": True, "share_observations": True, "heterogeneous": False},
"MAPPO": {"use_mlp": False, "centralized_critic": True, "share_observations": False, "heterogeneous": False},
"GPPO": {"use_mlp": False, "centralized_critic": False, "share_observations": True, "heterogeneous": False},
"IPPO": {"use_mlp": False, "centralized_critic": False, "share_observations": False, "heterogeneous": False},
}
DEFAULT_AGENTS_COUNT = {
"balance": 3,
"transport": 3,
"buzz_wire": 2,
"football": 3,
"navigation": 3,
"wheel": 3,
"diffdrive_navigation": 3,
"diffdrive_pusher": 3
}
GT_REWARD_KEY = {
"balance": "custom_metrics/agent_0/gt_reward_mean",
"transport": "custom_metrics/agent_0/gt_reward_mean",
"buzz_wire": "custom_metrics/agent_0/gt_reward_mean",
"football": "custom_metrics/agent_blue_0/gt_reward_mean",
"navigation": "custom_metrics/agent_0/gt_reward_mean",
"wheel": "custom_metrics/agent_0/gt_reward_mean",
"diffdrive_navigation": "custom_metrics/agent_0/gt_reward_mean"
}
ONLINE_RLHF_EXPERIMENT_CONFIG = {
"MAX_CYCLES": 100,
"EPISODE_LENGTH": 500,
"REWARD_ITERS_PER_CYCLE": 3,
"INIT_TRAIN_DEMOS": 10,
"INIT_TEST_DEMOS": 5,
"TRAIN_DEMOS_PER_CYCLE": 5,
"TEST_DEMOS_PER_CYCLE": 2,
"TRAIN_PREFERENCES_PER_CYCLE": 50,
"TEST_PREFERENCES_PER_CYCLE": 15,
"MAX_PREFS": 5000,
"POLICY_STEPS_PER_CYCLE": int(5e5),
"MAX_RL_TIMEOUT_SEC": 300,
"SEGMENT_LENGTH": 20,
}
KEYBOARD_DEMO_INSTRUCTIONS = """
You can change the agent to control by pressing TAB.
You can reset the environment by pressing R.
You can control agent actions with the arrow keys and M/N (left/right control the first action, up/down control the second, M/N controls the third)
If you have more than 1 agent, you can control another one with W,A,S,D and Q,E in the same way.
and switch the agent using LSHIFT.
"""
POLICY_DEMO_INSTRUCTIONS = """
An AI agent (policy) will now execute a policy to collect demonstrations.
To terminate, use Ctrl+C in the terminal or close the simulator GUI.
"""