modelscope / modelscope/ms-swift
ImportError: cannot import name 'AutoModelForVision2Seq' from 'transformers'
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 1.7k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 136
Description
Checklist / 检查清单
- I have searched existing issues, and this is a new bug report. / 我已经搜索过现有的 issues,确认这是一个新的 bug report。
Bug Description / Bug 描述
Traceback (most recent call last):
File "/home/notebook/code/group/zmy/swift-new/ms-swift/swift/cli/eval.py", line 5, in
eval_main()
File "/home/notebook/code/group/zmy/swift-new/ms-swift/swift/pipelines/eval/eval.py", line 160, in eval_main
return SwiftEval(args).main()
File "/home/notebook/code/group/zmy/swift-new/ms-swift/swift/pipelines/base.py", line 18, in init
self.args = self._parse_args(args)
File "/home/notebook/code/group/zmy/swift-new/ms-swift/swift/pipelines/base.py", line 35, in _parse_args
args, remaining_argv = parse_args(self.args_class, args)
File "/home/notebook/code/group/zmy/swift-new/ms-swift/swift/utils/utils.py", line 187, in parse_args
args, remaining_args = parser.parse_args_into_dataclasses(argv, return_remaining_strings=True)
File "/home/notebook/code/group/zmy/conda_envs/ms-swift-0304/lib/python3.10/site-packages/transformers/hf_argparser.py", line 345, in parse_args_into_dataclasses
obj = dtype(**inputs)
File "", line 168, in init
File "/home/notebook/code/group/zmy/swift-new/ms-swift/swift/arguments/eval_args.py", line 68, in post_init
self._init_eval_dataset()
File "/home/notebook/code/group/zmy/swift-new/ms-swift/swift/arguments/eval_args.py", line 103, in _init_eval_dataset
all_eval_dataset = self.list_eval_dataset(self.eval_backend)
File "/home/notebook/code/group/zmy/swift-new/ms-swift/swift/arguments/eval_args.py", line 91, in list_eval_dataset
vlm_datasets = VLMEvalKitBackendManager.list_supported_datasets()
File "/home/notebook/code/group/zmy/conda_envs/ms-swift-0304/lib/python3.10/site-packages/evalscope/backend/vlm_eval_kit/backend_manager.py", line 101, in list_supported_datasets
from vlmeval.dataset import SUPPORTED_DATASETS
File "/home/notebook/code/group/zmy/conda_envs/ms-swift-0304/lib/python3.10/site-packages/vlmeval/init.py", line 13, in
from .api import *
File "/home/notebook/code/group/zmy/conda_envs/ms-swift-0304/lib/python3.10/site-packages/vlmeval/api/init.py", line 4, in
from .qwen_vl_api import QwenVLWrapper, QwenVLAPI, Qwen2VLAPI
File "/home/notebook/code/group/zmy/conda_envs/ms-swift-0304/lib/python3.10/site-packages/vlmeval/api/qwen_vl_api.py", line 8, in
from vlmeval.vlm.qwen2_vl.prompt import Qwen2VLPromptMixin
File "/home/notebook/code/group/zmy/conda_envs/ms-swift-0304/lib/python3.10/site-packages/vlmeval/vlm/init.py", line 12, in
from .granite_vision import GraniteVision3
File "/home/notebook/code/group/zmy/conda_envs/ms-swift-0304/lib/python3.10/site-packages/vlmeval/vlm/granite_vision/init.py", line 1, in
from .granite_vision import GraniteVision3
File "/home/notebook/code/group/zmy/conda_envs/ms-swift-0304/lib/python3.10/site-packages/vlmeval/vlm/granite_vision/granite_vision.py", line 11, in
from transformers import AutoModelForVision2Seq, AutoProcessor
ImportError: cannot import name 'AutoModelForVision2Seq' from 'transformers'
How to Reproduce / 如何复现
swift eval ...
transformers=5.2.0
peft=0.18.1
Additional Information / 补充信息
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at swift/arguments/eval_args.py and the eval entry point, then trace the VLMEvalKitBackendManager.list_supported_datasets() import shown in the traceback. Reproduce with swift eval ... using transformers=5.2.0 and inspect the vlmeval dependency boundary. Done means evaluation startup no longer fails with the reported ImportError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 32/100