Skip to content

Transformers v5#1589

Open
echarlaix wants to merge 173 commits intomainfrom
transformers-v5
Open

Transformers v5#1589
echarlaix wants to merge 173 commits intomainfrom
transformers-v5

Conversation

@echarlaix
Copy link
Collaborator

@echarlaix echarlaix commented Jan 19, 2026

with huggingface/optimum#2408

List of architectures for which are deprecating support for transformers < v5
(remote code modeling incompatible with v5)

  • codegen2
  • exaone
  • decilm
  • internlm2
  • orion
  • aquila2
  • jais
  • baichuan2
  • internvl_chat
  • minicpmv
    (remote code models)
  • aquila
  • xverse
  • internlm
  • exaone4

List of architectures for which we removed support for transformers < v5 for which support can be added later on

  • xlm
  • data2vec-text
  • flaubert
  • marian
  • granitemoe
  • zamba2
  • phimoe
  • drbx
  • eagle3
  • mt5
  • llava
  • idefics3
  • gemma3
  • smolvlm
  • got_ocr2
  • llava_next_video
  • llama4
  • bitnet
  • qwen3_next

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Comment on lines -262 to -269
TasksManager._CUSTOM_CLASSES[("pt", "idefics3", "image-text-to-text")] = (
"transformers",
"AutoModelForImageTextToText",
)
TasksManager._CUSTOM_CLASSES[("pt", "smolvlm", "image-text-to-text")] = (
"transformers",
"AutoModelForImageTextToText",
)
Copy link
Collaborator Author

@echarlaix echarlaix Jan 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

redundant ("image-text-to-text" -> AutoModelForImageTextToText) so removing https://github.com/huggingface/optimum/blob/114647f51404f9747410afc287a8079f1f16389b/optimum/exporters/tasks.py#L157

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds compatibility with transformers v5 across the OpenVINO Intel integration, updating model patchers, test suites, pipeline utilities, and model configs to handle the API changes introduced in transformers v5. It also deprecates support for architectures with remote modeling code incompatible with v5.

Changes:

  • Deprecates/gates ~20 architectures (codegen2, exaone, decilm, internlm2, etc.) behind is_transformers_version("<", "5") conditions in test files and model configs
  • Updates model patchers and utility code to handle transformers v5 API changes (renamed infer_framework_load_modelload_model, DynamicCache.from_legacy_cacheDynamicCache(...), return value changes, etc.)
  • Updates setup.py to widen the transformers version range from <4.58 to <5.1 and pin optimum-onnx to the transformers-v5 branch

Reviewed changes

Copilot reviewed 31 out of 31 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
setup.py Widens transformers version bound to <5.1, pins optimum-onnx to @transformers-v5 branch
optimum/intel/pipelines/accelerator_utils.py Handles v5 API change: renamed pipeline function and changed return value
optimum/exporters/openvino/model_patcher.py Updates cache conversion logic for v5, adds postprocess_past_key_values helper
optimum/exporters/openvino/model_configs.py Adds MAX_TRANSFORMERS_VERSION = "4.57.6" to unsupported architectures; refactors init_model_configs
optimum/intel/openvino/modeling_base.py Guards _get_non_default_generation_parameters call behind < "5" check
optimum/intel/openvino/modeling_seq2seq.py Updates auto_model_class to use version-gated transformers_auto_class
optimum/intel/utils/import_utils.py Adds is_huggingface_hub_version helper
optimum/intel/utils/modeling_utils.py Replaces deprecated HfFolder().get_token() with get_token()
tests/openvino/test_decoder.py Gates v5-incompatible architectures; updates comparison operators
tests/openvino/test_seq2seq.py Gates v5-incompatible models; replaces deprecated APIs
tests/openvino/test_modeling.py Updates image preprocessor and tokenizer API usage
tests/openvino/test_quantization.py Updates expected node counts for v5; gates incompatible architectures
tests/openvino/test_genai.py Removes v5-incompatible architectures from test scope
tests/openvino/test_diffusion.py Conditionally includes stable-diffusion-3 based on version
tests/openvino/test_exporters_cli.py Adjusts expected counts and gates architectures for v5
.github/workflows/*.yml Adds transformers version matrix and diffusers installation steps

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@echarlaix echarlaix added the openvino-slow Runs OpenVINO slow tests with different versions of transformers label Mar 5, 2026
@echarlaix echarlaix removed the openvino-slow Runs OpenVINO slow tests with different versions of transformers label Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants