Exemplo n.º 1
0
def test_single_cnn_ppo_rnd():
    env_name = "PongNoFrameskip-v4"

    envs = agnes.make_env(env_name)

    runner = agnes.runners.Single(envs, agnes.PPORND, agnes.CNN, config=test_config())
    runner.run()
Exemplo n.º 2
0
def test_single():
    env = agnes.make_env('CartPole-v0')

    runner = agnes.Single(env, agnes.PPO, agnes.MLP, config=test_config())
    runner.log(agnes.log)
    runner.run(100)
    runner.trainer.save("Test.pth")
    runner.worker.load("Test.pth")
Exemplo n.º 3
0
def test_single_cnn():
    env_name = "PongNoFrameskip-v4"

    envs = agnes.make_env(env_name)

    runner = agnes.runners.Single(envs, agnes.PPO, agnes.CNN, config=test_config())
    runner.log(agnes.TensorboardLogger(), agnes.log)
    runner.run()
Exemplo n.º 4
0
def test_single():
    env = agnes.make_env('CartPole-v0')

    runner = agnes.Single(env, agnes.PPO, agnes.RNN, config=test_config())
    runner.log(agnes.log)
    runner.run()
Exemplo n.º 5
0
import agnes

env_name = "Ant-v2"

if __name__ == '__main__':
    env = agnes.make_env(env_name)

    runner = agnes.Single(env, agnes.PPO, agnes.MLP)

    runner.load("results/MuJoCo/Ant-v2_MLP/PPO/weights.pth")

    agnes.common.Visualize(runner.worker, env).prerun(1000).run()
Exemplo n.º 6
0
def test_single():
    env = agnes.make_env('CartPole-v0')

    runner = agnes.CompetitiveRunner(env, agnes.PPO, agnes.MLP, config=test_config(), breed_size=100)
    runner.log(agnes.log)
    runner.run(100)
Exemplo n.º 7
0
            )

            video.write(prep)

            self.state, _, done, _ = self.env.step(dist.sample().cpu().numpy())

            if done.item():
                self.hidden = None

        video.release()

    def _save_output(self, module, input, output):
        self.outputs.append(output[0])

    def _save_gradient(self, module, grad_input, grad_output):
        self.gradients.append(grad_output[0])


env_name = "BreakoutNoFrameskip-v4"

env = agnes.make_env(env_name, config={"frame_stack": True})
config, _ = agnes.PPO.get_config(env["env_type"])

runner = agnes.Single(env, agnes.PPO, agnes.LSTMCNN, config=config)

runner.trainer.load("results/Atari-BreakoutNoFrameskip-v4-PPO-10M/Breakout.pth")

VisualizeAttention(env, runner, seconds=60, layer_num=1).run()

print("Done!")
Exemplo n.º 8
0
def test_single():
    env = agnes.make_env('Pendulum-v0')

    runner = agnes.Single(env, agnes.PPO, agnes.MLP, config=test_config())
    runner.log(agnes.CsvLogger())
    runner.run()