Skip to content

Commit

Permalink
apply ignore_prompt on valid batches (OpenNMT#2568)
Browse files Browse the repository at this point in the history
  • Loading branch information
l-k-11235 authored Mar 13, 2024
1 parent c9c9ee3 commit 8479526
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions onmt/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,8 @@ def validate(self, valid_iter, moving_average=None):
)

# Compute loss.
if self.zero_out_prompt_loss:
batch = self.valid_loss.ignore_prompt(batch)
_, batch_stats = self.valid_loss(batch, model_out, attns)

stats.update(batch_stats)
Expand Down

0 comments on commit 8479526

Please sign in to comment.