加载训练参数问题?
Created by: foxgaga
存储参数
with open('params_pass_%d.tar' % event.pass_id, 'w') as f:
parameters.to_tar(f)
读取参数
with open('params_pass_4.tar', 'r') as f:
parameters = paddle.parameters.Parameters.from_tar(f)
错误提示
WARNING: Logging before InitGoogleLogging() is written to STDERR
F0720 03:49:04.188344 464 ClassRegistrar.h:65] Check failed: mapGet(type, creatorMap_, &creator) Unknown class type: data
*** Check failure stack trace: ***
Aborted
import reader
import gzip
import paddle.v2 as paddle
import train
import copy
if __name__ == '__main__':
reader.__initialize_meta_info__()
# with open('params_pass_4.tar.gz', 'r') as f:
# parameters = paddle.parameters.Parameters.from_tar(f)
with open('params_pass_4.tar', 'r') as f:
parameters = paddle.parameters.Parameters.from_tar(f)
video_feature_hidden = train.get_video_combined_features()
inference = paddle.layer.fc(input=video_feature_hidden, size=1, act=paddle.activation.Sigmoid())
movie_id = 'V_00jXmraD'
movie = reader.video_info()[movie_id]
feature = movie.value()
infer_dict = copy.copy(train.feeding)
del infer_dict['ctr']
prediction = paddle.infer(
output_layer=inference,
parameters=parameters,
input=[feature],
feeding=infer_dict)
print prediction