Browse Source

cartpolev0-cartpolev1

tags/v1.2.0-rc1
xiaoyisd 4 years ago
parent
commit
3d1ce87d70
2 changed files with 3 additions and 3 deletions
  1. +1
    -1
      model_zoo/official/rl/dqn/eval.py
  2. +2
    -2
      model_zoo/official/rl/dqn/train.py

+ 1
- 1
model_zoo/official/rl/dqn/eval.py View File

@@ -33,7 +33,7 @@ set_seed(1)


if __name__ == "__main__": if __name__ == "__main__":
context.set_context(mode=context.GRAPH_MODE, device_target=args.device_target) context.set_context(mode=context.GRAPH_MODE, device_target=args.device_target)
env = gym.make('CartPole-v0')
env = gym.make('CartPole-v1')
cfg.state_space_dim = env.observation_space.shape[0] cfg.state_space_dim = env.observation_space.shape[0]
cfg.action_space_dim = env.action_space.n cfg.action_space_dim = env.action_space.n
agent = Agent(**cfg) agent = Agent(**cfg)


+ 2
- 2
model_zoo/official/rl/dqn/train.py View File

@@ -34,13 +34,13 @@ set_seed(1)


if __name__ == "__main__": if __name__ == "__main__":
context.set_context(mode=context.GRAPH_MODE, device_target=args.device_target) context.set_context(mode=context.GRAPH_MODE, device_target=args.device_target)
env = gym.make('CartPole-v0')
env = gym.make('CartPole-v1')
cfg.state_space_dim = env.observation_space.shape[0] cfg.state_space_dim = env.observation_space.shape[0]
cfg.action_space_dim = env.action_space.n cfg.action_space_dim = env.action_space.n
agent = Agent(**cfg) agent = Agent(**cfg)
agent.load_dict() agent.load_dict()


for episode in range(150):
for episode in range(300):
s0 = env.reset() s0 = env.reset()
total_reward = 1 total_reward = 1
while True: while True:


Loading…
Cancel
Save