#!/usr/bin/env bash # SPDX-License-Identifier: AGPL-3.0-only # Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0 set -euo pipefail 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. # # _DEFAULT_LLAMA_PR_FORCE : PR number to build by default ("" = normal path) # _DEFAULT_LLAMA_SOURCE : git clone URL for source builds # _DEFAULT_LLAMA_TAG : llama.cpp ref to build ("latest" = newest release, # "master" = bleeding-edge, "bNNNN" = specific tag) # Prefer "latest" over "master" -- "master" bypasses # the prebuilt resolver (no matching GitHub release), # forces a source build, and causes HTTP 422 errors. # Only use "master" temporarily when the latest release # is missing support for a new model architecture. # ────────────────────────────────────────────────────────────────────────── _DEFAULT_LLAMA_PR_FORCE="" _DEFAULT_LLAMA_SOURCE="https://github.com/ggml-org/llama.cpp" _DEFAULT_LLAMA_TAG="latest" _DEFAULT_LLAMA_FORCE_COMPILE_REF="master" # ── Colors (same palette as startup_banner / install_python_stack) ── if [ -n "${NO_COLOR:-}" ]; then C_TITLE= C_DIM= C_OK= C_WARN= C_ERR= C_RST= elif [ -t 1 ] || [ -n "${FORCE_COLOR:-}" ]; then C_TITLE=$'\033[38;5;150m' C_DIM=$'\033[38;5;245m' C_OK=$'\033[38;5;108m' C_WARN=$'\033[38;5;136m' C_ERR=$'\033[91m' C_RST=$'\033[0m' else C_TITLE= C_DIM= C_OK= C_WARN= C_ERR= C_RST= fi # ── Output helpers ── # Consistent column layout: 2-space indent, 15-char label (fits llama-quantize), then value. # Usage: step