慎独_ 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) )