for batch_dict in pg(es):
tgt = batch_dict["tgt"]
tgt_lens = batch_dict["tgt_lengths"]
pred = [p[0] for p in self._predict(batch_dict, numpy_to_tensor=False, **kwargs)]
preds.extend(convert_seq2seq_preds(pred, self.tgt_rlut))
golds.extend(convert_seq2seq_golds(tgt, tgt_lens, self.tgt_rlut))
metrics = {"bleu": bleu(preds, golds, self.bleu_n_grams)[0]}
After Change
for batch_dict in pg(es):
tgt = batch_dict["tgt"]
tgt_lens = batch_dict["tgt_lengths"]
pred = [p[0] for p in self._predict(batch_dict, numpy_to_tensor=False, **kwargs)[0]]
preds.extend(convert_seq2seq_preds(pred, self.tgt_rlut))
golds.extend(convert_seq2seq_golds(tgt, tgt_lens, self.tgt_rlut))
metrics = {"bleu": bleu(preds, golds, self.bleu_n_grams)[0]}