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

Commit

Permalink
Fix dimension off by not adding things to dictionary in intermediate …
Browse files Browse the repository at this point in the history
…eval

Summary: Repeat title. The long term solution could be to add an option to distinguish intermediate eval. But confirmed with Juan setting it to False shouldn't affect existing stuff.

Differential Revision: D15793470

fbshipit-source-id: 3188d476e52c836d3708122d2703b75a66aee8b3
  • Loading branch information
cndn authored and facebook-github-bot committed Jun 14, 2019
1 parent 01985e0 commit 5e4144f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pytorch_translate/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,9 @@ def _generate_score(models, args, task, dataset):
maxlen_b=args.max_len_b,
cuda=use_cuda,
timer=gen_timer,
prefix_size=1 if pytorch_translate_data.is_multilingual_many_to_one(args) else 0,
prefix_size=1
if pytorch_translate_data.is_multilingual_many_to_one(args)
else 0,
)

for trans_info in _iter_translations(
Expand Down Expand Up @@ -432,7 +434,7 @@ def _iter_translations(args, task, dataset, translations, align_dict, rescorer):
# Convert back to tokens for evaluation with unk replacement
# and/or without BPE
target_tokens = task.target_dictionary.encode_line(
target_str, add_if_not_exist=True
target_str, add_if_not_exist=False
)
# The probs score for the hypo_str; whether it's normalized by
# sequence length or not depends on normalize_scores, which is
Expand Down

0 comments on commit 5e4144f

Please sign in to comment.