Python 预测时forwardTest 出 Core
Created by: 20092136
以下是 python 预测的一组代码,运行后core dumped
import sys
from py_paddle import swig_paddle, DataProviderConverter
from paddle.trainer.PyDataProvider2 import *
from paddle.trainer.config_parser import *
def load_test_data():
test_data = []
with open('./predictset.txt', 'r') as f:
for line in f:
arr = line.strip().split('\t')
label = arr[0]
seq = arr[1].split()
feat = arr[2].split()
test_data.append([map(int, seq), map(int, feat)])
print test_data
return test_data
return test_data
def main():
swig_paddle.initPaddle("--use_gpu=0")
conf = parse_config("./pass-00010/trainer_config.py", "")
network = swig_paddle.GradientMachine.createFromConfigProto(conf.model_config)
assert isinstance(network, swig_paddle.GradientMachine) # For code hint.
network.loadParameters("./pass-00010/")
converter = DataProviderConverter([integer_value_sequence(319085),
sparse_non_value_slot(6121)])
TEST_DATA = load_test_data()
inArg = converter.convert(TEST_DATA)
print network.forwardTest(inArg)
if __name__ == '__main__':
main()
其中TEST_DATA 的格式和输出的错误信息如打印信息所示: I1109 20:44:37.200795 18507 Util.cpp:155] commandline: --use_gpu=0 I1109 20:44:37.200917 18507 Util.cpp:130] Calling runInitFunctions I1109 20:44:37.201267 18507 Util.cpp:143] Call runInitFunctions done. [INFO 2016-11-09 20:44:37,229 networks.py:1282] The input order is [seq, feat] [INFO 2016-11-09 20:44:37,229 networks.py:1289] The output order is [fc_ly_4] I1109 20:44:37.628499 18507 GradientMachine.cpp:123] Loading parameters from ./pass-00010/ [[[290, 2201, 554, 37, 142, 237, 78, 60, 171, 1483, 1615, 2201, 229, 237, 50, 9, 18, 0, 2238, 204, 7, 2785, 15, 131, 2, 53, 79, 173, 52, 30, 345, 752, 110, 81, 690, 483, 2432, 2201, 19, 483, 1732, 125, 1483, 483, 55, 3909, 125, 1483, 86, 181, 695, 415, 14, 3, 22476, 370, 173, 242, 3], [494, 1333, 737, 3421, 1030, 6105]]] F1109 20:44:37.722673 18507 SparseRowMatrix.h:63] Check failed: globalIndices_[row] != kUnusedId_ (4294967295 vs. 4294967295)
* Check failure stack trace: *
@ 0x7f00bd470768 google::LogMessage::Fail() @ 0x7f00bd4706c0 google::LogMessage::SendToLog() @ 0x7f00bd470155 google::LogMessage::Flush() @ 0x7f00bd472f16 google::LogMessageFatal::~LogMessageFatal() @ 0x7f00bcd22cac paddle::CpuMatrix::mul<>() @ 0x7f00bcd15c77 paddle::CpuMatrix::mul() @ 0x7f00bcbac5d1 paddle::FullyConnectedLayer::forward() @ 0x7f00bcc0a1a4 paddle::NeuralNetwork::forward() @ 0x7f00bcac5eb6 _wrap_GradientMachine_forward @ 0x4b4cb9 PyEval_EvalFrameEx @ 0x4b6b28 PyEval_EvalCodeEx @ 0x4b5d10 PyEval_EvalFrameEx @ 0x4b6b28 PyEval_EvalCodeEx @ 0x4b5d10 PyEval_EvalFrameEx @ 0x4b5fb8 PyEval_EvalFrameEx @ 0x4b6b28 PyEval_EvalCodeEx @ 0x4b6c52 PyEval_EvalCode @ 0x4e1c7d PyRun_FileExFlags @ 0x4e3501 PyRun_SimpleFileExFlags @ 0x4159dd Py_Main @ 0x7f00c0f34bd5 __libc_start_main @ 0x414b71 (unknown) run.sh: line 5: 18507 Aborted (core dumped) ./output/python27-gcc482/bin/python predict.py请问可能会是什么原因? 相关问题 #368 (closed)