tricktreat / locate-and-label

Code for "Locate and Label: A Two-stage Identifier for Nested Named Entity Recognition", accepted at ACL 2021.
102 stars 18 forks source link

About the problem:"TypeError : object of type 'RootLogger 'has no len ( )" #20

Closed ZCappuccino closed 5 months ago

ZCappuccino commented 5 months ago

Hello, first of all, thank you very much for your papers and source code, provides a very big help ! However, I had some problems at runtime : I replaced the data set with my own labeled data, the data did not use pos, and the ' use_pos ' was set to ' false '. But when I re-trained, the following problems occurred :

Traceback (most recent call last): File "/root/anaconda3/envs/locate/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap self.run() File "/root/anaconda3/envs/locate/lib/python3.8/multiprocessing/process.py", line 108, in run self._target(*self._args, **self._kwargs) File "/root/pyprojects/locate-and-label/identifier.py", line 14, in train trainer.train(train_path=run_args.train_path, valid_path=run_args.valid_path, File "/root/pyprojects/locate-and-label/identifier/identifier_trainer.py", line 168, in train self._train_epoch(model, compute_loss, optimizer, train_dataset, updates_epoch, epoch) File "/root/pyprojects/locate-and-label/identifier/identifier_trainer.py", line 265, in _train_epoch for batch in tqdm(data_loader, total=total, desc='Train epoch %s' % epoch): File "/root/anaconda3/envs/locate/lib/python3.8/site-packages/tqdm/std.py", line 1167, in iter for obj in iterable: File "/root/anaconda3/envs/locate/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 435, in next data = self._next_data() File "/root/anaconda3/envs/locate/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 475, in _next_data data = self._dataset_fetcher.fetch(index) # may raise StopIteration File "/root/anaconda3/envs/locate/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/root/anaconda3/envs/locate/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 44, in data = [self.dataset[idx] for idx in possibly_batched_index] File "/root/pyprojects/locate-and-label/identifier/entities.py", line 456, in getitem__ return sampling.create_train_sample(doc, self._neg_entity_count, self._neg_rel_count, File "/root/pyprojects/locate-and-label/identifier/sampling.py", line 74, in create_train_sample if len(window_sizes) == 1: TypeError: object of type 'RootLogger' has no len()