From d9434fee4aab46766c8a0a1aa6a3a8dc9f09d8f0 Mon Sep 17 00:00:00 2001 From: Roland Tannous Date: Wed, 25 Feb 2026 10:29:05 +0000 Subject: [PATCH] fix: use raw github URL for vision.py patch + add VLM processor diagnostic logging --- setup.sh | 4 ++++ studio/backend/core/training/trainer.py | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/setup.sh b/setup.sh index 0d8821d50a..a911d9ed7a 100755 --- a/setup.sh +++ b/setup.sh @@ -169,6 +169,10 @@ if [ "$IS_COLAB" = true ]; then LLAMA_CPP_DST="$(pip show unsloth-zoo | grep -i '^Location:' | awk '{print $2}')/unsloth_zoo/llama_cpp.py" curl -sSL "https://raw.githubusercontent.com/unslothai/unsloth-zoo/refs/heads/main/unsloth_zoo/llama_cpp.py" \ -o "$LLAMA_CPP_DST" + # Patch: override vision.py with fix from unsloth PR: https://github.com/unslothai/unsloth/pull/4091 until next pypi release + VISION_DST="$(pip show unsloth | grep -i '^Location:' | awk '{print $2}')/unsloth/vision.py" + curl -sSL "https://raw.githubusercontent.com/unslothai/unsloth/80e0108a684c882965a02a8ed851e3473c1145ab/unsloth/models/vision.py" \ + -o "$VISION_DST" echo " Installing studio dependencies..." run_quiet "pip install studio" pip install -r "$SCRIPT_DIR/studio/backend/requirements/studio.txt" echo "✅ Python dependencies installed" diff --git a/studio/backend/core/training/trainer.py b/studio/backend/core/training/trainer.py index 804baa33c0..c56b4a8a89 100644 --- a/studio/backend/core/training/trainer.py +++ b/studio/backend/core/training/trainer.py @@ -173,6 +173,15 @@ class UnslothTrainer: token=hf_token, ) logger.info("Loaded vision model") + + # Diagnostic: check if FastVisionModel returned a real Processor or a raw tokenizer + from transformers import ProcessorMixin + tok = self.tokenizer + has_image_proc = isinstance(tok, ProcessorMixin) or hasattr(tok, "image_processor") + print(f"\n[VLM Diagnostic] FastVisionModel returned: {type(tok).__name__}") + print(f"[VLM Diagnostic] Is ProcessorMixin: {isinstance(tok, ProcessorMixin)}") + print(f"[VLM Diagnostic] Has image_processor: {hasattr(tok, 'image_processor')}") + print(f"[VLM Diagnostic] Usable as vision processor: {has_image_proc}\n") else: # Load text model - returns (model, tokenizer) self.model, self.tokenizer = FastLanguageModel.from_pretrained(