Skip to content

Commit

Permalink
Fix BPE for dual learning
Browse files Browse the repository at this point in the history
Summary: Fix integration test

Reviewed By: xianxl

Differential Revision: D18040440

fbshipit-source-id: 98c8ab7970d081f17deb54c69aa35669de12d767
  • Loading branch information
chtran authored and facebook-github-bot committed Nov 1, 2019
1 parent 4c6b689 commit 828c1ca
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fairseq/data/data_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ def batch_by_size(
def process_bpe_symbol(sentence: str, bpe_symbol: str):
if bpe_symbol == 'sentencepiece':
sentence = sentence.replace(' ', '').replace('\u2581', ' ').strip()
elif bpe_symbol == '_EOW':
sentence = sentence.replace(' ', '').replace('_EOW', ' ').strip()
elif bpe_symbol is not None:
sentence = (sentence + ' ').replace(bpe_symbol, '').rstrip()
return sentence

0 comments on commit 828c1ca

Please sign in to comment.