Skip to content
This repository was archived by the owner on Mar 20, 2026. It is now read-only.

Commit dd1298e

Browse files
Myle Ottfacebook-github-bot
authored andcommitted
Ignore duplicate entries in dict.txt (and allow explicit special symbs) (#1063)
Summary: Pull Request resolved: fairinternal/fairseq-py#1063 Differential Revision: D20248701 Pulled By: myleott fbshipit-source-id: 5701539e8728816b2e17382788908fd189c5d0e1
1 parent 2b5c6e5 commit dd1298e

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

fairseq/data/dictionary.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,7 @@ def add_from_file(self, f):
223223
)
224224
word = line[:idx]
225225
count = int(line[idx + 1 :])
226-
self.indices[word] = len(self.symbols)
227-
self.symbols.append(word)
228-
self.count.append(count)
226+
self.add_symbol(word, n=count)
229227

230228
def _save(self, f, kv_iterator):
231229
if isinstance(f, str):

0 commit comments

Comments
 (0)