runner.run(episodes=episodes,max_episode_timesteps=200,episode_finished=episode_finished)
agent.save_model(directory='savefile/ppo')
saved_agent = agent.restore_model(directory="savefile/ppo")
env = gym.make("CartPole-v0")
s = env.reset()
done = False
while not done:
env.render()
action = saved_agent.act(s)
s, r, done, _ = env.step(action)
还原模型时发生错误:
RuntimeError:尝试使用封闭会话。