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
fix: reconfigure stdout to UTF-8 on Windows to prevent UnicodeEncodeError on startup (#4493)
Velsa981f477e31bd
diff --git a/studio/backend/run.py b/studio/backend/run.pyindex 5388d3148b4..2d86f705783 100644--- a/studio/backend/run.py+++ b/studio/backend/run.py@@ -175,6 +175,14 @@ def run_server("""global _server, _shutdown_event+ # On Windows the default console encoding (cp1252) cannot encode emoji.+ # Reconfigure stdout to UTF-8 so startup messages do not crash the server.+ if sys.platform == "win32" and hasattr(sys.stdout, "reconfigure"):+ try:+ sys.stdout.reconfigure(encoding = "utf-8", errors = "replace")+ except Exception:+ pass+import nest_asyncionest_asyncio.apply()diff --git a/unsloth_cli/commands/studio.py b/unsloth_cli/commands/studio.pyindex 8a2267a79eb..c4008aa4a6c 100644--- a/unsloth_cli/commands/studio.py+++ b/unsloth_cli/commands/studio.py@@ -133,12 +133,10 @@ def studio_default(display_host = _resolve_external_ip() if host == "0.0.0.0" else hosttyper.echo(f"Starting Unsloth Studio on http://{display_host}:{port}")- run_server(- host = host,- port = port,- frontend_path = frontend,- silent = silent,- )+ run_kwargs = dict(host = host, port = port, silent = silent)+ if frontend is not None:+ run_kwargs["frontend_path"] = frontend+ run_server(**run_kwargs)from studio.backend.run import _shutdown_eventdiff --git a/unsloth_cli/commands/ui.py b/unsloth_cli/commands/ui.pyindex 4457465e968..8f766369908 100644--- a/unsloth_cli/commands/ui.py+++ b/unsloth_cli/commands/ui.py@@ -80,18 +80,19 @@ def ui(display_host = _resolve_external_ip() if host == "0.0.0.0" else hosttyper.echo(f"Starting Unsloth Studio on http://{display_host}:{port}")- run_server(- host = host,- port = port,- frontend_path = frontend,- silent = silent,- )+ run_kwargs = dict(host = host, port = port, silent = silent)+ if frontend is not None:+ run_kwargs["frontend_path"] = frontend+ run_server(**run_kwargs)from studio.backend.run import _shutdown_eventtry:if _shutdown_event is not None:- _shutdown_event.wait()+ # NOTE: Event.wait() without a timeout blocks at the C level+ # on Linux, preventing Python from delivering SIGINT (Ctrl+C).+ while not _shutdown_event.is_set():+ _shutdown_event.wait(timeout = 1)else:while True:time.sleep(1)