unsloth/unsloth
Daniel Han fec06247c9 Fix VLM processor load degradation and vLLM CUDA version detection (#4091)
* Fix VLM processor load degradation and vLLM CUDA version detection

vision.py - Fix VLM processor load for issue #4085:
- Before loading the processor, scan local config files and strip the
  _Unsloth_Patched_ prefix. AutoProcessor.from_pretrained silently
  degrades to a text-only tokenizer instead of raising an exception
  when it encounters the unrecognized class name, so the existing
  get_auto_processor fallback never triggers. Sanitizing the configs
  before loading fixes backwards compat for old corrupted saves.
- After loading, detect when AutoProcessor returned a text-only
  tokenizer for a VLM model (has no image_processor attribute) and
  trigger the manual fallback constructor.

import_fixes.py - Fix vLLM CUDA version mismatch detection:
- _is_broken_vllm_error now also matches CUDA shared library errors
  (libcudart, libcublas, libnvrtc) with "cannot open shared object
  file". Previously it only matched errors containing "vllm._c" in
  the message text, which missed cases where the error message was
  about the missing CUDA library itself (e.g. vllm built for CUDA 12
  on a CUDA 13 system).
- New _get_vllm_cuda_mismatch_message function extracts the CUDA
  version from the error, compares to the system CUDA version via
  torch.version.cuda, and returns a targeted install command using
  the correct GitHub releases wheel URL.
- disable_broken_vllm uses the targeted message when a CUDA mismatch
  is detected, falling back to the existing generic message otherwise.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: Ubuntu <ubuntu@ip-172-31-16-253.us-east-2.compute.internal>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-02-23 01:06:53 -08:00
..
dataprep Guard optional vLLM imports when extension is broken (#4068) 2026-02-15 22:09:29 -08:00
kernels [Feat] FP8 per tensor quant support (#4043) 2026-02-16 01:21:30 -08:00
models Fix VLM processor load degradation and vLLM CUDA version detection (#4091) 2026-02-23 01:06:53 -08:00
registry Revert "[pre-commit.ci] auto fixes from pre-commit.com hooks" 2025-12-01 07:24:58 -08:00
utils Refactor Ollama template wiring and harden packing helpers (#3890) 2026-02-09 04:04:48 -08:00
__init__.py Patch trunc_normal_ for low-precision stability (#4027) 2026-02-19 04:40:14 -08:00
_auto_install.py Add PyTorch 2.10 and xformers 0.0.34 support (#3985) 2026-02-05 05:56:26 -08:00
chat_templates.py Fix regressions from security PRs #4042, #4044, and #4045 (#4062) 2026-02-15 23:16:17 -08:00
device_type.py Add missing import of inspect (#3778) 2025-12-25 18:43:59 -08:00
import_fixes.py Fix VLM processor load degradation and vLLM CUDA version detection (#4091) 2026-02-23 01:06:53 -08:00
ollama_template_mappers.py Refactor Ollama template wiring and harden packing helpers (#3890) 2026-02-09 04:04:48 -08:00
save.py Add optional datasets metadata support to save/push functions (#4076) 2026-02-19 03:53:35 -08:00
tokenizer_utils.py Fix notebook compatibility for transformers 4.57.6 and TRL 0.22-0.27 (#3998) 2026-02-09 05:11:50 -08:00
trainer.py Fix notebook compatibility for transformers 4.57.6 and TRL 0.22-0.27 (#3998) 2026-02-09 05:11:50 -08:00