Open dengyulian2024 opened 1 year ago
D:\Anaconda\Anaconda\envs\pytorch\python.exe D:/python/BERT-BILSTM-CRF-main/BERT-BILSTM-CRF-main/main.py ['O', 'B-故障设备', 'I-故障设备', 'B-故障原因', 'I-故障原因'] {'O': 0, 'B-故障设备': 1, 'I-故障设备': 2, 'B-故障原因': 3, 'I-故障原因': 4} Some weights of the model checkpoint at ./model_hub/chinese-bert-wwm-ext/ were not used when initializing BertModel: ['cls.seq_relationship.bias', 'cls.predictions.transform.LayerNorm.bias', 'cls.predictions.transform.LayerNorm.weight', 'cls.predictions.decoder.weight', 'cls.predictions.transform.dense.weight', 'cls.seq_relationship.weight', 'cls.predictions.bias', 'cls.predictions.transform.dense.bias']
- This IS expected if you are initializing BertModel from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPreTraining model).
- This IS NOT expected if you are initializing BertModel from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model). D:\Anaconda\Anaconda\envs\pytorch\lib\site-packages\torch\nn\modules\rnn.py:62: UserWarning: dropout option adds dropout after all but last recurrent layer, so non-zero dropout expects num_layers greater than 1, but got dropout=0.1 and num_layers=1 warnings.warn("dropout option adds dropout after all but last "
大佬可以帮忙看一下不
这些应该不影响运行吧。
不好意思发错了,是报这样的错误:
Traceback (most recent call last):
File "D:/python/BERT-BILSTM-CRF-main/BERT-BILSTM-CRF-main/main.py", line 190, in
不好意思发错了,是报这样的错误: Traceback (most recent call last): File "D:/python/BERT-BILSTM-CRF-main/BERT-BILSTM-CRF-main/main.py", line 190, in main(data_name) File "D:/python/BERT-BILSTM-CRF-main/BERT-BILSTM-CRF-main/main.py", line 182, in main train.train() File "D:/python/BERT-BILSTM-CRF-main/BERT-BILSTM-CRF-main/main.py", line 53, in train output = self.model(input_ids, attention_mask, labels) File "D:\Anaconda\Anaconda\envs\pytorch\lib\site-packages\torch\nn\modules\module.py", line 1130, in _call_impl return forward_call(*input, *kwargs) File "D:\python\BERT-BILSTM-CRF-main\BERT-BILSTM-CRF-main\model.py", line 37, in forward loss = -self.crf(seq_out, labels, mask=attention_mask.bool(), reduction='mean') File "D:\Anaconda\Anaconda\envs\pytorch\lib\site-packages\torch\nn\modules\module.py", line 1130, in _call_impl return forward_call(input, **kwargs) File "D:\Anaconda\Anaconda\envs\pytorch\lib\site-packages\torchcrfinit.py", line 102, in forward numerator = self._compute_score(emissions, tags, mask) File "D:\Anaconda\Anaconda\envs\pytorch\lib\site-packages\torchcrfinit.py", line 186, in _compute_score score = self.start_transitions[tags[0]] IndexError: tensors used as indices must be long, byte or bool tensors
pip install pytorch-crf==0.7.2
已安装了相应版本的库报的这个错,谢谢佬的解答。
已安装了相应版本的库报的这个错,谢谢佬的解答。
pytorch版本是多少。
谢谢您,已成功运行。
谢谢您,已成功运行。同学,能请教下怎么解决的嘛,我也是出现了这个问题
谢谢您,已成功运行。同学,能请教下怎么解决的嘛,我也是出现了这个问题
我是把labels变成long型就可以了
谢谢您,已成功运行。同学,能请教下怎么解决的嘛,我也是出现了这个问题
我是把labels变成long型就可以了
跑通了,感谢
已安装了相应版本的库报的这个错,谢谢佬的解答。
pytorch版本是多少。
请问需要什么版本的pytorch呢?
谢谢您,已成功运行。同学,能请教下怎么解决的嘛,我也是出现了这个问题
我是把labels变成long型就可以了
请问具体是怎么修改呀 我是小白 虚心求教 判您解答
谢谢您,已成功运行。同学,能请教下怎么解决的嘛,我也是出现了这个问题
我是把labels变成long型就可以了
跑通了,感谢
请问下具体是怎样修改的呀
谢谢您,已成功运行。同学,能请教下怎么解决的嘛,我也是出现了这个问题
我是把labels变成long型就可以了
跑通了,感谢
请问下具体是怎样修改的呀
应该是data_loader.py里面的labels = torch.tensor(np.array(labels))变成Long类型,具体怎么改可以百度下。
我看了一下我的代码,是这样改的,main和config文件140行,改完后是这样的with open(os.path.join(args.output_dir, "ner_args.json"), "w", encoding='utf-8') as fp: json.dump(vars(args), fp, ensure_ascii=False, indent=2),加了一个encoding='utf-8'
我看了一下我的代码,是这样改的,main和config文件140行,改完后是这样的with open(os.path.join(args.output_dir, "ner_args.json"), "w", encoding='utf-8') as fp: json.dump(vars(args), fp, ensure_ascii=False, indent=2),加了一个encoding='utf-8' 谢谢!!!
谢谢您,已成功运行。同学,能请教下怎么解决的嘛,我也是出现了这个问题
我是把labels变成long型就可以了
跑通了,感谢
请问下具体是怎样修改的呀
应该是data_loader.py里面的labels = torch.tensor(np.array(labels))变成Long类型,具体怎么改可以百度下。
谢谢大佬!!!
D:\Anaconda\Anaconda\envs\pytorch\python.exe D:/python/BERT-BILSTM-CRF-main/BERT-BILSTM-CRF-main/main.py ['O', 'B-故障设备', 'I-故障设备', 'B-故障原因', 'I-故障原因'] {'O': 0, 'B-故障设备': 1, 'I-故障设备': 2, 'B-故障原因': 3, 'I-故障原因': 4} Some weights of the model checkpoint at ./model_hub/chinese-bert-wwm-ext/ were not used when initializing BertModel: ['cls.seq_relationship.bias', 'cls.predictions.transform.LayerNorm.bias', 'cls.predictions.transform.LayerNorm.weight', 'cls.predictions.decoder.weight', 'cls.predictions.transform.dense.weight', 'cls.seq_relationship.weight', 'cls.predictions.bias', 'cls.predictions.transform.dense.bias']
大佬可以帮忙看一下不