mirror of https://github.com/Jittor/Jittor
pickle use protocal 4
This commit is contained in:
parent
0a5a7f5ea2
commit
7d2eefc581
|
@ -8,7 +8,7 @@
|
|||
# This file is subject to the terms and conditions defined in
|
||||
# file 'LICENSE.txt', which is part of this source code package.
|
||||
# ***************************************************************
|
||||
__version__ = '1.2.2.12'
|
||||
__version__ = '1.2.2.13'
|
||||
from . import lock
|
||||
with lock.lock_scope():
|
||||
ori_int = int
|
||||
|
@ -40,7 +40,9 @@ import traceback
|
|||
|
||||
|
||||
def safepickle(obj, path):
|
||||
s = pickle.dumps(obj, pickle.HIGHEST_PROTOCOL)
|
||||
# Protocol version 4 was added in Python 3.4. It adds support for very large objects, pickling more kinds of objects, and some data format optimizations.
|
||||
# ref: <https://docs.python.org/3/library/pickle.html>
|
||||
s = pickle.dumps(obj, 4)
|
||||
checksum = hashlib.sha1(s).digest()
|
||||
s += bytes(checksum)
|
||||
s += b"HCAJSLHD"
|
||||
|
|
|
@ -185,7 +185,9 @@ def Resnet101(pretrained=False, **kwargs):
|
|||
y = model(x) # [10, 1000]
|
||||
|
||||
"""
|
||||
return _resnet(Bottleneck, [3, 4, 23, 3], **kwargs)
|
||||
model = _resnet(Bottleneck, [3, 4, 23, 3], **kwargs)
|
||||
if pretrained: model.load("jittorhub://resnet101.pkl")
|
||||
return model
|
||||
resnet101 = Resnet101
|
||||
|
||||
def Resnet152(pretrained=False, **kwargs):
|
||||
|
|
Loading…
Reference in New Issue