From 2a01ba8aad3427f65c57f7727f11a67e3a2c783d Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Fri, 12 Jun 2026 07:35:59 -0700 Subject: [PATCH] DiffusionGemma: set UNSLOTH_IS_PRESENT for the shim subprocess (#6259) A clean install could not run DiffusionGemma: the runner spawns python -m unsloth_zoo.diffusion_studio.shim, and unsloth_zoo refuses to import unless UNSLOTH_IS_PRESENT is set (normally by import unsloth). The shim never imports unsloth, so the subprocess died with 'Please install Unsloth via pip install unsloth!' and the model load failed with a 500. Set the flag in the runner child env, as unsloth does on import. --- studio/backend/core/inference/llama_cpp.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/studio/backend/core/inference/llama_cpp.py b/studio/backend/core/inference/llama_cpp.py index 19d02d36fe..75da00451e 100644 --- a/studio/backend/core/inference/llama_cpp.py +++ b/studio/backend/core/inference/llama_cpp.py @@ -2527,6 +2527,10 @@ class LlamaCppBackend: ] env = child_env_without_native_path_secret() + # `python -m unsloth_zoo.diffusion_studio.shim` imports unsloth_zoo, which + # refuses to load unless UNSLOTH_IS_PRESENT is set (normally by `import + # unsloth`). The shim never imports unsloth, so set it here as unsloth does. + env["UNSLOTH_IS_PRESENT"] = "1" env["DG_VISUAL_BIN"] = visual_bin env["DG_GPU"] = gpu # The file-override shim imports its sibling visual_engine; put its dir on PYTHONPATH.