Пример #1
0
def main(game, _seed, _run):
    torch.manual_seed(_seed)

    game = lower_under_to_upper(game) + 'NoFrameskip-v4'
    env = gym.make(game)
    env = wrap_deepmind(env)

    input_space = env.observation_space
    num_actions = env.action_space.n

    agent_params = DeepQAgentParams()
    add_params(params=agent_params, prefix='agent')
    add_params(params=agent_params.optimizer_params, prefix='opt')
    add_epsilon_params(params=agent_params)
    agent_params.obs_filter = AtariObservationFilter()

    input_space = agent_params.obs_filter.output_space(input_space)

    agent_params.sacred_run = _run
    agent_params.env = env
    agent_params.mode = 'train'

    online_q_net = build_net(input_shape=input_space.shape,
                             num_actions=num_actions)
    target_q_net = build_net(input_shape=input_space.shape,
                             num_actions=num_actions)
    agent_params.online_q_net = online_q_net
    agent_params.target_q_net = target_q_net

    agent = agent_params.make_agent()
    agent.run()
Пример #2
0
def main(_seed, _run):
    torch.manual_seed(_seed)

    env = build_env()
    input_shape = env.observation_space.shape
    num_actions = env.action_space.n

    agent_params = DeepQAgentParams()
    add_params(params=agent_params, prefix='agent')
    add_params(params=agent_params.optimizer_params, prefix='opt')
    add_epsilon_params(params=agent_params)

    agent_params.sacred_run = _run
    agent_params.env = env
    agent_params.mode = 'train'

    online_q_net = build_net(input_shape=input_shape, num_actions=num_actions)
    target_q_net = build_net(input_shape=input_shape, num_actions=num_actions)
    agent_params.online_q_net = online_q_net
    agent_params.target_q_net = target_q_net

    agent = agent_params.make_agent()
    agent.run()