vLLM Windows CUDA support [tested] (#2158)

* Update loader.py

change vllm installed check by transformers utils function

* Update llama.py

change vllm installed check by transformers utils function

* add sample notebook

* fix Indentation

* add global is_vLLM_available function

* Pythonic style

* Delete nb/Qwen2.5_(3B)-GRPO-windows.ipynb

Would be great to move it to https://github.com/unslothai/notebooks - appreciate it!

---------

Co-authored-by: Daniel Han <danielhanchen@gmail.com>
This commit is contained in:
feng lui 2025-05-12 20:33:42 +08:00 committed by GitHub
commit c9ca2096b7
4 changed files with 11 additions and 8 deletions

View file

@ -20,5 +20,5 @@ from .qwen3 import FastQwen3Model
from .qwen3_moe import FastQwen3MoeModel
from .granite import FastGraniteModel
from .dpo import PatchDPOTrainer, PatchKTOTrainer
from ._utils import is_bfloat16_supported, __version__
from .rl import PatchFastRL, vLLMSamplingParams
from ._utils import is_bfloat16_supported, is_vLLM_available, __version__
from .rl import PatchFastRL, vLLMSamplingParams

View file

@ -17,6 +17,7 @@ __version__ = "2025.5.1"
__all__ = [
"SUPPORTS_BFLOAT16",
"is_bfloat16_supported",
"is_vLLM_available",
"prepare_model_for_kbit_training",
"xformers",
@ -800,6 +801,9 @@ def is_bfloat16_supported():
return SUPPORTS_BFLOAT16
pass
def is_vLLM_available():
return _is_package_available("vllm")
pass
# Patches models to add RoPE Scaling
def patch_linear_scaling(

View file

@ -1661,9 +1661,8 @@ class FastLlamaModel:
)
pass
if fast_inference:
import platform
if platform.system().lower() == 'windows':
print("Unsloth: vLLM does not work in Windows! Will use Unsloth inference!")
if not is_vLLM_available():
print("Unsloth: vLLM is not installed! Will use Unsloth inference!")
fast_inference = False
major_version, minor_version = torch.cuda.get_device_capability()
if major_version < 7:

View file

@ -14,6 +14,7 @@
from ._utils import (
is_bfloat16_supported,
is_vLLM_available,
HAS_FLASH_ATTENTION,
HAS_FLASH_ATTENTION_SOFTCAPPING,
USE_MODELSCOPE,
@ -351,9 +352,8 @@ class FastLanguageModel(FastLlamaModel):
pass
if fast_inference:
import platform
if platform.system().lower() == 'windows':
print("Unsloth: vLLM does not work in Windows! Will use Unsloth inference!")
if not is_vLLM_available():
print("Unsloth: vLLM is not installed! Will use Unsloth inference!")
fast_inference = False
pass
from unsloth_zoo.vllm_utils import (