Skip to content

Update to transformers v5#30566

Open
hmellor wants to merge 89 commits intovllm-project:mainfrom
hmellor:transformers-v5
Open

Update to transformers v5#30566
hmellor wants to merge 89 commits intovllm-project:mainfrom
hmellor:transformers-v5

Conversation

@hmellor
Copy link
Member

@hmellor hmellor commented Dec 12, 2025

Changes:

  • Update Transformers pin to 5.x.y
  • Update Tokenizers pin to 0.22.2 (as is required by Transformers 5.0.0)
  • Update PEFT lower bound to 0.18.1 so that huggingface/peft@41c07f0 is included (guards import of HybridCache on Transformers version)
  • Update Accelerate pin to 1.1.0 so that 4-bit bnb can work on Transformers v5
  • Update Mamba pin to 2.3.0 so that state-spaces/mamba@35e927b is included (removes import that was deleted in Transformers v5)
  • Replace HF_HUB_ENABLE_HF_TRANSFER with HF_XET_HIGH_PERFORMANCE as the HF Hub is all Xet now so hf_transfer doesn't do anything anymore
  • Add HF_HUB_DOWNLOAD_TIMEOUT=60 to the CI environment to deal with the shortened timeout in huggingface-hub==1 since it switched to httpx
  • Adds a backward compatbility tests that runs the same tests as "Transformers nightly", but with 4.57.5 installed

Architectures/models that will no longer work after the upgrade:

  • MiniCPMV - Custom processing code on the Hub is incompatible with Transformers v5 (PR made but unmerged)
  • OpenCUAForConditionalGeneration - Custom code is not compatible with Transformers v5
  • OpenPanguVLForConditionalGeneration - OpenPanguVLVideoProcessorInitKwargs does not specify total=False, making all kwargs required
  • Ovis2_5 - Custom processor code is not compatible with Transformers v5
  • Ovis2_6_MoeForCausalLM - Custom processor code is not compatible with Transformers v5
  • MiniCPMO - Custom processor code is not compatible with Transformers v5
  • InternS1ForConditionalGeneration - Custom tokenizer code is not compatible with Transfomers v5
  • ExaoneMoeMTP - The model is not compatible with the test harness because it doesn't support prefix caching (this model was never tested with Transformers v4 installed)

Caution

30d8b3d must be reverted before this can be merged


Supplementary PRs:

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
@hmellor hmellor added the ready ONLY add when PR is ready to merge/full CI is needed label Dec 12, 2025
@mergify mergify bot added the ci/build label Dec 12, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request aims to update the transformers library to version 5. The changes correctly update the version in requirements/test.in and requirements/nightly_torch_test.txt, and also add the --pre flag to uv pip install in the Dockerfile to allow installation of the release candidate. However, there is a critical oversight: requirements/common.txt still contains a constraint transformers < 5. This will lead to build failures for any configuration that relies on common.txt. This file must be updated to allow transformers v5 for this PR to be mergeable.

@hmellor hmellor marked this pull request as ready for review December 12, 2025 17:56
@chatgpt-codex-connector
Copy link

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.

@hmellor hmellor changed the title update to transformers v5 Update to transformers v5 Dec 15, 2025
@hmellor hmellor linked an issue Dec 17, 2025 that may be closed by this pull request
1 task
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

Comment @cursor review or bugbot run to trigger another review on this PR

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
@hmellor hmellor linked an issue Jan 27, 2026 that may be closed by this pull request
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
@hmellor hmellor requested a review from tjtanaa as a code owner January 27, 2026 23:32
@mergify mergify bot added the rocm Related to AMD ROCm label Jan 27, 2026
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
@mergify
Copy link

mergify bot commented Jan 28, 2026

Documentation preview: https://vllm--30566.org.readthedocs.build/en/30566/

@mergify mergify bot added the documentation Improvements or additions to documentation label Jan 28, 2026
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
@mergify
Copy link

mergify bot commented Feb 23, 2026

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @hmellor.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify bot added the needs-rebase label Feb 23, 2026
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
@mergify mergify bot removed the needs-rebase label Feb 24, 2026
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
@niksdagr8
Copy link

Any progress on this is appreciated.

@mergify
Copy link

mergify bot commented Mar 2, 2026

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @hmellor.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify bot added the needs-rebase label Mar 2, 2026
vermouth1992 pushed a commit to verl-project/verl that referenced this pull request Mar 3, 2026
### What does this PR do?

Refer to
vllm-project/vllm#30566
for all the patched needed for Transformers v5

This PR is a Transformers v5 compatibility sweep plus guardrails for
token ID shape consistency.

- Remove the hard <5.0.0 block by changing dependency pinning in
requirements.txt.
- Add a single compat resolver get_auto_model_for_vision2seq() in
transformers_compat.py to handle AutoModelForVision2Seq vs
AutoModelForImageTextToText, and switch model-loading/registration
codepaths to use that resolver instead of direct imports.
- Introduce normalize_token_ids(...) in tokenizer.py, which normalizes
apply_chat_template(tokenize=True) outputs to flat list[int] across
v4/v5 return-shape differences.

### Checklist Before Starting

- [X] Search for similar PRs. Paste at least one query link here: ...
- [X] Format the PR title as `[{modules}] {type}: {description}` (This
will be checked by the CI)
- `{modules}` include `fsdp`, `megatron`, `veomni`, `sglang`, `vllm`,
`rollout`, `trainer`, `ci`, `training_utils`, `recipe`, `hardware`,
`deployment`, `ray`, `worker`, `single_controller`, `misc`, `perf`,
`model`, `algo`, `env`, `tool`, `ckpt`, `doc`, `data`, `cfg`, `reward`,
`fully_async`, `one_step_off`
- If this PR involves multiple modules, separate them with `,` like
`[megatron, fsdp, doc]`
  - `{type}` is in `feat`, `fix`, `refactor`, `chore`, `test`
- If this PR breaks any API (CLI arguments, config, function signature,
etc.), add `[BREAKING]` to the beginning of the title.
  - Example: `[BREAKING][fsdp, megatron] feat: dynamic batching`

### Test

> For changes that can not be tested by CI (e.g., algorithm
implementation, new model support), validate by experiment(s) and show
results like training curve plots, evaluation results, etc.

### API and Usage Example

> Demonstrate how the API changes if any, and provide usage example(s)
if possible.

```python
# Add code snippet or script demonstrating how to use this
```

### Design & Code Changes

> Demonstrate the high-level design if this PR is complex, and list the
specific changes.

### Checklist Before Submitting

> [!IMPORTANT]
> Please check all the following items before requesting a review,
otherwise the reviewer might deprioritize this PR for review.

- [X] Read the [Contribute
Guide](https://github.com/volcengine/verl/blob/main/CONTRIBUTING.md).
- [X] Apply [pre-commit
checks](https://github.com/volcengine/verl/blob/main/CONTRIBUTING.md#code-linting-and-formatting):
`pre-commit install && pre-commit run --all-files --show-diff-on-failure
--color=always`
- [X] Add / Update [the
documentation](https://github.com/volcengine/verl/tree/main/docs).
- [X] Add unit or end-to-end test(s) to [the CI
workflow](https://github.com/volcengine/verl/tree/main/.github/workflows)
to cover all the code. If not feasible, explain why: ...
- [X] Once your PR is ready for CI, send a message in [the `ci-request`
channel](https://verl-project.slack.com/archives/C091TCESWB1) in [the
`verl` Slack
workspace](https://join.slack.com/t/verl-project/shared_invite/zt-3855yhg8g-CTkqXu~hKojPCmo7k_yXTQ).
(If not accessible, please try [the Feishu group
(飞书群)](https://applink.larkoffice.com/client/chat/chatter/add_by_link?link_token=772jd4f1-cd91-441e-a820-498c6614126a).)
- [X] If your PR is related to the `recipe` submodule, please also
update the reference to the submodule commit via `git submodule update
--remote` or `cd recipe && git pull origin main`.

---------

Signed-off-by: Hollow Man <hollowman@opensuse.org>
hmellor added 2 commits March 3, 2026 15:49
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
@mergify mergify bot removed the needs-rebase label Mar 3, 2026
@mergify
Copy link

mergify bot commented Mar 4, 2026

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @hmellor.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify bot added the needs-rebase label Mar 4, 2026
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
@mergify mergify bot removed the needs-rebase label Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci/build cpu Related to CPU backends documentation Improvements or additions to documentation multi-modality Related to multi-modality (#4194) ready ONLY add when PR is ready to merge/full CI is needed rocm Related to AMD ROCm v1

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

Bump transformers to 5.0.0 [Feature]: Support transformers>=5

2 participants