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.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Make the startup profile a gate, with budgets from its own measurements (#8965)
Daniel Han926f76542fe7
diff --git a/.github/workflows/startup-profile-ci.yml b/.github/workflows/startup-profile-ci.ymlindex 023aae9d1b1..403c433b722 100644--- a/.github/workflows/startup-profile-ci.yml+++ b/.github/workflows/startup-profile-ci.yml@@ -9,8 +9,27 @@# the server can bind, dominated by eager module-level imports pulled in by routes:# torch ~1.9s self, unsloth_zoo ~0.8s, routes ~0.6s, transformers ~0.5s.#-# Not a gate yet: --max-healthz-seconds exists, but a budget should come from-# observed numbers rather than a guess.+# Now a gate. The budgets below come from this workflow's own history rather than a+# guess: 33 completed runs, 99 profiles, 297 launches, no failed launch. Median time to+# a healthy port was 3.24s on ubuntu, 3.02s on macos, 5.11s on windows.+#+# Sized for a slow runner, not for the median one. A hosted runner can be slow for a+# whole run: macos-15 in run 31932608086 came in at 5.03/5.52/5.66s, 1.8x its own+# median, on a PR that changed nothing here. So each budget is 2x the observed median+# rounded up to the next half second, floored at 1.4x the slowest median seen. Anything+# tighter fails unrelated PRs on runner luck.+#+# What that catches is a torch-sized regression, about 5s, not a 1-2s one. A 2.2s+# regression of the pandas kind shows up in the import table in the job summary, which+# is what found it; the gate is here to stop the catastrophic case, not to measure.+#+# Raise a budget in the same PR as the import that needed it, with the run that shows+# it, exactly as with the frontend startup budget.+#+# Do not make this a required status check while it is filtered by paths. A workflow+# skipped by path filtering never reports, so a required check on it sits Pending and+# blocks every PR that does not touch the list below:+# https://docs.github.com/en/pull-requests/how-tos/merge-and-close-pull-requests/troubleshooting-required-status-checksname: Startup profile@@ -60,11 +79,18 @@ jobs:name: startup ${{ matrix.os }}runs-on: ${{ matrix.os }}timeout-minutes: 60- continue-on-error: truestrategy:fail-fast: falsematrix:- os: [ubuntu-latest, macos-15, windows-latest]+ # Per the header rule. Slowest median seen in 33 runs, which is what the 1.4x+ # floor is taken from: ubuntu 3.52s, macos 5.52s, windows 5.55s.+ include:+ - os: ubuntu-latest+ max_healthz_seconds: '6.5'+ - os: macos-15+ max_healthz_seconds: '8.0'+ - os: windows-latest+ max_healthz_seconds: '10.5'env:UNSLOTH_STUDIO_HOME: ${{ github.workspace }}/.studio-home@@ -94,6 +120,11 @@ jobs:- name: Profile startupshell: bashrun: |+ # Explicit rather than load-bearing: `shell: bash` already runs+ # `bash --noprofile --norc -eo pipefail {0}`. Written out because the gate's+ # exit code reaches this step only through the pipe into tee, so it has to+ # survive the shell key being dropped or changed to `bash {0}`.+ set -o pipefailBIN="$UNSLOTH_STUDIO_HOME/unsloth_studio/bin/unsloth"[ -x "$BIN" ] || BIN="$UNSLOTH_STUDIO_HOME/unsloth_studio/Scripts/unsloth.exe"[ -x "$BIN" ] || BIN=""@@ -105,6 +136,7 @@ jobs:--python "$PY" \${BIN:+--bin "$BIN"} \--repeats "${{ inputs.repeats || '3' }}" \+ --max-healthz-seconds "${{ matrix.max_healthz_seconds }}" \--json "startup-${{ matrix.os }}.json" 2>&1 | tee logs/profile.log- name: Summarydiff --git a/tests/test_profile_startup_gate.py b/tests/test_profile_startup_gate.pyindex 66e6e16a89d..297eb03b90d 100644--- a/tests/test_profile_startup_gate.py+++ b/tests/test_profile_startup_gate.py@@ -241,3 +241,48 @@ def test_terminate_tree_posix_uses_terminate():proc = _Proc()mod._terminate_tree(proc)assert proc.terminated+++# ---------------------------------------------------------------------------+# The budget is only a gate if the workflow asks for it and can see it fail+# ---------------------------------------------------------------------------+++def _profile_job() -> dict:+ wf = yaml.safe_load(WORKFLOW.read_text(encoding = "utf-8"))+ return wf["jobs"]["profile"]+++def _profile_step() -> dict:+ for step in _profile_job()["steps"]:+ if step.get("name") == "Profile startup":+ return step+ raise AssertionError("no 'Profile startup' step in the workflow")+++def test_every_platform_carries_a_budget():+ """A matrix entry without one would profile and assert nothing."""+ entries = _profile_job()["strategy"]["matrix"]["include"]+ assert entries, "the matrix no longer lists platforms by include"+ for entry in entries:+ budget = entry.get("max_healthz_seconds")+ assert budget, f"{entry.get('os')} has no max_healthz_seconds"+ assert float(budget) > 0+++def test_the_profile_step_passes_the_budget():+ assert "--max-healthz-seconds" in _profile_step()["run"]+++def test_the_profile_step_sets_pipefail():+ """`shell: bash` already implies -o pipefail, so this is belt and braces: the+ gate's exit code only reaches the step through the pipe into tee, and it has to+ survive that shell key being dropped or changed to `bash {0}`."""+ run = _profile_step()["run"]+ assert "| tee" in run, "no pipe left; this guard can go"+ assert "set -o pipefail" in run+++def test_the_job_is_not_advisory():+ """continue-on-error would let the gate fail without failing the check."""+ assert _profile_job().get("continue-on-error") is not True