Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
torchtext.data.iterator have add reverse #200
referenced this pull request
Aug 30, 2017
Agree with your thinking, but I think there should be some comment at the error line to remind somebody who install torchtext by git from the origin repo.
Yes, we would love to have contributions of conv2conv, particularly if you were able to replicate. You can look at how we implemented "Attention is all you need" for a guide. Just add in
pushed a commit
this pull request
Sep 20, 2017
Hi, I think the bug occurs again when running valid_data_iter.
def make_valid_data_iter(valid_data, opt): return onmt.IO.OrderedIterator( dataset=valid_data, batch_size=opt.batch_size, device=opt.gpuid if opt.gpuid else -1, train=False, sort=True)
For this valid_data_iter, self.batches is already sorted in decreasing order before self.__iter__ is called.
if self.sort_within_batch: # NOTE: `rnn.pack_padded_sequence` requires that a minibatch # be sorted by decreasing order, which requires reversing # relative to typical sort keys if self.sort: minibatch.reverse() else: minibatch.sort(key=self.sort_key, reverse=True)
valid_data_iter has self.sort == self.sort_within_batch == true, so the data is reversed again, to increasing order!
For train_data_iter, it works fine.
I use code from master branch.
Thank you @JianyuZhan! Could you please advise me on how to install version 0.1.1 for windows?
Hi again - just for future references: I cloned https://github.com/pytorch/text/tree/release-0.1.1/torchtext and ran 'python setup.py install'. Thank you for your great work!