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

运行build.sh报错 #2

Open
GaoJianchao opened this issue Jul 2, 2019 · 10 comments
Open

运行build.sh报错 #2

GaoJianchao opened this issue Jul 2, 2019 · 10 comments

Comments

@GaoJianchao
Copy link

./kcws/cc/seg_backend_api.cc:14:23: fatal error: base/base.h: No such file or directory
#include "base/base.h"
^
compilation terminated.
./kcws/cc/pos_tagger.cc:10:23: fatal error: base/base.h: No such file or directory
#include "base/base.h"
^
compilation terminated.
In file included from ./kcws/cc/sentence_breaker.cc:10:0:
./kcws/cc/sentence_breaker.h:16:37: fatal error: utils/basic_string_util.h: No such file or directory
#include "utils/basic_string_util.h"

我知道是路径原因,但是怎么改呢,build.sh就在项目根目录啊

@forever1dream
Copy link
Owner

forever1dream commented Jul 2, 2019

@GaoJianchao 在build.sh 加一行 -I./ \ 试一下 , 我重新提交了一下,可以重新拉取试一下

@GaoJianchao
Copy link
Author

please input query:我们是中国人
2019-07-03 09:25:28.294904: E tensorflow/core/common_runtime/executor.cc:645] Executor failed to create kernel. Invalid argument: NodeDef mentions attr 'batch_dims' not in Op<name=GatherV2; signature=params:Tparams, indices:Tindices, axis:Taxis -> output:Tparams; attr=Tparams:type; attr=Tindices:type,allowed=[DT_INT32, DT_INT64]; attr=Taxis:type,allowed=[DT_INT32, DT_INT64]>; NodeDef: embedding_lookup_1 = GatherV2[Taxis=DT_INT32, Tindices=DT_INT32, Tparams=DT_FLOAT, _class=["loc:@words"], _output_shapes=[[?,80,50]], batch_dims=0, _device="/job:localhost/replica:0/task:0/device:CPU:0"](words, _arg_input_placeholder_0_0, embedding_lookup_1/axis). (Check whether your GraphDef-interpreting binary is up to date with your GraphDef-generating binary.).
[[Node: embedding_lookup_1 = GatherV2[Taxis=DT_INT32, Tindices=DT_INT32, Tparams=DT_FLOAT, _class=["loc:@words"], _output_shapes=[[?,80,50]], batch_dims=0, _device="/job:localhost/replica:0/task:0/device:CPU:0"](words, _arg_input_placeholder_0_0, embedding_lookup_1/axis)]]
E0703 09:25:28.295219 46256 tfmodel.cc:88] Error during inference: Invalid argument: NodeDef mentions attr 'batch_dims' not in Op<name=GatherV2; signature=params:Tparams, indices:Tindices, axis:Taxis -> output:Tparams; attr=Tparams:type; attr=Tindices:type,allowed=[DT_INT32, DT_INT64]; attr=Taxis:type,allowed=[DT_INT32, DT_INT64]>; NodeDef: embedding_lookup_1 = GatherV2[Taxis=DT_INT32, Tindices=DT_INT32, Tparams=DT_FLOAT, _class=["loc:@words"], _output_shapes=[[?,80,50]], batch_dims=0, _device="/job:localhost/replica:0/task:0/device:CPU:0"](words, _arg_input_placeholder_0_0, embedding_lookup_1/axis). (Check whether your GraphDef-interpreting binary is up to date with your GraphDef-generating binary.).
[[Node: embedding_lookup_1 = GatherV2[Taxis=DT_INT32, Tindices=DT_INT32, Tparams=DT_FLOAT, _class=["loc:@words"], _output_shapes=[[?,80,50]], batch_dims=0, _device="/job:localhost/replica:0/task:0/device:CPU:0"](words, _arg_input_placeholder_0_0, embedding_lookup_1/axis)]]
2019-07-03 09:25:28.295281: E ./kcws/cc/tf_seg_model.cc:320] Error during inference:
谢谢你的回答,但我在执行预测的时候输入句子后报错,是因为我训练和测试时候用的tensorflow版本不一样的原因吗?训练用的1.14,测试用的1.6

@forever1dream
Copy link
Owner

@GaoJianchao 项目自带的模型能跑吗,你这个我就不是很清楚了,需要你自己查一下

@GaoJianchao
Copy link
Author

项目自带的可以跑

@forever1dream
Copy link
Owner

@GaoJianchao 我看你的好像是输入参数 好像有点问题,你可以查一下看看,参考src/kcws/tf_seg_model.cc
的TfSegModel::LoadModel函数,修改一下inputTensors 参数 。

@GaoJianchao
Copy link
Author

但是我没有改动代码啊,为什么输入参数有问题?

@GaoJianchao
Copy link
Author

我觉得是因为训练时候tensorflow用的版本太高了

@forever1dream
Copy link
Owner

你的模型就是用用原文(https://github.com/koth/kcws.git)的训练的吗? 那你查一下,学习下。 @GaoJianchao

@forever1dream
Copy link
Owner

我本地的版本也是1.6以上的但是解码是可以的啊

@GaoJianchao
Copy link
Author

我是用的原文训练的一点代码也没改,训练用的tensorflow-gpu-1.14.0,测试用的你的代码编译的不过编译的tensorflow是没有gpu的1.6版本

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

2 participants