Bonky Zhu
If someone is able to show me that what I think or do is not right, I will happily change, for I seek the truth, by which no one was ever truly harmed. It is the person who continues in his self-deception and ignorance who is harmed.


在平时训练模型等情况下,由于各种原因和考虑效率,我们需要保存当前的状态。 Python 中有个包刚好满足了我们对这种情形的需求,这就是 pickel ~

下面是一个通用的用法~ 下次使用的时候复制粘粘改一下就好了

import pickle

# 保存字典
with open('dictname.dict', "wb") as f:
  pickle.dump(dictname, f)

dictname = pickle.load(open('dictname.dict', 'rb'), encoding='bytes')


You may also like...