diff --git a/fairseq/data/dictionary.py b/fairseq/data/dictionary.py index 745db16e43..9b893c858e 100644 --- a/fairseq/data/dictionary.py +++ b/fairseq/data/dictionary.py @@ -131,7 +131,7 @@ def add_symbol(self, word, n=1, overwrite=True): self.count[idx] = self.count[idx] + n return idx else: - idx = len(self.indices) + idx = len(self.symbols) self.indices[word] = idx self.symbols.append(word) self.count.append(n)