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.

Unsloth Studio: shorter new-architecture dialog, one Update button, custom code under Other (#16966)

Leo Borcherding454801dcf4cf
diff --git a/studio/frontend/src/features/transformers-upgrade/components/transformers-upgrade-dialog.tsx b/studio/frontend/src/features/transformers-upgrade/components/transformers-upgrade-dialog.tsx
index e123f1507ad..2a9f30d538f 100644
--- a/studio/frontend/src/features/transformers-upgrade/components/transformers-upgrade-dialog.tsx
+++ b/studio/frontend/src/features/transformers-upgrade/components/transformers-upgrade-dialog.tsx
@@ -11,9 +11,16 @@ import {
AlertDialogHeader,
AlertDialogTitle,
} from "@/components/ui/alert-dialog";
+import { Button } from "@/components/ui/button";
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+} from "@/components/ui/dropdown-menu";
import { Spinner } from "@/components/ui/spinner";
import { cn } from "@/lib/utils";
-import { PackageIcon } from "@hugeicons/core-free-icons";
+import { ArrowDown01Icon, PackageIcon } from "@hugeicons/core-free-icons";
import { HugeiconsIcon } from "@hugeicons/react";
import {
upgradeDialogActions,
@@ -56,7 +63,8 @@ export function TransformersUpgradeDialog() {
if (!next && !installing) resolve(false);
}}
>
- <AlertDialogContent className="max-w-lg">
+ {/* A plain max-w loses to the size rule, whose 28rem can't fit a dev version's button row. */}
+ <AlertDialogContent className="sm:!max-w-[calc(34rem*var(--ui-space-scale,1))]">
<AlertDialogHeader className="min-w-0">
<div className="flex w-full min-w-0 items-start gap-3">
<div className="flex size-9 shrink-0 items-center justify-center rounded-full bg-blue-500/10 text-blue-600 dark:text-blue-400">
@@ -69,51 +77,28 @@ export function TransformersUpgradeDialog() {
<span className="font-medium text-foreground">
{displayName}
</span>{" "}
- uses the{" "}
- <span className="font-mono text-foreground">{modelType}</span>{" "}
- architecture, which your installed transformers does not
- support yet.{" "}
- {installable && fromMain ? (
- <>
- No transformers release supports it yet, but the
- development branch (main) does. Install transformers{" "}
- <span className="font-medium text-foreground">
- {version}
- </span>{" "}
- from main to load it. Development builds are not releases
- and can change; the install runs once and loading
- continues automatically afterwards.
- </>
- ) : installable ? (
+ uses{" "}
+ <span className="font-mono text-foreground">{modelType}</span>
+ {installable ? (
<>
- Install transformers{" "}
+ , which needs transformers{" "}
<span className="font-medium text-foreground">
{version}
- </span>{" "}
- from PyPI to load it. The install runs once and can take a
- minute; loading continues automatically afterwards.
+ </span>
+ {fromMain ? " (development build)" : ""}. Updating takes
+ about a minute.
</>
) : devOnly ? (
<>
- Even the latest transformers release on PyPI does not
- support it yet: the architecture is only available on the
- transformers development branch (main), whose version
- could not be checked right now. Try again later.
+ , which only the transformers development build supports.
+ Its version can't be checked right now; try again later.
</>
) : (
- <>
- No released transformers version supports it yet, so it
- cannot be loaded.
- </>
+ <>, which no transformers version supports yet.</>
)}
- {customCode ? (
- <>
- {" "}
- This model also ships its own modeling code; you can
- continue and review enabling that custom code instead,
- which loads it on the transformers you already have.
- </>
- ) : null}
+ {customCode && !installable
+ ? " You can still load it with the model's own code."
+ : null}
</AlertDialogDescription>
</div>
@@ -126,26 +111,35 @@ export function TransformersUpgradeDialog() {
{installing ? (
<p className="flex items-center gap-2 text-xs text-muted-foreground">
<Spinner className="size-3.5" />
- Installing transformers {version}... This can take a minute.
+ Updating transformers to {version}...
</p>
) : null}
</div>
</div>
</AlertDialogHeader>
- <AlertDialogFooter>
+ <AlertDialogFooter className="sm:flex-wrap">
<AlertDialogCancel disabled={installing}>Cancel</AlertDialogCancel>
{installable ? (
<>
{customCode ? (
- // Offered beside Install: installing activates the 16-bit sidecar, so this is
- // the only way a 4-bit run on this model can start.
- <AlertDialogAction
- className="bg-transparent text-foreground hover:bg-accent"
- onClick={() => resolve(true)}
- >
- Continue with custom code
- </AlertDialogAction>
+ // Installing forces 16-bit, so this is a 4-bit run's only path; the code scan follows.
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild={true}>
+ <Button variant="outline">
+ Other
+ <HugeiconsIcon
+ icon={ArrowDown01Icon}
+ className="size-4"
+ />
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end" className="w-auto">
+ <DropdownMenuItem onSelect={() => resolve(true)}>
+ Continue with custom code
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
) : null}
<AlertDialogAction
disabled={installing}
@@ -159,12 +153,12 @@ export function TransformersUpgradeDialog() {
{installing ? (
<>
<Spinner className="size-4" />
- Installing...
+ Updating...
</>
) : phase === "error" ? (
- "Retry install"
+ "Retry update"
) : (
- `Install transformers ${version}`
+ `Update transformers to ${version}`
)}
</AlertDialogAction>
</>
diff --git a/studio/frontend/tests/training-upgrade-gate-contract.test.ts b/studio/frontend/tests/training-upgrade-gate-contract.test.ts
index 0983feeb1a5..602d309a900 100644
--- a/studio/frontend/tests/training-upgrade-gate-contract.test.ts
+++ b/studio/frontend/tests/training-upgrade-gate-contract.test.ts
@@ -113,6 +113,31 @@ test("the consent dialog offers the custom-code way out before an install fails"
/phase === "error" && trustRemoteCodeFallback/,
"the custom-code fallback must not wait for an install to fail first",
);
+ assert.match(
+ dialog,
+ /<DropdownMenuItem onSelect=\{\(\) => resolve\(true\)\}>\s*Continue with custom code/,
+ "beside Update, custom code lives under Other and only resolves the dialog",
+ );
+ assert.doesNotMatch(
+ dialog,
+ /trustRemoteCode\s*=/,
+ "the dialog must never grant trust itself",
+ );
+});
+
+test("chat raises the remote-code scan after the upgrade dialog", () => {
+ for (const file of [
+ "../src/features/chat/shared-composer.tsx",
+ "../src/features/chat/hooks/use-chat-model-runtime.ts",
+ ]) {
+ const source = readText(file);
+ const upgradeAt = source.indexOf("confirmTransformersUpgradeIfNeeded({");
+ const scanAt = source.indexOf("confirmRemoteCodeIfNeeded({", upgradeAt);
+ assert.ok(
+ upgradeAt >= 0 && scanAt > upgradeAt,
+ `${file} must scan custom code after the upgrade dialog`,
+ );
+ }
});
test("both start paths carry the upgrade gate's custom-code verdict forward", () => {