def load_compatibility(filename):
"""Reconstruct a Python object from a file persisted with joblib.dump.
This function ensure the compatibility of joblib old persistence format (<= 0.9.3)"""
file_handle = open(filename, 'rb')
unpickler = ZipNumpyUnpickler(filename, file_handle=file_handle)
try:
obj = unpickler.load()
finally:
if hasattr(unpickler, 'file_handle'):
unpickler.file_handle.close()
return obj
评论列表
文章目录