Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
rac (#5072)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jing authored Aug 14, 2023
1 parent 4a7ba6b commit e1d899e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions parlai/core/torch_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -2158,6 +2158,13 @@ def act(self):
self.self_observe(response)
return response

def _init_batch_reply(self, num_observations):
batch_reply = [
Message({'id': self.getID(), 'episode_done': False})
for _ in range(num_observations)
]
return batch_reply

def batch_act(self, observations):
"""
Process a batch of observations (batchsize list of message dicts).
Expand All @@ -2182,10 +2189,7 @@ def batch_act(self, observations):
num_observations = len(observations)

# initialize a list of replies with this agent's id
batch_reply = [
Message({'id': self.getID(), 'episode_done': False})
for _ in range(num_observations)
]
batch_reply = self._init_batch_reply(num_observations)

self.is_training = batch.is_training

Expand Down

0 comments on commit e1d899e

Please sign in to comment.