Skip to content

Add transformers v5.10 support - #1863

Merged
echarlaix merged 14 commits into
mainfrom
transformers-v5.10-support
Sep 9, 2026
Merged

echarlaix merged 14 commits into
mainfrom
transformers-v5.10-support

Conversation

@echarlaix

@echarlaix echarlaix commented Jul 13, 2026 •

Copy link
Copy Markdown
Collaborator

Add support for transformers v5.10:

  • CLIPTextTransformer was removed in Refactor CLIP-like models transformers#44431, so text_encoder.text_model no longer exists since transformers v5.6
  • gemma4_text_attention_forward: transformers v5.6 (First model transformers#45788) replaced past_key_values.shared_layers / self.kv_shared_layer_index with a shared_kv_states dict passed through kwargs
  • rot_pos_emb() in _OVQwen2VLForCausalLM and _OVQwen3OmniMoeForCausalLM now calls self._rotary_pos_emb(pos_ids) directly when is_transformers_version(">=", "5.9"), since the upstream signature changed from taking max_grid_size to taking pos_ids directly

@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

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.

@echarlaix
echarlaix marked this pull request as draft July 13, 2026 16:43
@echarlaix
echarlaix marked this pull request as draft July 13, 2026 16:43
Comment thread .github/workflows/test_openvino.yml Resolved
@echarlaix
echarlaix force-pushed the transformers-v5.10-support branch from ac9a688 to 052e1a9 Compare July 16, 2026 16:36
@echarlaix echarlaix added openvino-slow Runs OpenVINO slow tests with different versions of transformers and removed openvino-slow Runs OpenVINO slow tests with different versions of transformers labels Jul 17, 2026
@echarlaix
echarlaix marked this pull request as ready for review July 17, 2026 12:49
@echarlaix
echarlaix marked this pull request as ready for review July 17, 2026 12:49
@echarlaix
echarlaix marked this pull request as draft July 17, 2026 16:06
max_grid_size = grid_thw[:, 1:].max()
rotary_pos_emb_full = self._rotary_pos_emb(max_grid_size)
rotary_pos_emb = rotary_pos_emb_full[pos_ids].flatten(1)
if is_transformers_version(">=", "5.9"):

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@echarlaix
echarlaix marked this pull request as ready for review July 20, 2026 14:55
@echarlaix
echarlaix marked this pull request as ready for review July 20, 2026 14:55

@regisss regisss left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

@echarlaix echarlaix added the openvino-slow Runs OpenVINO slow tests with different versions of transformers label Sep 1, 2026
Comment on lines +5674 to +5675
shared_kv_states = kwargs.pop("shared_kv_states", None)
legacy_shared_kv_states = hasattr(self, "kv_shared_layer_index")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

shall we have if-else condition on transformers version? Does this change work for transfoemrs <5.6?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

applied your comment in 3bbb9a0

echarlaix and others added 3 commits September 8, 2026 16:27
Co-authored-by: Roman Kazantsev <roman.kazantsev@intel.com>
Co-authored-by: Roman Kazantsev <roman.kazantsev@intel.com>
@echarlaix
echarlaix merged commit 445954d into main Sep 9, 2026
47 of 62 checks passed
@echarlaix
echarlaix deleted the transformers-v5.10-support branch September 9, 2026 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

openvino-slow Runs OpenVINO slow tests with different versions of transformers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants