Skip to content

Commit

Permalink
Ignore duplicate entries in dict.txt (and allow explicit special symb…
Browse files Browse the repository at this point in the history
…s) (#1063)

Summary: Pull Request resolved: fairinternal/fairseq-py#1063

Differential Revision: D20248701

Pulled By: myleott

fbshipit-source-id: 5701539e8728816b2e17382788908fd189c5d0e1
  • Loading branch information
myleott authored and facebook-github-bot committed Mar 4, 2020
1 parent 2b5c6e5 commit dd1298e
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions fairseq/data/dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,7 @@ def add_from_file(self, f):
)
word = line[:idx]
count = int(line[idx + 1 :])
self.indices[word] = len(self.symbols)
self.symbols.append(word)
self.count.append(count)
self.add_symbol(word, n=count)

def _save(self, f, kv_iterator):
if isinstance(f, str):
Expand Down

0 comments on commit dd1298e

Please sign in to comment.