From 85ed61e39138becf885d8647f282019f962bb738 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Quentin=20Gallou=C3=A9dec?= Date: Tue, 14 Apr 2026 19:43:30 +0000 Subject: [PATCH 1/2] support vLLM 0.18 --- docs/source/vllm_integration.md | 2 +- pyproject.toml | 2 +- tests/test_sft_trainer.py | 4 ++-- trl/_compat.py | 2 +- trl/import_utils.py | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/source/vllm_integration.md b/docs/source/vllm_integration.md index 196466799f0..3b2d1e7b1b3 100644 --- a/docs/source/vllm_integration.md +++ b/docs/source/vllm_integration.md @@ -3,7 +3,7 @@ This document will guide you through the process of using vLLM with TRL for faster generation in online methods like GRPO and Online DPO. We first summarize a tl;dr on how to use vLLM with TRL, and then we will go into the details of how it works under the hood. > [!WARNING] -> TRL currently only supports vLLM versions from `0.11.0` to `0.17.1`. Please ensure you have a version in this range installed to avoid compatibility issues. +> TRL currently only supports vLLM versions from `0.11.0` to `0.18.0`. Please ensure you have a version in this range installed to avoid compatibility issues. > [!TIP] > The following trainers currently support generation with vLLM: diff --git a/pyproject.toml b/pyproject.toml index 5d4ff7a9df0..12b60d37424 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -79,7 +79,7 @@ test = [ "pytest" ] vllm = [ - "vllm>=0.11.0,<=0.17.1", + "vllm>=0.11.0,<=0.18.0", "fastapi", "pydantic", "aiohttp>=3.13.3", diff --git a/tests/test_sft_trainer.py b/tests/test_sft_trainer.py index c9801a2111c..d5f3c94d52a 100644 --- a/tests/test_sft_trainer.py +++ b/tests/test_sft_trainer.py @@ -628,9 +628,9 @@ def test_train_with_peft_config_prompt_tuning(self, peft_type): tokenizer_name_or_path="trl-internal-testing/tiny-Qwen2ForCausalLM-2.5", ) elif peft_type == "prefix_tuning": - if parse_version(peft.__version__) <= Version("0.17.1"): + if parse_version(peft.__version__) <= Version("0.18.0"): pytest.xfail( - "Prefix tuning with device_map='auto' is broken in peft 0.17.1 and below. See " + "Prefix tuning with device_map='auto' is broken in peft 0.18.0 and below. See " "https://github.com/huggingface/peft/issues/2821" ) peft_config = PrefixTuningConfig( diff --git a/trl/_compat.py b/trl/_compat.py index 0dca4281c60..4bfed16b7fb 100644 --- a/trl/_compat.py +++ b/trl/_compat.py @@ -89,7 +89,7 @@ def _patch_vllm_disabled_tqdm() -> None: - Bug introduced in https://github.com/vllm-project/vllm/pull/52 - Fixed in https://github.com/vllm-project/vllm/pull/28471 (released in v0.11.1) - - Since TRL currently supports vLLM v0.11.0-0.17.1, we patch it here + - Since TRL currently supports vLLM v0.11.0-0.18.0, we patch it here - This can be removed when TRL requires vLLM>=0.11.1 """ if _is_package_version_below("vllm", "0.11.1"): diff --git a/trl/import_utils.py b/trl/import_utils.py index d9bc0e3817d..f3e7c43452f 100644 --- a/trl/import_utils.py +++ b/trl/import_utils.py @@ -105,9 +105,9 @@ def is_uvicorn_available() -> bool: def is_vllm_available(min_version: str | None = None) -> bool: _vllm_available, _vllm_version = _is_package_available("vllm", return_version=True) if _vllm_available: - if not (Version("0.11.0") <= Version(_vllm_version) <= Version("0.17.1")): + if not (Version("0.11.0") <= Version(_vllm_version) <= Version("0.18.0")): warnings.warn( - f"TRL currently supports vLLM versions from 0.11.0 to 0.17.1. You have version {_vllm_version} " + f"TRL currently supports vLLM versions from 0.11.0 to 0.18.0. You have version {_vllm_version} " "installed. We recommend installing a supported version to avoid compatibility issues.", stacklevel=2, ) From 7b103249520d09e68444760d63f6fda34a73195b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Quentin=20Gallou=C3=A9dec?= Date: Tue, 14 Apr 2026 20:12:05 +0000 Subject: [PATCH 2/2] Fix xfail condition for prefix tuning compatibility with peft version 0.17.1 --- tests/test_sft_trainer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_sft_trainer.py b/tests/test_sft_trainer.py index d5f3c94d52a..c9801a2111c 100644 --- a/tests/test_sft_trainer.py +++ b/tests/test_sft_trainer.py @@ -628,9 +628,9 @@ def test_train_with_peft_config_prompt_tuning(self, peft_type): tokenizer_name_or_path="trl-internal-testing/tiny-Qwen2ForCausalLM-2.5", ) elif peft_type == "prefix_tuning": - if parse_version(peft.__version__) <= Version("0.18.0"): + if parse_version(peft.__version__) <= Version("0.17.1"): pytest.xfail( - "Prefix tuning with device_map='auto' is broken in peft 0.18.0 and below. See " + "Prefix tuning with device_map='auto' is broken in peft 0.17.1 and below. See " "https://github.com/huggingface/peft/issues/2821" ) peft_config = PrefixTuningConfig(