预测时候, 遇到编译protobuf失败, 配置文件需要显式指定参数的lr和momentum
Created by: linrongyi
用python wrapper执行预测的时候, 编译模型的conf出错.
在执行swig_paddle.GradientMachine.createFromConfigProto(conf.model_config)
出出错, 提示
I1104 19:07:32.537729 17412 Util.cpp:126] Call runInitFunctions done.
[libprotobuf ERROR google/protobuf/message_lite.cc:123] Can't parse message of type "paddle.ModelConfig" because it is missing required fields: parameters[14].learning_rate, parameters[14].m
omentum, parameters[16].learning_rate, parameters[16].momentum, parameters[17].learning_rate, parameters[17].momentum, parameters[18].learning_rate, parameters[18].momentum, parameters[19].l
earning_rate, parameters[19].momentum, parameters[20].learning_rate, parameters[20].momentum, parameters[21].learning_rate, parameters[21].momentum
我的Layer是
Layer(#
name = "query_vec",
type = "fc",
active_type='',
size = TERM_EMB_DIM,
bias = False,
inputs = Input("query",
initial_std = 1.0 / math.sqrt(TERM_TOK_NUM) / 3.0,
parameter_name = "_term_emb",
sparse_update = True,
sparse_remote_update = True)
)
如果加上 momentum, learning_rate 就好了, 也就是
Layer(#
name = "query_vec",
type = "fc",
active_type='',
size = TERM_EMB_DIM,
bias = False,
inputs = Input("query",
initial_std = 1.0 / math.sqrt(TERM_TOK_NUM) / 3.0,
parameter_name = "_term_emb",
sparse_update = True,
momentum = 0.0, learning_rate = 0.,
sparse_remote_update = True)
)