CI(notebooks): api-introspect job needs Pillow + torchvision + safetensors

Tick 3 of api-introspect failure: triton install fixed the previous
crash, now `import unsloth` reaches unsloth.models._utils which pulls
unsloth_zoo.vision_utils (line 147), which imports PIL (line 57),
which is not installed.

Mirror the consolidated-tests-ci.yml install: pull torchvision from
the CPU wheel index (this normally drags in Pillow), and add Pillow
+ safetensors + tqdm + packaging + psutil explicitly as
belt-and-braces in case torchvision drops its Pillow dep on a future
release.
This commit is contained in:
Daniel Han 2026-05-07 12:42:47 +00:00
commit 86e31c98bb

View file

@ -193,17 +193,26 @@ jobs:
- name: Install CPU torch + pinned unsloth + trl + converter deps
run: |
python -m pip install --upgrade pip
pip install --index-url https://download.pytorch.org/whl/cpu 'torch>=2.8,<2.11'
# CPU torch + torchvision. torchvision is required because
# unsloth_zoo.vision_utils imports PIL at module top, and the
# easiest way to get a torch-compatible PIL on a CPU runner is
# to let torchvision pull the right Pillow version.
pip install --index-url https://download.pytorch.org/whl/cpu \
'torch>=2.8,<2.11' 'torchvision<0.26'
# Pin to the same versions update_all_notebooks.py installs in
# generated notebooks. Keep these in lockstep with PIN_TRL /
# PIN_TRANSFORMERS in unslothai/notebooks/update_all_notebooks.py.
# `triton` is added because unsloth/_gpu_init.py:232 does an
# unconditional `import triton`; the PyPI wheel installs cleanly
# on Linux x86_64 even without CUDA (same rationale as
# consolidated-tests-ci.yml line 192-198).
# consolidated-tests-ci.yml line 192-205).
# Pillow is listed explicitly as a defensive belt-and-braces
# next to torchvision (vision_utils crashes ModuleNotFoundError
# if torchvision skipped its Pillow dep for any reason).
pip install 'transformers>=4.56,<5.6' 'trl>=0.22,<0.26' 'accelerate>=1.0' \
'datasets>=3.4,<5' 'peft>=0.15,<0.20' \
'bitsandbytes>=0.43' 'sentencepiece' 'protobuf' triton
'bitsandbytes>=0.43' 'sentencepiece' 'protobuf' triton \
Pillow safetensors tqdm packaging psutil
# Converter deps (nbformat for notebook_to_python.py).
pip install 'nbformat>=5.10' 'nbconvert>=7.16'
pip install --no-deps unsloth_zoo unsloth