MixText icon indicating copy to clipboard operation
MixText copied to clipboard

KeyError: unlabeled_train_iter.next()

Open SSSXHJDB opened this issue 3 years ago • 5 comments

%run /code/train.py --gpu=0 --n-labeled=10 --data-path /yahoo_answers_csv/ --batch-size=4 --batch-size-u=8 --epochs=50 --val-iteration=20 --lambda-u=0 --T=0.5 --alpha=16 --mix-layers-set 7 9 12 --separate-mix=True

train(labeled_trainloader, unlabeled_trainloader, model, optimizer, scheduler, criterion, epoch, n_labels, train_aug) 204 (inputs_u, inputs_u2, inputs_ori), (length_u, --> 205 length_u2, length_ori) = unlabeled_train_iter.next() 206 except:

/torch/utils/data/dataloader.py in next(self) 520 self._reset() --> 521 data = self._next_data() 522 self._num_yielded += 1

/torch/utils/data/dataloader.py in _next_data(self) 560 index = self._next_index() # may raise StopIteration --> 561 data = self._dataset_fetcher.fetch(index) # may raise StopIteration 562 if self._pin_memory:

/torch/utils/data/_utils/fetch.py in fetch(self, possibly_batched_index) 43 if self.auto_collation: ---> 44 data = [self.dataset[idx] for idx in possibly_batched_index] 45 else:

/torch/utils/data/_utils/fetch.py in (.0) 43 if self.auto_collation: ---> 44 data = [self.dataset[idx] for idx in possibly_batched_index] 45 else:

/code/read_data.py in getitem(self, idx) 209 if self.aug is not None: --> 210 u, v, ori = self.aug(self.text[idx], self.ids[idx]) 211 encode_result_u, length_u = self.get_tokenized(u)

/code/read_data.py in call(self, ori, idx) 22 def call(self, ori, idx): ---> 23 out1 = self.de[idx] 24 out2 = self.ru[idx]

KeyError: 9226

May I ask what is the reason for this place? Thank you very much.

SSSXHJDB avatar Apr 02 '22 11:04 SSSXHJDB

I have met the same issue...

LauJames avatar Jun 01 '22 03:06 LauJames

I have the same issue. Did anyone solve it yet?

kehanguo avatar Aug 09 '22 02:08 kehanguo

This might be related to the dictionary file about the back-translations. This might be because several sentences are not back-translated, like the 9226th sentence.

jiaaoc avatar Sep 21 '22 17:09 jiaaoc

Has anyone already downloaded the preprocessed dataset? The original URL is invalid, can anyone share the preprocessed dataset? Many thanks.

2514099958 avatar Feb 14 '23 01:02 2514099958