报错内容如下:
_pickle.UnpicklingError: A load persistent id instruction was encountered,
but no persistent_load function was specified.
解决办法有很多种,这得看Pkl储存的内容使用的什么方式
import numpy as np
meta_file = 'path/***.pkl'
data = np.load(meta_file, allow_pickle=True)
print(data)
import pickle
file=open("path/***.pkl","rb")
data=pickle.load(file)
print(data)
这种办法报此种错误的情况就比较多了
import torch
f = open(file,'rb')
data = torch.load(f,map_location='cpu')#可使用cpu或gpu
print(data)