core dump when making inference
Created by: MsFive5
Got this error when making an inference using paddle
WARNING: Logging before InitGoogleLogging() is written to STDERR
F0814 16:02:02.693090 32322 ClassRegistrar.h:65] Check failed: mapGet(type, creatorMap_, &creator) Unknown class type: data
*** Check failure stack trace: ***
Aborted (core dumped)
Here is how I write reader and inference
def reader(query_seg, word_dict):
UNK_ID = word_dict["<UNK>"]
for line in f:
word_ids = [
word_dict.get(w, UNK_ID)
for w in query_seg.split()
]
yield word_ids
def infer(query_seg, model_path, label_dict_path, word_dict_path):
word_dict = load_dict(word_dict_path)
label_reverse_dict = load_reverse_dict(label_dict_path)
dict_dim = len(word_dict)
class_num = len(label_reverse_dict)
topology = stacked_lstm_net
prob_layer = topology(dict_dim, class_num, is_infer=True)
parameters = paddle.parameters.Parameters.from_tar(
gzip.open(model_path, "r"))
inferer = paddle.inference.Inference(
output_layer=prob_layer, parameters=parameters)
test_vector = reader(query_seg, word_dict)
probs = inferer.infer(input=test_vector, field=["value"])
label = label_reverse_dict[prob.argmax()]
return label
Found out that core dumped happens here
inferer = paddle.inference.Inference(
output_layer=prob_layer, parameters=parameters)
I write this inferer the same as the demo. Please help!