oudalab / StructuredEventExtraction

0 stars 0 forks source link

need to be solved error when adding in topic #4

Closed YanLiang1102 closed 3 years ago

YanLiang1102 commented 3 years ago
 File "bert_crf.py", line 749, in <module>
    t_loss, v_loss = train_topic(train_iter, eval_iter, tag2idx, topic2idx, config=config, bert_model=config.bert_model)
  File "bert_crf.py", line 496, in train_topic
    for step, batch in enumerate(epoch_iterator):
  File "/home/ubuntu/ynliang/vir/transformers/lib/python3.7/site-packages/tqdm/std.py", line 1152, in __iter__
sorted idx: tensor([11,  2,  4,  7,  9,  0,  3,  1,  8, 14,  6, 12, 10, 15,  5, 13])
    for obj in iterable:
  File "/home/ubuntu/ynliang/vir/transformers/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 435, in __next__
    data = self._next_data()
  File "/home/ubuntu/ynliang/vir/transformers/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 1085, in _next_data
    return self._process_data(data)
  File "/home/ubuntu/ynliang/vir/transformers/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 1111, in _process_data
    data.reraise()
  File "/home/ubuntu/ynliang/vir/transformers/lib/python3.7/site-packages/torch/_utils.py", line 428, in reraise
    raise self.exc_type(msg)
ValueError: Caught ValueError in DataLoader worker process 0.
Original Traceback (most recent call last):
  File "/home/ubuntu/ynliang/vir/transformers/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 198, in _worker_loop
    data = fetcher.fetch(index)
  File "/home/ubuntu/ynliang/vir/transformers/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 47, in fetch
    return self.collate_fn(data)
  File "bert_crf.py", line 203, in pad
    labels = LT(label)[sorted_idx]
ValueError: expected sequence of length 63 at dim 1 (got 65)
YanLiang1102 commented 3 years ago

done. using the '|' as delimiter solve the problem.