deekshaaneja / Qwen2-VL

10 stars 7 forks source link

ImportError: cannot import name 'Qwen2VLForConditionalGeneration' from 'transformers' #1

Open Kyrie10favor opened 1 month ago

Kyrie10favor commented 1 month ago

pip list | grep "transformers" 得到: sentence-transformers 3.0.1 transformers 4.45.0.dev0


进入python:

Python 3.9.20 (main, Oct  3 2024, 07:27:41) 
[GCC 11.2.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.

>>> from transformers import Qwen2VLForConditionalGeneration

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'Qwen2VLForConditionalGeneration' from 'transformers'

另外我也尝试过其他的解决方式: pip uninstall transformers pip install git+https://github.com/huggingface/transformers 或者 pip install git+https://github.com/huggingface/transformers@21fac7abba2a37fae86106f87fcf9974fd1e3830 accelerate这个版本 但是仍然没有解决,请问我下一步该如何做?谢谢

deekshaaneja commented 1 month ago

I have added requirements.txt. Try using that Moreover, make sure to install transformers at the last, since the other packages(like torch) keep downgrading/upgrading the versions of installed libraries

Kyrie10favor commented 1 month ago

thanks for ur reply, I have resolved the issue by adding 'python-m pip install' to install the dependencies