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
rename cli studio command to use new FastAPI backend and add unsloth-ui alias for backwards compatibility
Roland Tannousd486a2ef6f17
diff --git a/cli/commands/studio.py b/cli/commands/studio.pyindex 4287c756a8c..2489676844d 100644--- a/cli/commands/studio.py+++ b/cli/commands/studio.py@@ -1,19 +1,34 @@+import time+from pathlib import Path+from typing import Optional+import typerdef studio(port: int = typer.Option(8000, "--port", "-p", help="Port to run the UI server on."),host: str = typer.Option("0.0.0.0", "--host", "-H", help="Host address to bind to."),- share: bool = typer.Option(True, "--share", "-s", help="Create a public Gradio share link."),+ frontend: Optional[Path] = typer.Option(None, "--frontend", "-f", help="Path to frontend build directory."),+ silent: bool = typer.Option(False, "--silent", "-q", help="Suppress startup messages."),):- """Launch the Unsloth web UI for training, inference, and export."""- from app import demo, script_dir+ """Launch the Unsloth web UI backend server."""+ from studio.backend.run import run_server- typer.echo(f"Starting Unsloth UI on http://{host}:{port}")+ if not silent:+ from studio.backend.run import _resolve_external_ip+ display_host = _resolve_external_ip() if host == "0.0.0.0" else host+ typer.echo(f"Starting Unsloth Studio on http://{display_host}:{port}")- demo.launch(- share=share,- server_port=port,- server_name=host,- favicon_path=f"{script_dir}/assets/favicon-32x32.png",+ run_server(+ host=host,+ port=port,+ frontend_path=frontend,+ silent=silent,)++ # Keep running until interrupted+ try:+ while True:+ time.sleep(1)+ except KeyboardInterrupt:+ typer.echo("\nShutting down...")diff --git a/setup.sh b/setup.shindex c493d357ee6..5f7d96eff34 100755--- a/setup.sh+++ b/setup.sh@@ -212,38 +212,38 @@ USER_SHELL="$(basename "${SHELL:-/bin/bash}")"case "$USER_SHELL" inzsh)SHELL_RC="$HOME/.zshrc"- ALIAS_BLOCK="alias unsloth-ui='${REPO_DIR}/.venv/bin/python ${REPO_DIR}/cli.py ui -f ${REPO_DIR}/studio/frontend/dist'"+ ALIAS_BLOCK="alias unsloth-studio='${REPO_DIR}/.venv/bin/python ${REPO_DIR}/cli.py studio -f ${REPO_DIR}/studio/frontend/dist'";;fish)SHELL_RC="$HOME/.config/fish/config.fish"# fish uses 'abbr' or 'function'; a simple alias works via 'alias' in config.fish- ALIAS_BLOCK="alias unsloth-ui '${REPO_DIR}/.venv/bin/python ${REPO_DIR}/cli.py ui -f ${REPO_DIR}/studio/frontend/dist'"+ ALIAS_BLOCK="alias unsloth-studio '${REPO_DIR}/.venv/bin/python ${REPO_DIR}/cli.py studio -f ${REPO_DIR}/studio/frontend/dist'";;ksh)SHELL_RC="$HOME/.kshrc"- ALIAS_BLOCK="alias unsloth-ui='${REPO_DIR}/.venv/bin/python ${REPO_DIR}/cli.py ui -f ${REPO_DIR}/studio/frontend/dist'"+ ALIAS_BLOCK="alias unsloth-studio='${REPO_DIR}/.venv/bin/python ${REPO_DIR}/cli.py studio -f ${REPO_DIR}/studio/frontend/dist'";;*)# Default to bash for bash and any other POSIX-compatible shellSHELL_RC="$HOME/.bashrc"- ALIAS_BLOCK="alias unsloth-ui='${REPO_DIR}/.venv/bin/python ${REPO_DIR}/cli.py ui -f ${REPO_DIR}/studio/frontend/dist'"+ ALIAS_BLOCK="alias unsloth-studio='${REPO_DIR}/.venv/bin/python ${REPO_DIR}/cli.py studio -f ${REPO_DIR}/studio/frontend/dist'";;esacecho " Detected shell: $USER_SHELL → $SHELL_RC"ALIAS_ADDED=false-if ! grep -qF "unsloth-ui" "$SHELL_RC" 2>/dev/null; then+if ! grep -qF "unsloth-studio" "$SHELL_RC" 2>/dev/null; thenmkdir -p "$(dirname "$SHELL_RC")" # needed for fish's nested config pathcat >> "$SHELL_RC" <<UNSLOTH_EOF# Unsloth Studio launcher$ALIAS_BLOCKUNSLOTH_EOF- echo "✅ Alias 'unsloth-ui' added to $SHELL_RC"+ echo "✅ Alias 'unsloth-studio' added to $SHELL_RC"ALIAS_ADDED=trueelse- echo "✅ Alias 'unsloth-ui' already exists in $SHELL_RC"+ echo "✅ Alias 'unsloth-studio' already exists in $SHELL_RC"fifi # End of "if not Colab" for shell alias setup@@ -267,6 +267,6 @@ elseecho "║ Launch with: ║"fiecho "║ ║"- echo "║ unsloth-ui -H 0.0.0.0 -p 8000 ║"+ echo "║ unsloth-studio -H 0.0.0.0 -p 8000 ║"echo "╚══════════════════════════════════════╝"fi