Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

报错问题 #10

Open
carly95 opened this issue Aug 30, 2018 · 1 comment
Open

报错问题 #10

carly95 opened this issue Aug 30, 2018 · 1 comment

Comments

@carly95
Copy link

carly95 commented Aug 30, 2018

您好,我用自己的文件测试时报错。文件只有两列 word tag 所以配置文件用的word.yml,数据原本是BIO标注,用您的工具转换成BIESO,非常感谢! torch 0.4.1

错误信息如下:
读取文件...
./data/output.txt: 619
./data/output.txt: 619
抽取预训练词向量...
特征word使用预训练词向量./data/resources/glove.6B.100d.txt:
C:\Users\ma\AppData\Local\Programs\Python\Python35\lib\site-packages\gensim\utils.py:1209: UserWarning: detected Windows; aliasing chunkize to chunkize_serial
warnings.warn("detected Windows; aliasing chunkize to chunkize_serial")
精确匹配: 2038 / 2715
模糊匹配: 356 / 2715
OOV: 321 / 2715
convert data to hdf5...
./data/output.txt.hdf5: 619
./data/output.txt.hdf5: 619
SLModel(
(word_feature_layer): WordFeature(
(feature_embedding_list): ModuleList(
(0): Embedding(2716, 100)
)
)
(char_feature_layer): CharFeature(
(char_embedding): Embedding(64, 30)
(char_encoders): ModuleList(
(0): Conv3d(1, 30, kernel_size=(1, 3, 30), stride=(1, 1, 1))
)
)
(dropout_feature): Dropout(p=0.5)
(rnn_layer): RNN(
(rnn): LSTM(130, 100, bidirectional=True)
)
(dropout_rnn): Dropout(p=0.5)
(crf_layer): CRF()
(hidden2tag): Linear(in_features=200, out_features=8, bias=True)
)
learning rate: 0.015
Epoch 1 / 1000: 557 / 557
Traceback (most recent call last):
File "G:/phd/8.8/SLTK-master/main.py", line 584, in
main()
File "G:/phd/8.8/SLTK-master/main.py", line 578, in main
train_model(configs)
File "G:/phd/8.8/SLTK-master/main.py", line 539, in train_model
model_trainer.fit()
File "G:\phd\8.8\SLTK-master\sltk\train\sequence_labeling_trainer.py", line 88, in fit
logits = self.model(**feed_tensor_dict)
File "C:\Users\ma\AppData\Local\Programs\Python\Python35\lib\site-packages\torch\nn\modules\module.py", line 477, in call
result = self.forward(*input, **kwargs)
File "G:\phd\8.8\SLTK-master\sltk\nn\modules\sequence_labeling_model.py", line 130, in forward
word_feature = torch.cat([word_feature, char_feature], 2)
RuntimeError: invalid argument 0: Tensors must have same number of dimensions: got 3 and 2 at c:\new-builder_2\win-wheel\pytorch\aten\src\th\generic/THTensorMath.cpp:3607

不是很明白,谢谢您的指点。

@carly95
Copy link
Author

carly95 commented Sep 5, 2018

您好,问题虽然没解决,但是在mac上没有问题,正常运行。非常感谢共享代码。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant