Skip to content

Commit

Permalink
Fix concat bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Stonesjtu committed Jul 11, 2018
1 parent 0a3bc40 commit 0f4cf44
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions data.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ def __init__(self, path, vocab_path=None, batch_size=1, shuffle=False,
self.concat = concat

self.vocab = get_vocab(path, ['train.txt'], min_freq=min_freq, vocab_file=vocab_path)
if self.concat:
# set the frequencies for special tokens by miracle trial
self.vocab.idx2count[1] = self.vocab.freqs[BOS] # <s>
self.vocab.idx2count[2] = 0 # </s>

self.train = self.get_dataloader('train.txt', self.batch_size)
self.valid = self.get_dataloader('valid.txt', 1)
self.test = self.get_dataloader('test.txt', 1)
Expand Down

0 comments on commit 0f4cf44

Please sign in to comment.