-
Notifications
You must be signed in to change notification settings - Fork 0
/
train_demo.py
46 lines (42 loc) · 1.15 KB
/
train_demo.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 time
import numpy as np
import yaml
import ray
from ray import tune
from ray.tune.registry import register_env
from demo_env import DemoEnv
if __name__ == '__main__':
register_env("demo", lambda config: DemoEnv(config))
ray.init()
tune.run(
"PPO",
checkpoint_freq=10,
config={
"env": "demo",
"lambda": 0.95,
"kl_coeff": 0.5,
"clip_rewards": True,
"clip_param": 0.2,
"vf_clip_param": 10.0,
"entropy_coeff": 0.01,
"train_batch_size": 1000,
"sample_batch_size": 100,
"sgd_minibatch_size": 500,
"num_sgd_iter": 10,
"num_workers": 16,
"num_envs_per_worker": 16,
"lr": 1e-4,
"gamma": 0.99,
"batch_mode": "truncate_episodes",
"observation_filter": "NoFilter",
"num_gpus": 1,
"env_config": {
"dim": 3,
"waypoints": 4
},
"model": {
"fcnet_activation": "relu",
"fcnet_hiddens": [32, 32],
}
}
)