深度学习模型保存与加载

import joblib
from keras.models import load_model
# 模型保存
model.fit(x_train_padded_seqs, one_hot_labels, batch_size=800, epochs=10)
model.save('./model/textcnn_model.h5')
joblib.dump(tokenizer, './model/tockenizer.pkl')

# 模型加载
model = load_model('./model/textcnn_model.h5')
tokenizer = joblib.load('./model/tockenizer.pkl')

# 模型重新训练,重新 fit
model.fit(x_train_padded_seqs, one_hot_labels, batch_size=800, epochs=10)

你可能感兴趣的:(算法)