一、
ImportError: cannot import name 'Qwen2_5_VLForConditionalGeneration' from 'transformers' (/usr/local/lib/python3.10/site-packages/transformers/init .py)
这时候检查一下transformer的版本:
终端里运行bash命令:
pip show transformers
然后运行下面的命令升级transformer的版本到最新版:
pip install --upgrade transformers
然后可以再次运行第一个命令查看有没有升级,然后新建一个python文件,把本来要运行的代码复制进去,再运行就好了。
二、Huggingface连不上去
报错如下:OSError: We couldn't connect to 'https://huggingface.co ' to load this file, couldn't find it in the cached files and it looks like Qwen/Qwen2.5-VL-7B-Instruct is not the path to a directory containing a file named config.json. Checkout your internet connection or see how to run the library in offline mode at 'https://huggingface.co/docs/transformers/installation#offline-mode '.
在代码的最开头添加
import os
os.environ["HF_ENDPOINT"] = "https://hf-mirror.com"
之后要重启终端/服务器/编译器,再打开就好了