Describe the bug
无法加载预训练权重文件 NLS_loc_modeltes。尝试了多种方法均失败,包括:
torch.load() 报错:A load persistent id instruction was encountered
torch.load(weights_only=False) 报错:'Tensor' object has no attribute '_untyped_storage'
pytorch_lightning.utilities.cloud_io.load() 报错:模块路径不存在
To Reproduce
- 按照官网指引下载
NLS_loc_modeltes 并放置在 ./Recommendation_system/ 目录
- 运行以下代码:
import torch
checkpoint = torch.load("./Recommendation_system/NLS_loc_modeltes/data.pkl", map_location="cpu")
报错信息如下:
_pickle.UnpicklingError: A load persistent id instruction was encountered,
but no persistent_load function was specified.
3、尝试 weights_only=False :
checkpoint = torch.load("./Recommendation_system/NLS_loc_modeltes/data.pkl", map_location="cpu", weights_only=False)
报错信息如下:
AttributeError: 'Tensor' object has no attribute '_untyped_storage'
4、尝试 PyTorch Lightning 加载:
from pytorch_lightning.utilities.cloud_io import load
checkpoint = load("./Recommendation_system/NLS_loc_modeltes", map_location="cpu")
报错如下:
ModuleNotFoundError: No module named 'pytorch_lightning.utilities.cloud_io'
5、Expected behavior
期望能够成功加载预训练权重,并正常使用 A2KA 模型进行 NLS 预测。
6、Environment
OS: CentOS Linux (64-bit)
Python: 3.8 / 3.10
PyTorch versions tested: 1.9.0, 1.12.0, 2.0.0, 2.12.0 (CPU only)
PyTorch Lightning versions tested: 1.5.0, 1.6.0, 2.0.0
Hardware: CPU only (no GPU)
7、Additional context
权重文件已正确下载并解压,目录结构如下:
Recommendation_system/NLS_loc_modeltes/
├── data/ (7303个分片文件)
├── data.pkl
└── version
version 文件内容为 3(Lightning 分片检查点版本3)
已尝试过 PyTorch 1.9.0 + Lightning 1.5.0 组合,仍然报错 _untyped_storage
服务器无法联网,所有包均为离线安装
Describe the bug
无法加载预训练权重文件
NLS_loc_modeltes。尝试了多种方法均失败,包括:torch.load()报错:A load persistent id instruction was encounteredtorch.load(weights_only=False)报错:'Tensor' object has no attribute '_untyped_storage'pytorch_lightning.utilities.cloud_io.load()报错:模块路径不存在To Reproduce
NLS_loc_modeltes并放置在./Recommendation_system/目录