Skip to content

Fall back to AutoModelForImageTextToText when AutoModelForVision2Seq is absent - #1676

Open
rrrxxx0510 wants to merge 2 commits into
open-compass:mainfrom
rrrxxx0510:fix/vision2seq-import-transformers-5
Open

rrrxxx0510 wants to merge 2 commits into
open-compass:mainfrom
rrrxxx0510:fix/vision2seq-import-transformers-5

Conversation

@rrrxxx0510

Copy link
Copy Markdown
Contributor

Fixes #1675

AutoModelForVision2Seq was removed in transformers 5.x (renamed to AutoModelForImageTextToText), so DOCLING, IDEFICS2, Mantis and XGenMM fail at import time on recent transformers:

ImportError: cannot import name 'AutoModelForVision2Seq'

granite_vision already handles this with an ImportError fallback (#1404); this applies the same pattern to the four remaining model wrappers. Also raises in Mantis' generic except branch, which previously logged and continued — leaving AutoModelForVision2Seq undefined and crashing later with a confusing NameError.

Verified on transformers 5.16: the old import raises the ImportError above, the fallback import works.

…is absent

AutoModelForVision2Seq was removed in transformers 5.x (renamed to
AutoModelForImageTextToText), so DOCLING, IDEFICS2, Mantis and XGenMM
fail at import time on recent transformers:

    ImportError: cannot import name 'AutoModelForVision2Seq'

granite_vision already handles this with an ImportError fallback
(open-compass#1404); apply the same pattern to the four remaining model wrappers.
Also raise in Mantis' generic except branch, which previously logged
and continued, leaving AutoModelForVision2Seq undefined and crashing
later with a confusing NameError.
@rrrxxx0510
rrrxxx0510 force-pushed the fix/vision2seq-import-transformers-5 branch from 0b8aaf3 to a10041e Compare September 18, 2026 03:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DOCLING / IDEFICS2 / Mantis / XGenMM fail to import on transformers 5.x: AutoModelForVision2Seq was removed

2 participants