PaddleOCR-VL-0.9B model.safetensors uses bfloat16 weights incompatible with PaddleX 3.3.4 FP32 loader
🔎 Search before asking
- [x] I have searched the PaddleOCR Docs and found no similar bug report.
- [x] I have searched the PaddleOCR Issues and found no similar bug report.
- [x] I have searched the PaddleOCR Discussions and found no similar bug report.
🐛 Bug (问题描述)
PaddleOCR-VL-0.9B 模型在最近更新时的问题: BOS 上提供的 safetensors 权重是用 BF16 格式保存的, 但 PaddleX/PaddleOCR 3.2.0(包括 nightly)在加载时会强制要求 FP32, 结果就触发了 dtype mismatch。
🏃♂️ Environment (运行环境)
NV T4+CUDA 12.8 / Python 3.11 / PaddleX 3.3.4 / PaddleOCR 3.3.0
🌰 Minimal Reproducible Example (最小可复现问题的Demo)
python -m pip install paddlepaddle-gpu==3.2.0 -i https://www.paddlepaddle.org.cn/packages/stable/cu126/ python -m pip install -U "paddleocr[doc-parser]" python -m pip install https://paddle-whl.bj.bcebos.com/nightly/cu126/safetensors/safetensors-0.6.2.dev0-cp38-abi3-linux_x86_64.whl python -m pip install paddlex
from paddleocr import PaddleOCRVL pipeline = PaddleOCRVL() output = pipeline.predict("https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/paddleocr_vl_demo.png") for res in output: res.print() res.save_to_json(save_path="output") res.save_to_markdown(save_path="output")
我也遇到了。paddle这群叼毛,把用户当测试用了
遇到同样的问题,请问这个咋解决
转一下浮点类型,规避一下
打开paddlex/inference/models/common/vlm/transformers/model_utils.py 在model_to_load.set_hf_state_dict(state_dict)方法前加入如下代码:
# Convert bfloat16 to float32 if needed to resolve dtype mismatch
for key, value in state_dict.items():
if hasattr(value, 'dtype') and value.dtype == paddle.bfloat16:
state_dict[key] = value.astype(paddle.float32)
这是来自QQ邮箱的假期自动回复邮件。你好,我最近正在休假中,无法亲自回复你的邮件。我将在假期结束后,尽快给你回复。
我也遇到了。paddle这群叼毛,把用户当测试用了
我们在文档中说明了Paddle框架推理暂不支持Compute Capability < 8.5的显卡,T4的Compute Capability 为8.0,所以不支持:
昨天我们完善了低Compute Capability GPU的适配,将paddlex升级到3.3.5版本可以解决这个问题。