Commit 680571d0 authored by Dipam Chakraborty's avatar Dipam Chakraborty
Browse files

Merge branch 'eric/agents' into 'master'

Move agents.

See merge request dipam/neurips-2021-nethack-challenge!2
parents 4d3405f5 4c718543
......@@ -3,19 +3,11 @@ import numpy as np
from agents.batched_agent import BatchedAgent
class RandomAgent(BatchedAgent):
"""This random agent just selects an action from the action space."""
def __init__(self, num_envs, num_actions):
super().__init__(num_envs, num_actions)
self.seeded_state = np.random.RandomState(42)
def preprocess_observations(self, observations, rewards, dones, infos):
return observations, rewards, dones, infos
def postprocess_actions(self, actions):
return actions
def batched_step(self, observations, rewards, dones, infos):
rets = self.preprocess_observations(observations, rewards, dones, infos)
observations, rewards, dones, infos = rets
actions = self.seeded_state.randint(self.num_actions, size=self.num_envs)
actions = self.postprocess_actions(actions)
return actions
\ No newline at end of file
from agents.random_batched_agent import RandomAgent
from agents.random_agent import RandomAgent
# from agents.torchbeast_batched_agent import TorchBeastAgent
# from agents.rllib_batched_agent import RLlibAgent
# from agents.rllib_agent import RLlibAgent
from submission_wrappers import addtimelimitwrapper_fn
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment