程序编译错误
hi,我这两天在看这份代码,今天打算运行一下,发现有编译错误,我运行的是example/wordseg里面的例子,刚开始make的时候提示wordseg.cpp中的SeqLossLayer找不到,我看了下源码,好像layers目录下面没有定义这个类,不知道是不是这个类废弃了但是代码没更新? 我把SeqLossLayer换成CrossEntropyLossLayer后继续make,遇到如下错误: g++ -pg -w -DDEBUGALL -I. -I../../matrix -I../../layers -I../../utils -I../../net -o test_mnist ./wordseg.o Undefined symbols for architecture x86_64: "sub_dl::GruCell::GruCell(int, int)", referenced from: sub_dl::BiCellWrapper<sub_dl::GruCell>::BiCellWrapper(int, int, int) in wordseg.o "sub_dl::RnnCell::RnnCell(int, int)", referenced from: sub_dl::BiCellWrapper<sub_dl::RnnCell>::BiCellWrapper(int, int, int) in wordseg.o "sub_dl::LstmCell::LstmCell(int, int, bool)", referenced from: sub_dl::BiCellWrapper<sub_dl::LstmCell>::BiCellWrapper(int, int, bool, bool, int) in wordseg.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [build] Error 1
完整的日志如下: g++ -c -v -pg -w -DDEBUGALL -I. -I../../matrix -I../../layers -I../../utils -I../../net ./wordseg.cpp Apple LLVM version 8.0.0 (clang-800.0.42.1) Target: x86_64-apple-darwin15.5.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.12.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name wordseg.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu penryn -target-linker-version 274.2 -v -dwarf-column-info -debugger-tuning=lldb -coverage-file /Users/songwei/machineLearning/SUDL/example/wordseg/wordseg.cpp -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.0.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -D DEBUGALL -I . -I ../../matrix -I ../../layers -I ../../utils -I ../../net -stdlib=libc++ -w -fdeprecated-macro -fdebug-compilation-dir /Users/songwei/machineLearning/SUDL/example/wordseg -ferror-limit 19 -fmessage-length 203 -pg -stack-protector 1 -fblocks -fobjc-runtime=macosx-10.12.0 -fencode-extended-block-signature -fcxx-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -o wordseg.o -x c++ ./wordseg.cpp clang -cc1 version 8.0.0 (clang-800.0.42.1) default target x86_64-apple-darwin15.5.0 ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/c++/v1" ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/local/include" ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/Library/Frameworks" #include "..." search starts here: #include <...> search starts here: . ../../matrix ../../layers ../../utils ../../net /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.0.0/include /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks (framework directory) End of search list. g++ -pg -w -DDEBUGALL -I. -I../../matrix -I../../layers -I../../utils -I../../net -o test_mnist ./wordseg.o Undefined symbols for architecture x86_64: "sub_dl::GruCell::GruCell(int, int)", referenced from: sub_dl::BiCellWrapper<sub_dl::GruCell>::BiCellWrapper(int, int, int) in wordseg.o "sub_dl::RnnCell::RnnCell(int, int)", referenced from: sub_dl::BiCellWrapper<sub_dl::RnnCell>::BiCellWrapper(int, int, int) in wordseg.o "sub_dl::LstmCell::LstmCell(int, int, bool)", referenced from: sub_dl::BiCellWrapper<sub_dl::LstmCell>::BiCellWrapper(int, int, bool, bool, int) in wordseg.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [build] Error 1
对c++不太熟,在网上找到的方法都没解决。 还请帮忙看下是哪里的问题。 多谢!
你好,wordseg依赖了layers里的.o,需要在layers里先make哈~ 另外CrossEntropyLoss是针对非序列样本的,RNN的话需要用SeqCrossEntropyLossLayer哈~ 样例数据在example下的readme.md里给出了,可以下载试试~
多谢,按照你的提示make成功了,test_mnist也运行起来了,不过有个建议哈,因为这个是word_seg,所以生成的可执行文件是不是应该改个名?另外,有数据集相关的网页介绍吗,我看了下数据文件,不太明白样本的含义,多谢了啊
382 7 84 385 625 915 191 108;2 3 0 2 0 2 0 2 ;前面的是word_id,后面的 是标注id(分词用的是bems形式). 我这个语料是处理成了每8个为一个序列~ 生成的文件名可以改makefile哈. 目前运行速度略慢,但是效果还可以,你可以看下收敛情况哈~
是说这个数据集并不是一个公开的数据集是吗,查了一下bems,样本含义还是可以理解的。晚上运行了一下,早上起来发现还没有跑完,大概跑了九个小时吧,这个时间正常吗
嗯,数据集是来自人民日报的语料,运行时间是正常的~ 你可以把最大epoch调小点。之后会加入模型快照功能:一定epoch之后自动保存模型~ 你是在mac上跑的? 另外网络结构你也可以试着调整下,现在代码里是为了测试搞的三层双向RNN(bigru+bilstm+birnn)。
恩,我在mac上跑的,双向rnn还没看,不太懂,我再跑一遍看看。 有一个问题哈,数据集的文件名是train_text.seg.10w,但是好像才有一万条数据,是不是命名有问题哈。还有就是每个epoch样本的顺序都是确定的,我记得打乱顺序最好,请问这个有计划吗
是 ,样本shuffle效果会更好点,我之前是有的,后来整理的时候又删掉了.
在 2017年8月7日 上午11:14,sw [email protected]写道:
恩,我在mac上跑的,双向rnn还没看,不太懂,我再跑一遍看看。 有一个问题哈,数据集的文件名是train_text.seg. 10w,但是好像才有一万条数据,是不是命名有问题哈。还有就是每个epoch样本的顺序都是确定的,我记得打乱顺序最好,请问这个有计划吗
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kymo/SUDL/issues/2#issuecomment-320558833, or mute the thread https://github.com/notifications/unsubscribe-auth/ACYMsRagKfPwasR24DJ7Ebu4GySPRnKPks5sVoD6gaJpZM4Ousjp .