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

Commit 56e4e62

Browse files
cndnfacebook-github-bot
authored andcommitted
Fix dimension off by not adding things to dictionary in intermediate eval (#573)
Summary: Pull Request resolved: #573 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. Reviewed By: jmp84 Differential Revision: D15793470 fbshipit-source-id: 670de05741607e6765cb8f839cab1301999ba1f0
1 parent 90d8ef3 commit 56e4e62

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pytorch_translate/generate.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,9 @@ def _generate_score(models, args, task, dataset):
205205
maxlen_b=args.max_len_b,
206206
cuda=use_cuda,
207207
timer=gen_timer,
208-
prefix_size=1 if pytorch_translate_data.is_multilingual_many_to_one(args) else 0,
208+
prefix_size=1
209+
if pytorch_translate_data.is_multilingual_many_to_one(args)
210+
else 0,
209211
)
210212

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

0 commit comments

Comments
 (0)