diff --git a/studio/Unsloth_Studio_Colab.ipynb b/studio/Unsloth_Studio_Colab.ipynb index 46e2067ba7..c3aec04820 100644 --- a/studio/Unsloth_Studio_Colab.ipynb +++ b/studio/Unsloth_Studio_Colab.ipynb @@ -64,7 +64,7 @@ "id": "27e68f91" }, "outputs": [], - "source": "!git clone --depth 1 --branch main https://github.com/unslothai/unsloth.git\n%cd /content/unsloth\n!chmod +x studio/setup.sh && ./studio/setup.sh" + "source": "!git clone --depth 1 --branch main https://github.com/unslothai/unsloth.git\n%cd /content/unsloth\n!chmod +x studio/setup.sh && ./studio/setup.sh --local" }, { "cell_type": "markdown", diff --git a/studio/install_python_stack.py b/studio/install_python_stack.py index 8ac59d389d..25d950fd3e 100644 --- a/studio/install_python_stack.py +++ b/studio/install_python_stack.py @@ -972,6 +972,7 @@ def install_python_stack() -> int: req = REQ_ROOT / "no-torch-runtime.txt", ) if local_repo: + _step(_LABEL, f"overlaying local repo (editable): {local_repo}") pip_install( "Overlaying local repo (editable)", "--no-cache-dir", @@ -980,6 +981,15 @@ def install_python_stack() -> int: local_repo, constrain = False, ) + _step(_LABEL, "overlaying unsloth-zoo from git main") + pip_install( + "Overlaying unsloth-zoo from git main", + "--no-cache-dir", + "--no-deps", + "--force-reinstall", + "unsloth-zoo @ git+https://github.com/unslothai/unsloth-zoo", + constrain = False, + ) elif local_repo: # Local dev install: update deps from base.txt, then overlay the # local checkout as an editable install (--no-deps so torch is @@ -994,6 +1004,7 @@ def install_python_stack() -> int: "unsloth-zoo", req = REQ_ROOT / "base.txt", ) + _step(_LABEL, f"overlaying local repo (editable): {local_repo}") pip_install( "Overlaying local repo (editable)", "--no-cache-dir", @@ -1002,6 +1013,15 @@ def install_python_stack() -> int: local_repo, constrain = False, ) + _step(_LABEL, "overlaying unsloth-zoo from git main") + pip_install( + "Overlaying unsloth-zoo from git main", + "--no-cache-dir", + "--no-deps", + "--force-reinstall", + "unsloth-zoo @ git+https://github.com/unslothai/unsloth-zoo", + constrain = False, + ) elif package_name != "unsloth": # Custom package name (e.g. roland-sloth for testing) — install directly _progress("base packages") diff --git a/studio/setup.sh b/studio/setup.sh index 142d253554..9575f143d5 100755 --- a/studio/setup.sh +++ b/studio/setup.sh @@ -8,6 +8,21 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" RULE=$(printf '\342\224\200%.0s' {1..52}) +# ── Parse flags ── +# --local: install from the local repo checkout (overlays unsloth as editable +# and unsloth-zoo from git main). Mirrors install.sh --local for the Colab +# path that runs setup.sh directly without going through install.sh. +if [ "$#" -gt 0 ]; then + for _arg in "$@"; do + case "$_arg" in + --local) + export STUDIO_LOCAL_INSTALL=1 + export STUDIO_LOCAL_REPO="$REPO_ROOT" + ;; + esac + done +fi + # ── Maintainer-editable defaults ────────────────────────────────────────── # Change these in the GitHub-hosted script so all users get updated defaults. # User environment variables always override these baked-in values. @@ -170,6 +185,9 @@ _LLAMA_ONLY="${UNSLOTH_STUDIO_LLAMA_ONLY:-0}" if [ "$_LLAMA_ONLY" = "1" ]; then substep "llama.cpp only mode" fi +if [ "${STUDIO_LOCAL_INSTALL:-0}" = "1" ]; then + substep "local mode: overlaying $REPO_ROOT (editable) + unsloth-zoo from git main" +fi # ── Clean up stale caches ── rm -rf "$REPO_ROOT/unsloth_compiled_cache" rm -rf "$SCRIPT_DIR/backend/unsloth_compiled_cache"