alibaba-damo-academy / SpokenNLP

A wide variety of research projects developed by the SpokenNLP team of Speech Lab, Alibaba Group.
Apache License 2.0
100 stars 11 forks source link

TypeError: _batch_encode_plus() got an unexpected keyword argument 'label2id' #1

Open zy614582280 opened 1 year ago

zy614582280 commented 1 year ago

Traceback (most recent call last): File "./src/action_item_detection/structbert_meeting_action.py", line 348, in trainer.train() File "/mnt/lustre02/jiangsu/aispeech/home/yz118/.conda/envs/modelscope/lib/python3.8/site-packages/modelscope/trainers/trainer.py", line 496, in train self.train_loop(self.train_dataloader) File "/mnt/lustre02/jiangsu/aispeech/home/yz118/.conda/envs/modelscope/lib/python3.8/site-packages/modelscope/trainers/trainer.py", line 891, in train_loop for i, data_batch in enumerate(data_loader): File "/mnt/lustre02/jiangsu/aispeech/home/yz118/.conda/envs/modelscope/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 681, in next data = self._next_data() File "/mnt/lustre02/jiangsu/aispeech/home/yz118/.conda/envs/modelscope/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1376, in _next_data return self._process_data(data) File "/mnt/lustre02/jiangsu/aispeech/home/yz118/.conda/envs/modelscope/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1402, in _process_data data.reraise() File "/mnt/lustre02/jiangsu/aispeech/home/yz118/.conda/envs/modelscope/lib/python3.8/site-packages/torch/_utils.py", line 461, in reraise raise exception TypeError: Caught TypeError in DataLoader worker process 0. Original Traceback (most recent call last): File "/mnt/lustre02/jiangsu/aispeech/home/yz118/.conda/envs/modelscope/lib/python3.8/site-packages/torch/utils/data/_utils/worker.py", line 302, in _worker_loop data = fetcher.fetch(index) File "/mnt/lustre02/jiangsu/aispeech/home/yz118/.conda/envs/modelscope/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 49, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/mnt/lustre02/jiangsu/aispeech/home/yz118/.conda/envs/modelscope/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 49, in data = [self.dataset[idx] for idx in possibly_batched_index] File "/mnt/lustre02/jiangsu/aispeech/home/yz118/.conda/envs/modelscope/lib/python3.8/site-packages/modelscope/msdatasets/task_datasets/torch_base_dataset.py", line 25, in getitem return self.prepare_sample(self._inner_dataset[index]) File "/mnt/lustre02/jiangsu/aispeech/home/yz118/.conda/envs/modelscope/lib/python3.8/site-packages/modelscope/msdatasets/task_datasets/torch_base_dataset.py", line 63, in prepare_sample return self.preprocessor( File "/mnt/lustre02/jiangsu/aispeech/home/yz118/.conda/envs/modelscope/lib/python3.8/site-packages/modelscope/preprocessors/nlp/fill_mask_preprocessor.py", line 55, in call output = self._tokenize_text(text_a, text_b, kwargs) File "/mnt/lustre02/jiangsu/aispeech/home/yz118/.conda/envs/modelscope/lib/python3.8/site-packages/modelscope/preprocessors/nlp/fill_mask_preprocessor.py", line 145, in _tokenize_text return self.nlp_tokenizer(sequence1, sequence2, kwargs) File "/mnt/lustre02/jiangsu/aispeech/home/yz118/.conda/envs/modelscope/lib/python3.8/site-packages/modelscope/preprocessors/nlp/transformers_tokenizer.py", line 107, in call return self.tokenizer(text, text_pair, tokenize_kwargs) File "/mnt/lustre02/jiangsu/aispeech/home/yz118/.conda/envs/modelscope/lib/python3.8/site-packages/transformers/tokenization_utils_base.py", line 2488, in call encodings = self._call_one(text=text, text_pair=text_pair, all_kwargs) File "/mnt/lustre02/jiangsu/aispeech/home/yz118/.conda/envs/modelscope/lib/python3.8/site-packages/transformers/tokenization_utils_base.py", line 2594, in _call_one return self.encode_plus( File "/mnt/lustre02/jiangsu/aispeech/home/yz118/.conda/envs/modelscope/lib/python3.8/site-packages/transformers/tokenization_utils_base.py", line 2667, in encode_plus return self._encode_plus( File "/mnt/lustre02/jiangsu/aispeech/home/yz118/.conda/envs/modelscope/lib/python3.8/site-packages/transformers/tokenization_utils_fast.py", line 502, in _encode_plus batched_output = self._batch_encode_plus( TypeError: _batch_encode_plus() got an unexpected keyword argument 'label2id'

PerfeZ commented 1 year ago

please use modelscope=1.1.0

pip install "modelscope[nlp]==1.1.0" -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html