慎独_ 2019-06-15 11:41:11

- 使用pytorch框架。 - 先保存为.pkl文件,然后加载模型预测。 - 同批数据,模型预测耗时相差近一倍

bilstm_model = load_model(BiLSTM_MODEL_PATH)
#bilstm_model.model.bilstm.flatten_parameters()  # remove warning
start_time = time.time()
lstm_pred, target_tag_list = bilstm_model.test(test_word_lists, test_tag_lists, bilstm_word2id, bilstm_tag2id)

end_time = time.time()
print ("Cost time: ",(end_time - start_time) )

评论

ホーム - Wiki
Copyright © 2011-2024 iteam. Current version is 2.137.1. UTC+08:00, 2024-11-15 06:33
浙ICP备14020137号-1 $お客様$