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.

Make UNSLOTH_STUDIO_KEEP_LEGACY=0 work through docker/run.sh (#13488)

Nilay3eef688ed062
diff --git a/docker/run.sh b/docker/run.sh
index a95c0f28df7..b16a1edf603 100755
--- a/docker/run.sh
+++ b/docker/run.sh
@@ -358,13 +358,14 @@ declare -a ENV_FORWARD=(-e HF_HUB_ENABLE_HF_TRANSFER=1)
# gfx overrides for cards the installed ROCm build has no kernels for
[[ -n "${HSA_OVERRIDE_GFX_VERSION:-}" ]] && ENV_FORWARD+=(-e HSA_OVERRIDE_GFX_VERSION)
[[ -n "${UNSLOTH_ROCM_GFX_ARCH:-}" ]] && ENV_FORWARD+=(-e UNSLOTH_ROCM_GFX_ARCH)
-# read by studio_launch.sh; without these it uses a random password and no sshd
+# studio_launch.sh generates passwords when unset and enables sshd only when a key is forwarded
[[ -n "${JUPYTER_PASSWORD:-}" ]] && ENV_FORWARD+=(-e JUPYTER_PASSWORD)
[[ -n "${JUPYTER_PORT:-}" ]] && ENV_FORWARD+=(-e JUPYTER_PORT)
[[ -n "${UNSLOTH_STUDIO_PASSWORD:-}" ]] && ENV_FORWARD+=(-e UNSLOTH_STUDIO_PASSWORD)
[[ -n "${UNSLOTH_STUDIO_PORT:-}" ]] && ENV_FORWARD+=(-e UNSLOTH_STUDIO_PORT)
[[ -n "${UNSLOTH_STUDIO_BOOTSTRAP_TIMEOUT:-}" ]] && ENV_FORWARD+=(-e UNSLOTH_STUDIO_BOOTSTRAP_TIMEOUT)
-# both, or raising only the shutdown budget waits on a save the watchdog kills at its own cap
+[[ -n "${UNSLOTH_STUDIO_KEEP_LEGACY:-}" ]] && ENV_FORWARD+=(-e UNSLOTH_STUDIO_KEEP_LEGACY)
+# raise both timeouts; otherwise the watchdog can kill a save before the shutdown budget expires
[[ -n "${UNSLOTH_STUDIO_SHUTDOWN_STOP_TIMEOUT_S:-}" ]] && ENV_FORWARD+=(-e UNSLOTH_STUDIO_SHUTDOWN_STOP_TIMEOUT_S)
[[ -n "${UNSLOTH_STUDIO_TRAINING_STOP_TIMEOUT_S:-}" ]] && ENV_FORWARD+=(-e UNSLOTH_STUDIO_TRAINING_STOP_TIMEOUT_S)
[[ -n "${PUBLIC_KEY:-}" ]] && ENV_FORWARD+=(-e PUBLIC_KEY)
@@ -372,9 +373,7 @@ declare -a ENV_FORWARD=(-e HF_HUB_ENABLE_HF_TRANSFER=1)
[[ -n "${UNSLOTH_JUPYTER_CLOUDFLARE:-}" ]] && ENV_FORWARD+=(-e UNSLOTH_JUPYTER_CLOUDFLARE)
[[ -n "${UNSLOTH_SKIP_NOTEBOOK_SYNC:-}" ]] && ENV_FORWARD+=(-e UNSLOTH_SKIP_NOTEBOOK_SYNC)
[[ -n "${UNSLOTH_SKIP_NOTEBOOK_REFRESH:-}" ]] && ENV_FORWARD+=(-e UNSLOTH_SKIP_NOTEBOOK_REFRESH)
-# Studio's two exposure modes, read by studio_run.sh inside the container. The
-# allowlist is explicit, so leaving them out made both silently inert through the
-# helper the documentation recommends.
+# Studio exposure modes need explicit allowlisting or they remain inert in the documented helper
[[ -n "${UNSLOTH_STUDIO_SECURE:-}" ]] && ENV_FORWARD+=(-e UNSLOTH_STUDIO_SECURE)
[[ -n "${UNSLOTH_STUDIO_CLOUDFLARE:-}" ]] && ENV_FORWARD+=(-e UNSLOTH_STUDIO_CLOUDFLARE)
diff --git a/tests/python/test_docker_run_env_forward.py b/tests/python/test_docker_run_env_forward.py
index 55bd6e0b30f..f0d5d2de4cf 100644
--- a/tests/python/test_docker_run_env_forward.py
+++ b/tests/python/test_docker_run_env_forward.py
@@ -86,3 +86,7 @@ def test_every_documented_variable_reaches_the_container(tmp_path, name):
@pytest.mark.parametrize("name", DOCUMENTED)
def test_an_unset_variable_is_not_forwarded(tmp_path, name):
assert name not in _forwarded(tmp_path)
+
+
+def test_keep_legacy_reaches_the_container(tmp_path):
+ assert "UNSLOTH_STUDIO_KEEP_LEGACY" in _forwarded(tmp_path, UNSLOTH_STUDIO_KEEP_LEGACY = "0")