提交 2bebe80e 编写于 作者: M Megvii Engine Team

fix(imperative): fix the default pickle protocol version of save

GitOrigin-RevId: fab2dc736960858ad7c25cc2c7d7ef84f6328fd7
上级 f02cd2d2
......@@ -13,14 +13,14 @@ from .tensor import Tensor
from .utils.max_recursion_limit import max_recursion_limit
def save(obj, f, pickle_module=pickle, pickle_protocol=pickle.HIGHEST_PROTOCOL):
def save(obj, f, pickle_module=pickle, pickle_protocol=pickle.DEFAULT_PROTOCOL):
r"""Save an object to disk file.
Args:
obj: object to save. Only ``module`` or ``state_dict`` are allowed.
f: a string of file name or a text file object to which ``obj`` is saved to.
pickle_module: Default: ``pickle``.
pickle_protocol: Default: ``pickle.HIGHEST_PROTOCOL``.
pickle_protocol: Default: ``pickle.DEFAULT_PROTOCOL``.
"""
if isinstance(f, str):
with open(f, "wb") as fout:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册