RuntimeError: [enforce fail at inline_container.cc:222] . file not found: archive/constants.pkl

pytorch版本不同,对于加载压缩过的zip的权重方式也不同,
老版本需要

torch.jit.load()

否则会出

RuntimeError: ../detection/runs/train/exp2/weights/best_meter.pt is a zip archive (did you mean to use torch.jit.load()?)

新版本需要

torch.load()

如果用jit.load会出

File "/data/anaconda/envs/py37/lib/python3.7/site-packages/torch/jit/_serialization.py", line 161, in load
    cpp_module = torch._C.import_ir_module(cu, f, map_location, _extra_files)
RuntimeError: [enforce fail at inline_container.cc:222] . file not found: archive/constants.pkl

你可能感兴趣的:(PyTorch,深度学习)