Skip to content

Commit

Permalink
change seq2seq to not preprocess if necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
klshuster committed Dec 22, 2017
1 parent 984fc0d commit 5c62c81
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions parlai/agents/seq2seq/seq2seq.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,12 +318,15 @@ def observe(self, observation):
# shallow copy observation (deep copy can be expensive)
obs = observation.copy()
batch_idx = self.opt.get('batchindex', 0)
obs['text2vec'] = maintain_dialog_history(
self.history, obs,
reply=self.answers[batch_idx],
historyLength=self.opt['history_length'],
useReplies=self.opt['history_replies'],
dict=self.dict)
if not obs.get('preprocessed', False):
obs['text2vec'] = maintain_dialog_history(
self.history, obs,
reply=self.answers[batch_idx],
historyLength=self.opt['history_length'],
useReplies=self.opt['history_replies'],
dict=self.dict)
else:
obs['text2vec'] = deque(obs['text2vec'], self.opt['history_length'])
self.observation = obs
self.answers[batch_idx] = None
return obs
Expand Down

0 comments on commit 5c62c81

Please sign in to comment.