Comments (14)
错误如下:
【train】 epoch:0 85/1434 loss:7.5998
【train】 epoch:0 86/1434 loss:12.1990
【train】 epoch:0 87/1434 loss:18.4305
【train】 epoch:0 88/1434 loss:13.8174
【train】 epoch:0 89/1434 loss:16.8664
Traceback (most recent call last):
File "C:\Users\秋明山老王司机\Desktop\pytorch_bert_bilstm_crf_ner-main\main.py", line 266, in
bertForNer.train()
File "C:\Users\秋明山老王司机\Desktop\pytorch_bert_bilstm_crf_ner-main\main.py", line 64, in train
dev_loss, precision, recall, f1_score = self.dev()
File "C:\Users\秋明山老王司机\Desktop\pytorch_bert_bilstm_crf_ner-main\main.py", line 83, in dev
batch_output = np.array(batch_output)
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (8,) + inhomogeneous part.
from pytorch_bert_bilstm_crf_ner.
紧急求助,谢谢大佬
from pytorch_bert_bilstm_crf_ner.
紧急求助,谢谢大佬
我直接拷贝项目运行的,没啥问题呀。
from pytorch_bert_bilstm_crf_ner.
紧急求助,谢谢大佬
我直接拷贝项目运行的,没啥问题呀。
from pytorch_bert_bilstm_crf_ner.
紧急求助,谢谢大佬
我直接拷贝项目运行的,没啥问题呀。
我使用的是您简介readme中最下面的cner参数,以形参的形式运行,然后会报错,我带入我自己的数据也有一样的问题,都是在89轮时报错,错误如下 setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (8,) + inhomogeneous part.各种调试孩子已经傻了,大佬帮忙看看吧
from pytorch_bert_bilstm_crf_ner.
抱歉晚上打扰您,重新下载您的源码,使用您的数据集和参数,还是存在相同问题,通过debug,感觉问题还是处在dev部分
if self.args.use_crf == 'True':
batch_output = dev_logits
batch_output = np.array(batch_output)
else:
batch_output = dev_logits.detach().cpu().numpy()
batch_output = np.argmax(batch_output, axis=2)
if len(batch_output_all) == 0:
batch_output_all = batch_output
else:
batch_output_all = np.append(batch_output_all, batch_output, axis=0)
不知道您运行的部分这部分有没有问题。
from pytorch_bert_bilstm_crf_ner.
setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (8,)
pytorch-crf版本是0.7.2么,再打印一下dev里面的batch_output,看看是什么。
from pytorch_bert_bilstm_crf_ner.
输出如下
from pytorch_bert_bilstm_crf_ner.
大佬,您能看看batch out有什么问题吗,或者您受累发一份您跑的源码看看吗,我是刚刚入门的纯小白,最近陷入瓶颈了,万分感谢!
from pytorch_bert_bilstm_crf_ner.
大佬,您能看看batch out有什么问题吗,或者您受累发一份您跑的源码看看吗,我是刚刚入门的纯小白,最近陷入瓶颈了,万分感谢!
你这里面的每一条数据的长度都不一样,肯定是有问题的。运行的时候在命令行运行,pycharm里面的话要带参数运行。我直接拷贝项目后运行指令就可以正常运行的。
from pytorch_bert_bilstm_crf_ner.
大佬,严格安装您的环境要求重试了一遍,跑通了,之前使用的是高版本pytorch和transformers,出现了这个问题,应该就是环境不兼容的问题,感谢大佬!
from pytorch_bert_bilstm_crf_ner.
前辈我在训练环节没有问题了,但是在predict预测部分,我将raw_txt修改为我的数据集,报错Expected tensor for argument #1 'indices' to have scalar type Long; but got torch.cuda.IntTensor instead (while checking arguments for embedding)。debug好像是Tensor数据类型的问题,但对于如何修改没有思路,请问您有什么好的见解吗?
from pytorch_bert_bilstm_crf_ner.
前辈我在训练环节没有问题了,但是在predict预测部分,我将raw_txt修改为我的数据集,报错Expected tensor for argument #1 'indices' to have scalar type Long; but got torch.cuda.IntTensor instead (while checking arguments for embedding)。debug好像是Tensor数据类型的问题,但对于如何修改没有思路,请问您有什么好的见解吗?
predict里面改一下:
attention_masks = torch.from_numpy(np.array(encode_dict['attention_mask'])).long().unsqueeze(0).to(device)
from pytorch_bert_bilstm_crf_ner.
大佬,严格安装您的环境要求重试了一遍,跑通了,之前使用的是高版本pytorch和transformers,出现了这个问题,应该就是环境不兼容的问题,感谢大佬!
您好,请问您都调整了什么版本可以说一下吗
from pytorch_bert_bilstm_crf_ner.
Related Issues (20)
- 大哥你好。我想问一下File "/home/vrlab/wwt/pytorch_bert_bilstm_crf_ner-main/bert_base_model.py", line 11, in __init__ assert os.path.exists(bert_dir) and os.path.exists(config_path), \ AssertionError: pretrained bert file does not exist是为啥 HOT 5
- 运行问题 HOT 6
- 您好 HOT 9
- 大佬您好,可以帮忙看看这个bug吗 HOT 13
- 换成BIO类型的数据应该怎么做? HOT 7
- 导出onnx问题 Error(s) in loading state_dict for BertNerModel: Unexpected key(s) in state_dict: "linear.weight", "linear.bias". HOT 2
- 对BERT模型进行继续预训练对提高性能是否有帮助? HOT 4
- 训练自己的数据,内存占用一直增长,直到吃满内存 HOT 2
- 请问一小pkl文件怎么处理得到? HOT 1
- > 我加你qq吧,你说下。 HOT 2
- 关于使用CRF文件将BERT+CRF模型转换为ONNX的问题 HOT 6
- 网页问题 HOT 1
- 英文实体识别的问题 HOT 1
- RuntimeError: expected predicate to be bool, got torch.uint8 HOT 1
- Albert问题 HOT 2
- AssertionError: pretrained bert file does not exist HOT 1
- 更换数据集后报CUDA error: device-side assert triggered HOT 1
- 求一份分词数据集 HOT 1
- 我的checkpoints文件夹是空的 HOT 1
- 这个命名实体识别的算法思路是什么? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pytorch_bert_bilstm_crf_ner.