tests: anchor the gguf ordering assertion on the branch that owns the marker (#7443)
_load_model_impl contains more than one
if config.is_gguf:, so source.index() returned the earlier one, which belongs to a different check than the branch the assertion is reasoning about. The inheritance call sits at line 4543, the earlier branch at 4508 and the branch holding the load marker at 4567, so the comparison read 186995 < 185014 and failed on main.The branch is now located from the load marker itself, which is the landmark the rest of the test already relies on, so the assertion compares the inheritance call against the branch that actually guards it. The slice used by the following assertions is anchored the same way, which also tightens them: they previously searched from the earlier branch to end of file.
The invariant is unchanged and still has teeth: moving the inheritance call after the branch makes the assertion fail.
Co-authored-by: danielhanchen unslothai@gmail.com
版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9
京公网安备 11010802047560号
Unsloth Studio lets you run and train models locally.
Features • News • Quickstart • Notebooks • Documentation
⚡ Get started
macOS, Linux, WSL:
Windows:
Community:
⭐ Features
Unsloth Studio (Beta) lets you run and train text, audio, embedding, vision models on Windows, Linux and macOS.
Inference
/v1/chat/completions,/v1/responsesand/v1/messages.unsloth startwith Claude Code, Codex, Hermes and more.Training
🚀 Unsloth Start
Unsloth Start connects Claude Code, Codex and other agents to local models with one command.
Start Unsloth, load a model, open your project folder, then run:
Replace
claudewith any supported agent:unsloth start claudeunsloth start codexunsloth start hermesunsloth start openclawunsloth start opencodeunsloth start piClaude Code, Codex, OpenCode and Pi can keep their current model and use Unsloth as a local subagent:
📥 Install
Unsloth can be used in two ways: through Unsloth Studio, the web UI, or through Unsloth Core, the code-based version. Each has different requirements.
Unsloth Studio (web UI)
Unsloth Studio (Beta) works on Windows, Linux, WSL and macOS.
macOS, Linux, WSL:
Use the same command to update.
Windows:
Use the same command to update.
Launch
For LAN or cloud access, add
-H 0.0.0.0(raw port only; add--cloudflarefor a public URL). By default, Unsloth is accessible only locally.To reach Unsloth over HTTPS, use
unsloth studio --secure. Unsloth stays bound to localhost and is reached only through a free Cloudflare tunnel, which publishes it at a publichttps://*.trycloudflare.comURL (it fails closed if the tunnel can’t start, so the raw port is never exposed). This makes Unsloth reachable from the internet, so anyone with the link and API key can use it and run code: keep your API key private (see Remote access below).Docker
Use our Docker image
unsloth/unslothcontainer. Run:Developer, Nightly, Uninstall
To see developer, nightly and uninstallation etc. instructions, see advanced installation.
Unsloth Core (code-based)
Linux, WSL:
Windows:
For Windows,
pip install unslothworks only if you have PyTorch installed. Read our Windows Guide. You can use the same Docker image as Unsloth Studio.AMD, Intel:
For RTX 50x, B200, 6000 GPUs:
uv pip install unsloth --torch-backend=auto. Read our guides for: Blackwell and DGX Spark.To install Unsloth on AMD and Intel GPUs, follow our AMD Guide and Intel Guide.
📒 Free Notebooks
Train for free with our notebooks. You can use our new free Unsloth Studio notebook to run and train models for free in a web UI. Read our guide. Add dataset, run, then deploy your trained model.
🦥 Unsloth News
unsloth startwith Claude Code, Codex, Hermes, OpenCode, OpenClaw, Pi and more through Unsloth’s OpenAI- and Anthropic-compatible APIs. Guide📥 Advanced Installation
The below advanced instructions are for Unsloth Studio. For Unsloth Core advanced installation, view our docs.
Developer / Nightly / Experimental installs: macOS, Linux, WSL:
The developer install builds from the
mainbranch, which is the latest (nightly) source.To install into an isolated location (its own virtual env,
auth/,studio.db, cache and llama.cpp build), setUNSLOTH_STUDIO_HOMEand pass it again at launch:Then to update :
Developer / Nightly / Experimental installs: Windows PowerShell:
The developer install builds from the
mainbranch, which is the latest (nightly) source.To install into an isolated location (its own virtual env,
auth/,studio.db, cache and llama.cpp build), setUNSLOTH_STUDIO_HOMEand pass it again at launch:Then to update :
Remote access:
--secure(HTTPS tunnel) vs raw portBy default
unsloth studiobinds to127.0.0.1(this machine only). To reach it from another device, pick one of:--secure(recommended): serve only through a free Cloudflare HTTPS link. Unsloth stays bound to localhost and the tunnel provides the public URL; it fails closed (does not start) if the tunnel can’t come up, so the raw port is never exposed.-H 0.0.0.0: bind the raw port on all network interfaces, reachable from anywhere on the network (subject to your firewall). It does not create a public internet URL; add--cloudflareto also publish an internet-reachablehttps://*.trycloudflare.comlink even behind a firewall. Only use this on a network you trust. The Cloudflare tunnel is off by default:-H 0.0.0.0exposes the raw port only, not a public internet URL. Pair the wildcard bind with--cloudflare(unsloth studio -H 0.0.0.0 --cloudflare) to also publish a publichttps://*.trycloudflare.comlink, or prefer--secure(above), which keeps the raw port private.--cloudflarehas no effect on a loopback bind.The first time Unsloth is published on a public URL (
--secureor--cloudflare) with the auto-generated admin password still in place, it asks for a new admin password in the terminal (masked input with confirmation) before the public link goes up. Without an attached terminal it warns instead and keeps the bootstrap deadline: Unsloth shuts down afterUNSLOTH_STUDIO_BOOTSTRAP_TIMEOUT(default 1 hour) unless the password is changed in the web UI.For headless setups that cannot answer that prompt, set the initial admin password non-interactively with
--password(only takes effect when no password is set yet; if one already exists it is a hard error, so rotate later withunsloth studio reset-password):A literal
--password VALUEis visible in the process list and shell history, so prefer theUNSLOTH_STUDIO_PASSWORDenv var or--password -(stdin) for automation. This applies to any launch (public or a headless-H 0.0.0.0bind), and the password is set in the parent before the server binds, so it never reaches a re-executed child process.Server-side tools (web search, Python and terminal code execution) run as your user and are on by default. Anyone who can reach the server with the API key can run code on this machine, so keep your API key private and pass
--disable-toolswhen exposing Unsloth.Advanced launch options
Installer options can be passed as environment variables. On macOS, Linux and WSL place the variable after the pipe so the shell passes it to
sh; on Windows set it with$env:before piping toiex.Skip PyTorch (GGUF-only mode):
Skip the post-install prompt that starts Unsloth (useful for automated installs):
Pin the Python version:
Install to a custom location with
UNSLOTH_STUDIO_HOME:On macOS, the installer defaults to the system certificate store (
UV_SYSTEM_CERTS=1) so uv trusts the CAs in your Keychain, needed behind TLS-inspecting proxies (Cisco Umbrella, Zscaler, etc.). Opt out with:Point the frontend build at a corporate npm mirror/proxy with
UNSLOTH_NPM_REGISTRY(for the developer install behind a firewall that blocksregistry.npmjs.org):It is threaded as
--registryinto the Unsloth frontendnpm/buninstalls; the supply-chain locks (7-daymin-release-age, exact version pins) stay in force.Cap Unsloth’s native CPU thread pools on high-core hosts:
UNSLOTH_CPU_THREADS=8 unsloth studio -p 8888.Uninstall
The recommended way to fully remove Unsloth Studio is the matching uninstall script for your OS. It stops any running servers, removes the install dir, the launcher data dir, the desktop shortcut, and any platform-specific entries (macOS
.appbundle + Launch Services on Mac; Start Menu,HKCU\Software\Unslothregistry key and userPATHentries on Windows):curl -fsSL https://raw.githubusercontent.com/unslothai/unsloth/main/scripts/uninstall.sh | shirm https://raw.githubusercontent.com/unslothai/unsloth/main/scripts/uninstall.ps1 | iexIf you only want to drop the install dir and keep the launcher/shortcut for a later reinstall, you can instead run
rm -rf ~/.unsloth/studio(Mac/Linux/WSL) orRemove-Item -Recurse -Force "$HOME\.unsloth\studio"(Windows). The model cache at~/.cache/huggingfaceis not touched by any of these.For more info, see our docs.
Deleting model files
You can delete old model files either from the bin icon in model search or by removing the relevant cached model folder from the default Hugging Face cache directory. By default, HF uses:
~/.cache/huggingface/hub/%USERPROFILE%\.cache\huggingface\hub\💚 Community and Links
Citation
You can cite the Unsloth repo as follows:
If you trained a model with 🦥Unsloth, you can use this cool sticker!
License
Unsloth uses a dual-licensing model of Apache 2.0 and AGPL-3.0. The core Unsloth package remains licensed under Apache 2.0, while certain optional components, such as the Unsloth Studio UI are licensed under the open-source license AGPL-3.0.
This structure helps support ongoing Unsloth development while keeping the project open source and enabling the broader ecosystem to continue growing.
Thank You to