MiniCPM3-4B: An edge-side LLM that surpasses GPT-3.5-Turbo.
Apache License 2.0
6.95k
stars
440
forks
source link
[Bug]: 出现报错_pickle.UnpicklingError: Weights only load failed. Re-running `torch.load` with `weights_only` set to `False` will likely succeed, but it can result in arbitrary code execution. Do it only if you got the file from a trusted source. #185
[X] I have searched, and there is no existing issue. / 我已经搜索过了,没有相关的 issue。
Describe the bug / 描述这个 bug
按照https://modelbest.feishu.cn/wiki/Sd6pwKkLni4YNgkeWB9cm3XInTb这篇文档的指导,在GPU服务器上下载了miniCPM-bf16这个模型。尝试运行MiniCPM/demo/hf_based_demo.py脚本时出现如下报错:
Traceback (most recent call last):
File "/home/xxx/miniconda3/lib/python3.8/site-packages/transformers/modeling_utils.py", line 575, in load_state_dict
return torch.load(
File "/home/xxx/miniconda3/lib/python3.8/site-packages/torch/serialization.py", line 1113, in load
raise pickle.UnpicklingError(_get_wo_message(str(e))) from None
_pickle.UnpicklingError: Weights only load failed. Re-running torch.load with weights_only set to False will likely succeed, but it can result in arbitrary code execution. Do it only if you got the file from a trusted source.
Please file an issue with the following so that we can make weights_only=True compatible with your use case: WeightsUnpickler error: Unsupported operand 118
Is there an existing issue ? / 是否已有相关的 issue ?
Describe the bug / 描述这个 bug
按照https://modelbest.feishu.cn/wiki/Sd6pwKkLni4YNgkeWB9cm3XInTb这篇文档的指导,在GPU服务器上下载了miniCPM-bf16这个模型。尝试运行MiniCPM/demo/hf_based_demo.py脚本时出现如下报错: Traceback (most recent call last): File "/home/xxx/miniconda3/lib/python3.8/site-packages/transformers/modeling_utils.py", line 575, in load_state_dict return torch.load( File "/home/xxx/miniconda3/lib/python3.8/site-packages/torch/serialization.py", line 1113, in load raise pickle.UnpicklingError(_get_wo_message(str(e))) from None _pickle.UnpicklingError: Weights only load failed. Re-running
torch.load
withweights_only
set toFalse
will likely succeed, but it can result in arbitrary code execution. Do it only if you got the file from a trusted source. Please file an issue with the following so that we can makeweights_only=True
compatible with your use case: WeightsUnpickler error: Unsupported operand 118Check the documentation of torch.load to learn more about types accepted by default with weights_only https://pytorch.org/docs/stable/generated/torch.load.html.
To Reproduce / 如何复现
在Linux系统下依次用git clone https://github.com/OpenBMB/MiniCPM.git指令安装MiniCPM、用git clone https://www.modelscope.cn/OpenBMB/miniCPM-bf16.git安装miniCPM-bf16。修改MiniCPM/demo/hf_based_demo.py中第18行为parser.add_argument("--torch_dtype", type=str, default="float16", choices=["float32", "bfloat16", "float16"])。然后运行该脚本出现报错。 使用的Python解释器版本是Python 3.8.5,不知道是不是版本的问题?
Expected behavior / 期望的结果
Screenshots / 截图
No response
Environment / 环境
Additional context / 其他信息
No response