keras实现权重以及history的保存和加载

权重及history的保存:

model.save_weights('vi_128_lrdefault.hdf5')

import pickle
with open('model_vi_bs_128_lrdefault_hist.pickle', 'wb') as file_pi:
	pickle.dump(history.history, file_pi)

权重及hstory的读入

model.load_weights("vi_128_lrdefault.hdf5")

import pickle
with open('model_vi_bs_128_lrdefault_hist.pickle', 'rb') as f:
    history = pickle.load(f)

你可能感兴趣的:(python学习)