Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Give the Colab freeze a pip cache, like the job beside it already has (#9276)

Daniel Han51b7d4a155e1
diff --git a/.github/workflows/notebooks-ci.yml b/.github/workflows/notebooks-ci.yml
index 0e06038e65f..0303089a477 100644
--- a/.github/workflows/notebooks-ci.yml
+++ b/.github/workflows/notebooks-ci.yml
@@ -421,6 +421,25 @@ jobs:
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with: { python-version: '3.12' }
+ - name: Restore the pip cache
+ id: pip-cache
+ # ./ resolves from GITHUB_WORKSPACE, and this job checks the repo out
+ # under `unsloth/`, so the unprefixed path is a directory that does not
+ # exist and the step fails with "Can't find 'action.yml'".
+ uses: ./unsloth/.github/actions/pip-cache-restore
+ with:
+ # The freeze is the pin set, so it is what the downloads depend on. The
+ # workflow comes too because the seed step rewrites those pins in place
+ # -- CPU index mapping, skips, spoofs -- so an edit there changes what
+ # gets installed without touching the freeze.
+ #
+ # api-introspect above keys on the workflow alone because it pins inline.
+ # This job does not, and keying it on the workflow alone would rebuild
+ # 709 downloads for an unrelated edit to any other job in this file.
+ key-files: |
+ unsloth/scripts/data/colab_pip_freeze.gpu.txt
+ unsloth/.github/workflows/notebooks-ci.yml
+
- name: Seed Colab-shaped venv from pip-freeze (CPU-mapped)
run: |
# Strip cu128 local versions, route torch/torchvision to the CPU
@@ -479,6 +498,17 @@ jobs:
done < /tmp/seed_pins.txt
fi
+ - name: Save the pip cache
+ if: always()
+ # always(), because the fallback path is exactly when the cache is worth
+ # most: it installs 709 pins one at a time, and a partial download set is
+ # still a head start on the next run.
+ uses: ./unsloth/.github/actions/pip-cache-save
+ with:
+ dir: ${{ steps.pip-cache.outputs.dir }}
+ key: ${{ steps.pip-cache.outputs.key }}
+ cache-hit: ${{ steps.pip-cache.outputs.cache-hit }}
+
- name: Run install cell
run: |
python unsloth/scripts/notebook_validator.py convert \
diff --git a/tests/studio/test_cache_budget_discipline.py b/tests/studio/test_cache_budget_discipline.py
index edc02937ef8..61689e9fffe 100644
--- a/tests/studio/test_cache_budget_discipline.py
+++ b/tests/studio/test_cache_budget_discipline.py
@@ -66,6 +66,11 @@ PIP_CACHE_JOBS = {
("consolidated-tests-ci.yml", "llama-cpp-smoke"),
("mlx-ci.yml", "dispatch"),
("notebooks-ci.yml", "api-introspect"),
+ # Installs a 709-line Colab pip-freeze, eight matrix legs at once, and each leg
+ # downloads the identical set. It is cron and dispatch only, so none of that is
+ # on a pull request's critical path -- but eight ubuntu runners holding a 25
+ # minute cap contend for the same pool every other job queues against.
+ ("notebooks-ci.yml", "smoke-install"),
("studio-backend-ci.yml", "pytest"),
("studio-backend-ci.yml", "repo-cpu-tests"),
("studio-export-capability-ci.yml", "capability"),