-
Notifications
You must be signed in to change notification settings - Fork 1
/
run.py
35 lines (29 loc) · 789 Bytes
/
run.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
from ddpg import DDPG
from rllab.envs.box2d.cartpole_env import CartpoleEnv
from rllab.envs.normalized_env import normalize
from policies import DeterministicMLPPolicy
from qfuncs import ContinuousMLPQ
from strategies import OUStrategy
from utils import SEED
import mxnet as mx
# set environment, policy, qfunc, strategy
env = normalize(CartpoleEnv())
policy = DeterministicMLPPolicy(env.spec)
qfunc = ContinuousMLPQ(env.spec)
strategy = OUStrategy(env.spec)
# set the training algorithm and train
algo = DDPG(
env=env,
policy=policy,
qfunc=qfunc,
strategy=strategy,
ctx=mx.gpu(0),
max_path_length=100,
epoch_length=1000,
memory_start_size=10000,
n_epochs=1000,
discount=0.99,
qfunc_lr=1e-3,
policy_lr=1e-4,
seed=SEED)
algo.train()