Skip to content

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.

migrated cli. fixed imports. fixed unsloth studio command logic

Roland Tannous55eb0bb66a4f
diff --git a/cli/commands/export.py b/cli/commands/export.py
index 6ed59639ecd..375b6902bad 100644
--- a/cli/commands/export.py
+++ b/cli/commands/export.py
@@ -14,7 +14,7 @@ def list_checkpoints(
),
):
"""List checkpoints detected in the outputs directory."""
- from backend.export import ExportBackend
+ from studio.backend.core.export import ExportBackend
backend = ExportBackend()
checkpoints = backend.scan_checkpoints(outputs_dir=str(outputs_dir))
@@ -65,7 +65,7 @@ def export(
typer.echo("Error: --repo-id required when using --push-to-hub", err=True)
raise typer.Exit(code=2)
- from backend.export import ExportBackend
+ from studio.backend.core.export import ExportBackend
backend = ExportBackend()
typer.echo(f"Loading checkpoint: {checkpoint}")
diff --git a/cli/commands/inference.py b/cli/commands/inference.py
index bef0a2c4ee2..83928b2dbcc 100644
--- a/cli/commands/inference.py
+++ b/cli/commands/inference.py
@@ -24,8 +24,7 @@ def inference(
load_in_4bit: bool = typer.Option(True, "--load-in-4bit/--no-load-in-4bit"),
):
"""Run a single inference using the specified model."""
- from backend.model_config import ModelConfig
- from backend.inference import get_inference_backend
+ from studio.backend.core import ModelConfig, get_inference_backend
inference_backend = get_inference_backend()
model_config = ModelConfig.from_ui_selection(
diff --git a/cli/commands/train.py b/cli/commands/train.py
index 900a345536c..5941cfa5c3b 100644
--- a/cli/commands/train.py
+++ b/cli/commands/train.py
@@ -78,7 +78,7 @@ def train(
)
raise typer.Exit(code=2)
- from backend.trainer import UnslothTrainer
+ from studio.backend.core.training import UnslothTrainer
trainer = UnslothTrainer()
diff --git a/cli/commands/ui.py b/cli/commands/ui.py
index cbd8194b522..aee2d21d085 100644
--- a/cli/commands/ui.py
+++ b/cli/commands/ui.py
@@ -1,19 +1,32 @@
+import time
+from pathlib import Path
+from typing import Optional
+
import typer
def ui(
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:
+ typer.echo(f"Starting Unsloth UI on http://{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...")