Skip to content

Commit

Permalink
undid changes to train_model
Browse files Browse the repository at this point in the history
  • Loading branch information
Emily Dinan committed Dec 22, 2017
1 parent 40e6e99 commit 99f38a6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions examples/train_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,7 @@ def validate(self):
valid_report, self.valid_world = run_eval(
self.agent, opt, 'valid', opt['validation_max_exs'],
valid_world=self.valid_world)
if valid_report[opt['validation_metric']] > self.best_valid or \
valid_report[opt['validation_metric']] == 1:
if valid_report[opt['validation_metric']] > self.best_valid:
self.best_valid = valid_report[opt['validation_metric']]
self.impatience = 0
print('[ new best {}: {} ]'.format(
Expand Down
2 changes: 1 addition & 1 deletion parlai/agents/seq2seq/seq2seq.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ def predict(self, xs, ys=None, cands=None, valid_cands=None, lm=False):
self.zero_grad()
loss = 0
predictions, scores, _ = self.model(xs, ys)
for i in range(ys.size(1)):
for i in range(scores.size(1)):
# sum loss per-token
score = scores.select(1, i)
y = ys.select(1, i)
Expand Down

0 comments on commit 99f38a6

Please sign in to comment.