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.

Studio: Export page in the Train style, Train polish, hide Q4NX without an AMD NPU (#15640)

Michael Hane8b9273acc2e
diff --git a/studio/frontend/src/components/section-box.tsx b/studio/frontend/src/components/section-box.tsx
new file mode 100644
index 00000000000..cd2ed617ff5
--- /dev/null
+++ b/studio/frontend/src/components/section-box.tsx
@@ -0,0 +1,89 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+import { HugeiconsIcon, type IconSvgElement } from "@hugeicons/react";
+import type { CSSProperties, ReactNode } from "react";
+
+export function SectionBox({
+ title,
+ description,
+ icon,
+ chipTint,
+ titleAction,
+ children,
+ dataTour,
+}: {
+ title?: string;
+ description?: string;
+ icon?: IconSvgElement;
+ chipTint?: string;
+ titleAction?: ReactNode;
+ children: ReactNode;
+ dataTour?: string;
+}) {
+ return (
+ <section
+ data-tour={dataTour}
+ className="section-box @container/train-card elevated-card flex flex-col gap-7 bg-card p-5 pb-7"
+ >
+ {title && (
+ <div className="flex flex-col items-stretch gap-3 @md/train-card:flex-row @md/train-card:items-center @md/train-card:justify-between">
+ <div className="flex min-w-0 items-center gap-3">
+ {icon && (
+ <span
+ className="train-section-chip inline-flex size-9 shrink-0 items-center justify-center rounded-full"
+ style={
+ chipTint
+ ? ({ "--chip-tint": chipTint } as CSSProperties)
+ : undefined
+ }
+ >
+ <HugeiconsIcon
+ icon={icon}
+ strokeWidth={1.5}
+ className="size-[calc(18px*var(--ui-space-scale,1))]"
+ />
+ </span>
+ )}
+ <div className="min-w-0">
+ <h2 className="select-none text-ui-13p5 font-semibold leading-ui-18 tracking-[-0.012em] text-foreground">
+ {title}
+ </h2>
+ {description && (
+ <p className="text-ui-11p5 leading-ui-15 text-muted-foreground/85">
+ {description}
+ </p>
+ )}
+ </div>
+ </div>
+ {titleAction && (
+ <div className="w-full min-w-0 @md/train-card:w-auto @md/train-card:shrink-0">
+ {titleAction}
+ </div>
+ )}
+ </div>
+ )}
+ <div className="@container/train-section min-w-0">{children}</div>
+ </section>
+ );
+}
+
+export function SectionField({
+ label,
+ hint,
+ children,
+}: {
+ label: string;
+ hint?: ReactNode;
+ children: ReactNode;
+}) {
+ return (
+ <div className="flex flex-col gap-2">
+ <span className="flex items-center gap-1.5 text-xs font-medium text-muted-foreground">
+ {label}
+ {hint}
+ </span>
+ <div className="min-w-0">{children}</div>
+ </div>
+ );
+}
diff --git a/studio/frontend/src/features/export/components/export-summary-card.tsx b/studio/frontend/src/features/export/components/export-summary-card.tsx
new file mode 100644
index 00000000000..4552bc8f0c3
--- /dev/null
+++ b/studio/frontend/src/features/export/components/export-summary-card.tsx
@@ -0,0 +1,96 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+import { cn } from "@/lib/utils";
+import type { ReactElement, ReactNode } from "react";
+
+export interface ExportSummaryRow {
+ label: string;
+ value: ReactNode;
+ mono?: boolean;
+}
+
+export function ExportSummaryCard({
+ ready,
+ rows,
+ steps,
+ cta,
+}: {
+ ready: boolean;
+ rows: readonly ExportSummaryRow[];
+ steps: readonly string[];
+ cta?: ReactNode;
+}): ReactElement {
+ return (
+ <aside
+ className={cn(
+ "elevated-card elevated-card-dark-border flex flex-col gap-7 bg-[color-mix(in_oklab,var(--foreground)_calc(1.2%*var(--contrast-wash-gain,1)),transparent)] p-6",
+ "dark:bg-[rgb(255_255_255_/_calc(0.018*var(--contrast-wash-gain,1)))]",
+ )}
+ >
+ <header className="flex items-center justify-between gap-3">
+ <h2 className="text-ui-11 font-medium tracking-nav text-muted-foreground">
+ Export summary
+ </h2>
+ <span
+ className={cn(
+ "inline-flex h-5 items-center rounded-full px-2 text-ui-10 font-medium tracking-nav",
+ ready
+ ? "bg-[color-mix(in_oklab,var(--foreground)_calc(6%*var(--contrast-wash-gain,1)),transparent)] text-foreground/90 dark:bg-[rgb(255_255_255_/_calc(0.08*var(--contrast-wash-gain,1)))]"
+ : "bg-[color-mix(in_oklab,var(--foreground)_calc(3%*var(--contrast-wash-gain,1)),transparent)] text-muted-foreground/70 dark:bg-[rgb(255_255_255_/_calc(0.04*var(--contrast-wash-gain,1)))]",
+ )}
+ >
+ {ready ? "Ready" : "Not ready"}
+ </span>
+ </header>
+
+ <section className="flex flex-col gap-3">
+ {rows.map((row) => (
+ <div
+ key={row.label}
+ className="flex items-baseline justify-between gap-3"
+ >
+ <span className="shrink-0 text-ui-11p5 text-muted-foreground/85">
+ {row.label}
+ </span>
+ <span
+ className={cn(
+ "min-w-0 truncate text-ui-12p5 text-foreground/90",
+ row.mono && "font-mono",
+ )}
+ title={typeof row.value === "string" ? row.value : undefined}
+ >
+ {row.value}
+ </span>
+ </div>
+ ))}
+ </section>
+
+ <section className="flex flex-col gap-3">
+ <p className="text-ui-11 font-medium tracking-nav text-muted-foreground">
+ Quick guide
+ </p>
+ <ol className="flex flex-col gap-2.5">
+ {steps.map((step, i) => (
+ <li
+ key={step}
+ className="flex items-start gap-2.5 text-ui-11p5 leading-ui-15 text-muted-foreground"
+ >
+ <span className="flex size-4 shrink-0 items-center justify-center rounded-full bg-[color-mix(in_oklab,var(--foreground)_calc(8%*var(--contrast-wash-gain,1)),transparent)] text-ui-10 font-semibold text-foreground/80">
+ {i + 1}
+ </span>
+ {step}
+ </li>
+ ))}
+ </ol>
+ </section>
+
+ {cta && (
+ <>
+ <div className="-mx-6 h-px bg-[color-mix(in_oklab,var(--foreground)_calc(7%*var(--contrast-wash-gain,1)),transparent)] dark:bg-[rgb(255_255_255_/_calc(0.06*var(--contrast-wash-gain,1)))]" />
+ <div className="-mt-2">{cta}</div>
+ </>
+ )}
+ </aside>
+ );
+}
diff --git a/studio/frontend/src/features/export/components/image-lora-export-card.tsx b/studio/frontend/src/features/export/components/image-lora-export-card.tsx
index 23464ec8972..cec7dddc0dd 100644
--- a/studio/frontend/src/features/export/components/image-lora-export-card.tsx
+++ b/studio/frontend/src/features/export/components/image-lora-export-card.tsx
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: AGPL-3.0-only
// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
-import { SectionCard } from "@/components/section-card";
+import { SectionBox } from "@/components/section-box";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import {
@@ -18,7 +18,6 @@ import {
} from "@/features/images/api";
import { matchCatalogId } from "@/features/images/train/diffusion-train-deploy";
import { ImageAdd02Icon } from "@hugeicons/core-free-icons";
-import { HugeiconsIcon } from "@hugeicons/react";
import { useEffect, useState } from "react";
import { exportDiffusionLora } from "../api/export-api";
import { savedLabel } from "../constants";
@@ -96,69 +95,78 @@ export function ImageLoraExportCard({ preselect }: { preselect?: string }) {
}
return (
- <SectionCard
- icon={<HugeiconsIcon icon={ImageAdd02Icon} className="size-5" />}
+ <SectionBox
+ icon={ImageAdd02Icon}
+ chipTint="var(--chart-1)"
title="Export an image LoRA"
description="Save a copy of an image generation LoRA you trained (or added) on the Images page: the .safetensors adapter plus its .json metadata. Any Unsloth install lists it again from a custom models folder."
- className="mt-6"
>
- <div className="grid gap-4 sm:grid-cols-2">
- <div className="space-y-1.5">
- <label htmlFor="image-lora-id" className="text-sm font-medium">
- Image LoRA
- </label>
- <Select value={loraId} onValueChange={setLoraId}>
- <SelectTrigger id="image-lora-id" className="w-full">
- <SelectValue
- placeholder={
- loras === null
- ? "Loading…"
- : loras.length === 0
- ? "No image LoRAs found"
- : "Select an image LoRA…"
- }
- />
- </SelectTrigger>
- <SelectContent>
- {(loras ?? []).map((l) => (
- <SelectItem key={l.id} value={l.id}>
- {imageLoraLabel(
- l,
- (loras ?? []).some(
- (o) => o.id !== l.id && o.display_name === l.display_name,
- ),
- )}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
+ <div className="flex flex-col gap-6">
+ <div className="grid gap-4 @md/train-section:grid-cols-2">
+ <div className="flex flex-col gap-2">
+ <label
+ htmlFor="image-lora-id"
+ className="flex items-center gap-1.5 text-xs font-medium text-muted-foreground"
+ >
+ Image LoRA
+ </label>
+ <Select value={loraId} onValueChange={setLoraId}>
+ <SelectTrigger id="image-lora-id" className="w-full">
+ <SelectValue
+ placeholder={
+ loras === null
+ ? "Loading…"
+ : loras.length === 0
+ ? "No image LoRAs found"
+ : "Select an image LoRA…"
+ }
+ />
+ </SelectTrigger>
+ <SelectContent>
+ {(loras ?? []).map((l) => (
+ <SelectItem key={l.id} value={l.id}>
+ {imageLoraLabel(
+ l,
+ (loras ?? []).some(
+ (o) =>
+ o.id !== l.id && o.display_name === l.display_name,
+ ),
+ )}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </div>
+ <div className="flex flex-col gap-2">
+ <label
+ htmlFor="image-lora-save"
+ className="flex items-center gap-1.5 text-xs font-medium text-muted-foreground"
+ >
+ Save directory
+ </label>
+ <Input
+ id="image-lora-save"
+ value={saveDirectory}
+ onChange={(e) => setSaveDirectory(e.target.value)}
+ />
+ </div>
</div>
- <div className="space-y-1.5">
- <label htmlFor="image-lora-save" className="text-sm font-medium">
- Save directory
- </label>
- <Input
- id="image-lora-save"
- value={saveDirectory}
- onChange={(e) => setSaveDirectory(e.target.value)}
- />
+ <div className="flex items-center justify-between gap-3">
+ <p
+ className={
+ result?.ok === false
+ ? "text-xs text-destructive"
+ : "text-xs text-muted-foreground"
+ }
+ >
+ {result?.text ?? "A plain file copy: no model load or GPU needed."}
+ </p>
+ <Button variant="dark" disabled={!canExport} onClick={handleExport}>
+ {running && <Spinner />}
+ Export
+ </Button>
</div>
</div>
- <div className="flex items-center justify-between gap-3">
- <p
- className={
- result?.ok === false
- ? "text-xs text-destructive"
- : "text-xs text-muted-foreground"
- }
- >
- {result?.text ?? "A plain file copy: no model load or GPU needed."}
- </p>
- <Button variant="dark" disabled={!canExport} onClick={handleExport}>
- {running && <Spinner />}
- Export
- </Button>
- </div>
- </SectionCard>
+ </SectionBox>
);
}
diff --git a/studio/frontend/src/features/export/components/method-picker.tsx b/studio/frontend/src/features/export/components/method-picker.tsx
index 3f57c57be1d..8167b983c96 100644
--- a/studio/frontend/src/features/export/components/method-picker.tsx
+++ b/studio/frontend/src/features/export/components/method-picker.tsx
@@ -10,7 +10,6 @@ import {
import { cn } from "@/lib/utils";
import {
InformationCircleIcon,
- CheckmarkCircle02Icon,
} from "@hugeicons/core-free-icons";
import { HugeiconsIcon } from "@hugeicons/react";
import { EXPORT_METHODS, type ExportMethod } from "../constants";
@@ -22,34 +21,15 @@ interface MethodPickerProps {
disabledReason?: string;
}
-export function MethodPicker({ value, onChange, disabledMethods = [], disabledReason }: MethodPickerProps) {
+export function MethodPicker({
+ value,
+ onChange,
+ disabledMethods = [],
+ disabledReason,
+}: MethodPickerProps) {
return (
<div data-tour="export-method" className="flex flex-col gap-3">
- <span className="flex items-center gap-1.5 text-xs font-medium text-muted-foreground">
- Export Method
- <Tooltip>
- <TooltipTrigger asChild={true}>
- <button
- type="button"
- className="text-foreground/70 hover:text-foreground"
- >
- <HugeiconsIcon icon={InformationCircleIcon} className="size-3" />
- </button>
- </TooltipTrigger>
- <TooltipContent>
- How your model is packaged for deployment.{" "}
- <a
- href="https://unsloth.ai/docs/basics/inference-and-deployment"
- target="_blank"
- rel="noopener noreferrer"
- className="text-primary underline"
- >
- Read more
- </a>
- </TooltipContent>
- </Tooltip>
- </span>
- <div className="grid grid-cols-1 gap-3 sm:grid-cols-3">
+ <div className="grid grid-cols-1 gap-3 @xl/train-section:grid-cols-3">
{EXPORT_METHODS.map((m) => {
const selected = value === m.value;
const isDisabled = disabledMethods.includes(m.value);
@@ -62,29 +42,14 @@ export function MethodPicker({ value, onChange, disabledMethods = [], disabledRe
aria-pressed={selected}
onClick={() => !isDisabled && onChange(m.value)}
className={cn(
- "flex items-start gap-3 rounded-xl p-4 text-left ring-1 transition-colors",
+ "flex items-start rounded-[18px] p-4 text-left ring-1 transition-colors",
isDisabled
? "ring-border opacity-40 cursor-not-allowed"
: selected
- ? "ring-1 ring-ring-strong bg-wash-5"
+ ? "ring-transparent bg-wash-5"
: "ring-border hover:bg-muted/40",
)}
>
- <div
- className={cn(
- "mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-full border-2 transition-colors",
- selected
- ? "border-primary bg-primary"
- : "border-muted-foreground/30",
- )}
- >
- {selected && (
- <HugeiconsIcon
- icon={CheckmarkCircle02Icon}
- className="size-3 text-primary-foreground"
- />
- )}
- </div>
<div className="flex flex-col gap-1">
<div className="flex items-center gap-2">
<span className="text-sm font-medium">{m.title}</span>
diff --git a/studio/frontend/src/features/export/components/q4nx-convert-card.tsx b/studio/frontend/src/features/export/components/q4nx-convert-card.tsx
index b6afb4bfd08..d004c4c7a1f 100644
--- a/studio/frontend/src/features/export/components/q4nx-convert-card.tsx
+++ b/studio/frontend/src/features/export/components/q4nx-convert-card.tsx
@@ -1,18 +1,21 @@
// SPDX-License-Identifier: AGPL-3.0-only
// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
-import { SectionCard } from "@/components/section-card";
+import { SectionBox } from "@/components/section-box";
+import { SegmentedControl } from "@/components/segmented-control";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Spinner } from "@/components/ui/spinner";
-import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
import { hfApiToken, useHfTokenStore } from "@/features/hub";
import { CpuIcon } from "@hugeicons/core-free-icons";
-import { HugeiconsIcon } from "@hugeicons/react";
import { useState } from "react";
import { convertGgufToQ4nx } from "../api/export-api";
type Source = "hub" | "local";
+const SOURCE_OPTIONS = [
+ { value: "hub", label: "Hugging Face" },
+ { value: "local", label: "Local file" },
+] as const satisfies readonly { value: Source; label: string }[];
function baseRepoFor(repoId: string): string {
return repoId.trim().replace(/-GGUF$/i, "");
@@ -24,8 +27,11 @@ function Field({
...props
}: { id: string; label: string } & React.ComponentProps<typeof Input>) {
return (
- <div className="space-y-1.5">
- <label htmlFor={id} className="text-sm font-medium">
+ <div className="flex flex-col gap-2">
+ <label
+ htmlFor={id}
+ className="flex items-center gap-1.5 text-xs font-medium text-muted-foreground"
+ >
{label}
</label>
<Input id={id} {...props} />
@@ -80,75 +86,80 @@ export function Q4nxConvertCard() {
}
return (
- <SectionCard
- icon={<HugeiconsIcon icon={CpuIcon} className="size-5" />}
+ <SectionBox
+ icon={CpuIcon}
+ chipTint="var(--chart-1)"
title="Convert a GGUF to Q4NX (AMD NPU)"
- description="Turn a Q4_0, Q4_1 or Q4_K_M GGUF you already have into a FastFlowLM folder for Ryzen AI NPUs (XDNA 2). No training or GPU needed."
- className="mt-6"
+ description="Convert a Q4_0, Q4_1 or Q4_K_M GGUF to Q4NX. Only supported on AMD NPUs."
+ titleAction={
+ <SegmentedControl
+ value={source}
+ options={SOURCE_OPTIONS}
+ onValueChange={setSource}
+ ariaLabel="GGUF source"
+ size="compact"
+ className="@md/train-card:w-[calc(220px*var(--ui-space-scale,1))]"
+ />
+ }
>
- <Tabs value={source} onValueChange={(v) => setSource(v as Source)}>
- <TabsList>
- <TabsTrigger value="hub">Hugging Face</TabsTrigger>
- <TabsTrigger value="local">Local file</TabsTrigger>
- </TabsList>
- </Tabs>
- <div className="grid gap-4 sm:grid-cols-2">
- {source === "hub" ? (
- <>
- <Field
- id="q4nx-repo"
- label="GGUF repo"
- placeholder="unsloth/Qwen3-0.6B-GGUF"
- value={repoId}
- onChange={(e) => setRepoId(e.target.value)}
- />
+ <div className="flex flex-col gap-6">
+ <div className="grid gap-4 @md/train-section:grid-cols-2">
+ {source === "hub" ? (
+ <>
+ <Field
+ id="q4nx-repo"
+ label="GGUF repo"
+ placeholder="unsloth/Qwen3-0.6B-GGUF"
+ value={repoId}
+ onChange={(e) => setRepoId(e.target.value)}
+ />
+ <Field
+ id="q4nx-file"
+ label="GGUF file"
+ placeholder="Qwen3-0.6B-Q4_1.gguf"
+ value={filename}
+ onChange={(e) => setFilename(e.target.value)}
+ />
+ </>
+ ) : (
<Field
- id="q4nx-file"
- label="GGUF file"
- placeholder="Qwen3-0.6B-Q4_1.gguf"
- value={filename}
- onChange={(e) => setFilename(e.target.value)}
+ id="q4nx-path"
+ label="GGUF file path"
+ placeholder="/path/to/model.Q4_1.gguf"
+ value={ggufPath}
+ onChange={(e) => setGgufPath(e.target.value)}
/>
- </>
- ) : (
+ )}
<Field
- id="q4nx-path"
- label="GGUF file path"
- placeholder="/path/to/model.Q4_1.gguf"
- value={ggufPath}
- onChange={(e) => setGgufPath(e.target.value)}
+ id="q4nx-base"
+ label="Original model (config and tokenizer)"
+ placeholder="unsloth/Qwen3-0.6B"
+ value={effectiveBase}
+ onChange={(e) => setBaseModel(e.target.value)}
/>
- )}
- <Field
- id="q4nx-base"
- label="Original model (config and tokenizer)"
- placeholder="unsloth/Qwen3-0.6B"
- value={effectiveBase}
- onChange={(e) => setBaseModel(e.target.value)}
- />
- <Field
- id="q4nx-save"
- label="Save directory"
- value={saveDirectory}
- onChange={(e) => setSaveDirectory(e.target.value)}
- />
- </div>
- <div className="flex items-center justify-between gap-3">
- <p
- className={
- result?.ok === false
- ? "text-xs text-destructive"
- : "text-xs text-muted-foreground"
- }
- >
- {result?.text ??
- "Runs as a drop-in for a FastFlowLM catalog model of the same family and size."}
- </p>
- <Button variant="dark" disabled={!canConvert} onClick={handleConvert}>
- {running && <Spinner />}
- Convert
- </Button>
+ <Field
+ id="q4nx-save"
+ label="Save directory"
+ value={saveDirectory}
+ onChange={(e) => setSaveDirectory(e.target.value)}
+ />
+ </div>
+ <div className="flex items-center justify-between gap-3">
+ <p
+ className={
+ result?.ok === false
+ ? "text-xs text-destructive"
+ : "text-xs text-muted-foreground"
+ }
+ >
+ {result?.text ?? "No training or GPU needed."}
+ </p>
+ <Button variant="dark" disabled={!canConvert} onClick={handleConvert}>
+ {running && <Spinner />}
+ Convert
+ </Button>
+ </div>
</div>
- </SectionCard>
+ </SectionBox>
);
}
diff --git a/studio/frontend/src/features/export/constants.ts b/studio/frontend/src/features/export/constants.ts
index cbc088b9417..ea0607b9ec7 100644
--- a/studio/frontend/src/features/export/constants.ts
+++ b/studio/frontend/src/features/export/constants.ts
@@ -22,7 +22,7 @@ export const EXPORT_METHODS: {
{
value: "lora",
title: "LoRA Only",
- description: "Lightweight adapter files (~100 MB). Needs base model.",
+ description: "Lightweight adapter files. Needs base model.",
tooltip:
"Exports only the trained adapter. Pair with the base model at inference time to save storage.",
},
@@ -213,7 +213,6 @@ export function mergedFormatPayload(value: string): {
return { formatType: "16-bit (FP16)", compressedMethod: opt.value };
}
-/** GGUF quants FastFlowLM's Q4NX converter packs directly for the AMD Ryzen AI NPU. */
export const Q4NX_SOURCE_QUANTS = ["q4_0", "q4_1", "q4_k_m"];
/** Approximate llama.cpp bits per weight; GGUF size ~= fp16_bytes * bpw / 16. */
diff --git a/studio/frontend/src/features/export/export-page.tsx b/studio/frontend/src/features/export/export-page.tsx
index 429635f67b7..dfee2b788cb 100644
--- a/studio/frontend/src/features/export/export-page.tsx
+++ b/studio/frontend/src/features/export/export-page.tsx
@@ -2,7 +2,8 @@
// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
import { useAppShellReadySignal } from "@/components/app-readiness";
-import { SectionCard } from "@/components/section-card";
+import { SectionBox } from "@/components/section-box";
+import { SegmentedControl } from "@/components/segmented-control";
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
import { Button } from "@/components/ui/button";
import {
@@ -33,10 +34,8 @@ import {
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
-import { Separator } from "@/components/ui/separator";
import { Spinner } from "@/components/ui/spinner";
import { Switch } from "@/components/ui/switch";
-import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
import {
Tooltip,
TooltipContent,
@@ -46,6 +45,7 @@ import { usePlatformStore } from "@/config/env";
import { prepareHfTokenForUse } from "@/features/hf-auth";
import { hfApiToken, useHfTokenStore, useHubModelSearch } from "@/features/hub";
import { confirmRemoteCodeIfNeeded } from "@/features/security";
+import { useNpuStatus } from "@/features/npu";
import { GuidedTour, useGuidedTourController } from "@/features/tour";
import type { LocalModelInfo } from "@/features/training";
import { useDebouncedValue, useHfTokenValidation } from "@/hooks";
@@ -54,8 +54,10 @@ import { FullInstallDialog } from "@/features/settings";
import { useHardwareInfo } from "@/hooks/use-hardware-info";
import { useT } from "@/i18n";
import { ChevronDownStandardIcon } from "@/lib/chevron-icons";
+import { cn } from "@/lib/utils";
import {
AlertCircleIcon,
+ ChipIcon,
FolderSearchIcon,
InformationCircleIcon,
Key01Icon,
@@ -76,6 +78,10 @@ import {
} from "./api/export-api";
import { adapterCompatibilityTip, type AdapterFormat } from "./constants";
import { ExportRunPanel } from "./components/export-run-panel";
+import {
+ ExportSummaryCard,
+ type ExportSummaryRow,
+} from "./components/export-summary-card";
import { ImageLoraExportCard } from "./components/image-lora-export-card";
import { MethodPicker } from "./components/method-picker";
import { Q4nxConvertCard } from "./components/q4nx-convert-card";
@@ -130,6 +136,13 @@ const SEARCH_INPUT_REASONS = new Set([
const LORA_GGUF_OUTTYPES = ["q8_0", "f16", "bf16", "f32"] as const;
type SourceTab = "local" | "checkpoint" | "hf";
+const SOURCE_TAB_OPTIONS = [
+ { value: "local", label: "Local" },
+ { value: "checkpoint", label: "Fine-tuned" },
+ { value: "hf", label: "Hugging Face" },
+] as const satisfies readonly { value: SourceTab; label: string }[];
+const FIELD_LABEL =
+ "flex items-center gap-1.5 text-xs font-medium text-muted-foreground";
type SourceMode = "checkpoint" | "model";
function safePathSegment(
@@ -244,7 +257,10 @@ export function ExportPage() {
const [reapSettings, setReapSettings] = useState<ReapSettings>(
DEFAULT_REAP_SETTINGS,
);
- const [customImatrix, setCustomImatrix] = useState({ sourceKey: "", path: "" });
+ const [customImatrix, setCustomImatrix] = useState({
+ sourceKey: "",
+ path: "",
+ });
const [selectedFormats, setSelectedFormats] = useState<string[]>(() => {
const s = useExportRuntimeStore.getState();
return isExportPanelActive(s) &&
@@ -279,7 +295,8 @@ export function ExportPage() {
MERGED_FORMATS.filter((f) => {
if (f.backend === "compressed") return hasNvidia;
// torchao is hidden on NVIDIA, macOS/MLX and where torchao cannot load.
- if (f.backend === "torchao") return !hasNvidia && !isMacHost && !torchaoUnavailable;
+ if (f.backend === "torchao")
+ return !hasNvidia && !isMacHost && !torchaoUnavailable;
return true;
}),
[hasNvidia, isMacHost, torchaoUnavailable],
@@ -312,8 +329,10 @@ export function ExportPage() {
const [destination, setDestination] = useState<"local" | "hub">("local");
// The converter writes beside the GGUFs, so a Hub-only export has nowhere to put it.
+ const [npuStatus] = useNpuStatus();
+ const hasNpu = !!npuStatus?.supported;
const effectiveNpuQ4nx =
- npuQ4nx && q4nxSourceSelected && destination === "local";
+ hasNpu && npuQ4nx && q4nxSourceSelected && destination === "local";
const [customSaveDirectory, setCustomSaveDirectory] = useState<string | null>(
null,
);
@@ -363,7 +382,9 @@ export function ExportPage() {
// Apply the ?run= deep link once its run appears in the checkpoint list: select the run and
// default to GGUF. The main checkpoint is auto-selected below, after the model-change effect.
- const { run: preselectRun, imageLora: preselectImageLora } = useSearch({ from: "/export" });
+ const { run: preselectRun, imageLora: preselectImageLora } = useSearch({
+ from: "/export",
+ });
const appliedRunRef = useRef<string | null>(null);
useEffect(() => {
if (!preselectRun) {
@@ -407,11 +428,7 @@ export function ExportPage() {
const reloadReadySent = useRef(false);
useEffect(() => {
- if (
- loadingCheckpoints ||
- isLoadingLocalModels ||
- reloadReadySent.current
- ) {
+ if (loadingCheckpoints || isLoadingLocalModels || reloadReadySent.current) {
return;
}
reloadReadySent.current = true;
@@ -599,7 +616,9 @@ export function ExportPage() {
? selectedSourceModel || null
: null);
const moeProbeToken = debouncedHfToken?.trim() || "";
- const moeProbeKey = moeProbeTarget ? `${moeProbeTarget}|${moeProbeToken}` : "";
+ const moeProbeKey = moeProbeTarget
+ ? `${moeProbeTarget}|${moeProbeToken}`
+ : "";
const [moeState, setMoeState] = useState<{
key: string;
info: MoeInfo | null;
@@ -862,6 +881,35 @@ export function ExportPage() {
!reapBlocked
);
+ const exportMethodTitle =
+ EXPORT_METHODS.find((m) => m.value === exportMethod)?.title ?? "—";
+ const summaryRows: ExportSummaryRow[] =
+ sourceMode === "checkpoint"
+ ? [
+ {
+ label: "Training run",
+ value: selectedModelIdx
+ ? selectedModelIdx.replace(/_(\d{10,})$/, "")
+ : "—",
+ },
+ { label: "Checkpoint", value: checkpoint ?? "—" },
+ { label: "Base model", value: baseModelName },
+ {
+ label: "Training",
+ value: selectedModelData ? trainingMethodLabel : "—",
+ },
+ ...(isAdapter && loraRank != null
+ ? [{ label: "LoRA rank", value: String(loraRank), mono: true }]
+ : []),
+ { label: "Method", value: exportMethodTitle },
+ { label: "Est. size", value: estimatedSize ?? "—" },
+ ]
+ : [
+ { label: "Model", value: selectedSourceModel ?? "—" },
+ { label: "Method", value: exportMethodTitle },
+ { label: "Est. size", value: estimatedSize ?? "—" },
+ ];
+
const applyHfSourceModel = useCallback((value: string) => {
const next = value.trim();
setModelInput(next);
@@ -965,7 +1013,8 @@ export function ExportPage() {
: undefined;
const token = pushToHub && actionHfToken ? actionHfToken : undefined;
const effectiveMethod: ExportMethod = ggufAsLora ? "lora" : exportMethod;
- const emitLoraGguf = ggufAsLora || (effectiveMethod === "lora" && loraAsGguf);
+ const emitLoraGguf =
+ ggufAsLora || (effectiveMethod === "lora" && loraAsGguf);
const methodLabel = isDecision
? t("exportDecision.methodLabel")
: ggufAsLora
@@ -996,9 +1045,8 @@ export function ExportPage() {
let installMissingDependencies = false;
if (effectiveMethod === "merged") {
- const llmCompressor = await confirmLlmCompressorInstallIfNeeded(
- selectedFormats,
- );
+ const llmCompressor =
+ await confirmLlmCompressorInstallIfNeeded(selectedFormats);
if (!llmCompressor.ok) return;
installMissingDependencies = llmCompressor.installMissingDependencies;
}
@@ -1127,1130 +1175,1118 @@ export function ExportPage() {
}, [showPanel]);
return (
- <div className="min-h-[calc(100dvh-var(--studio-titlebar-height,0px))] bg-background">
- <main className="mx-auto max-w-7xl 3xl:max-w-[calc(1440px*var(--ui-space-scale,1))] 4xl:max-w-[calc(1760px*var(--ui-space-scale,1))] px-5 py-8 max-sm:px-4 sm:px-9">
+ <div className="flex min-h-[calc(100dvh-var(--studio-titlebar-height,0px))] flex-col bg-background">
+ <main className="mx-auto flex w-full max-w-[calc(1180px*var(--ui-space-scale,1))] 3xl:max-w-[calc(1440px*var(--ui-space-scale,1))] 4xl:max-w-[calc(1760px*var(--ui-space-scale,1))] flex-col gap-7 px-5 pb-20 pt-8 max-sm:px-4 sm:px-9">
<GuidedTour {...tour.tourProps} />
- <div className="mb-8 flex flex-col gap-0.5">
+ <header className="font-heading flex flex-col gap-0.5">
<h1 className="text-ui-30 font-semibold leading-[1.04] tracking-[-0.028em] text-foreground sm:text-ui-34">
- Export Model
+ Export
</h1>
<p className="text-sm text-muted-foreground">
Export fine-tuned or base models for deployment
</p>
- </div>
-
- <SectionCard
- icon={<HugeiconsIcon icon={PackageIcon} className="size-5" />}
- title="Export Configuration"
- description="Select source, method, and quantization"
- accent="emerald"
- featured={true}
- className="ring-0 shadow-[0_2px_8px_-2px_rgba(0,0,0,0.16)] dark:shadow-none"
- >
- {loadingCheckpoints && (
- <div className="flex items-center gap-2 py-6 justify-center text-sm text-muted-foreground">
- <Spinner className="size-4" />
- Loading checkpoints…
- </div>
- )}
-
- {checkpointError && (
- <div className="flex items-center gap-2 py-6 justify-center text-sm text-destructive">
- <HugeiconsIcon icon={AlertCircleIcon} className="size-4" />
- {checkpointError}
- </div>
- )}
-
- {!loadingCheckpoints && !checkpointError && (
- <>
- <div className="grid grid-cols-1 gap-6 md:grid-cols-2 md:gap-8">
- <div className="flex flex-col gap-3">
- <div className="flex flex-col gap-2">
- <label className="flex items-center gap-1.5 text-xs font-medium text-muted-foreground">
- Source
- <Tooltip>
- <TooltipTrigger asChild={true}>
- <button
- type="button"
- className="text-foreground/70 hover:text-foreground"
- >
- <HugeiconsIcon
- icon={InformationCircleIcon}
- className="size-3"
- />
- </button>
- </TooltipTrigger>
- <TooltipContent>
- Choose a local model, fine-tuned checkpoint, or
- Hugging Face model to export.
- </TooltipContent>
- </Tooltip>
- </label>
- <Tabs
+ </header>
+
+ {loadingCheckpoints && (
+ <div className="flex items-center gap-3 rounded-2xl border border-border/60 p-8 text-sm text-muted-foreground">
+ <Spinner className="size-4 shrink-0" />
+ Loading checkpoints…
+ </div>
+ )}
+
+ {checkpointError && (
+ <div className="flex items-center gap-3 rounded-2xl border border-border/60 p-8 text-sm text-destructive">
+ <HugeiconsIcon icon={AlertCircleIcon} className="size-4 shrink-0" />
+ {checkpointError}
+ </div>
+ )}
+
+ {(loadingCheckpoints || !!checkpointError) && (
+ <>
+ <ImageLoraExportCard preselect={preselectImageLora} />
+ {hasNpu && <Q4nxConvertCard />}
+ </>
+ )}
+
+ {!loadingCheckpoints && !checkpointError && (
+ <div className="@container/export-configure">
+ <div className="grid grid-cols-1 gap-8 @4xl/export-configure:grid-cols-[minmax(0,1fr)_320px] @5xl/export-configure:gap-10">
+ <div className="flex min-w-0 flex-col gap-6">
+ <SectionBox
+ title="Source"
+ description="A local model, a fine-tuned checkpoint, or a Hugging Face model"
+ icon={ChipIcon}
+ chipTint="var(--chart-1)"
+ titleAction={
+ <SegmentedControl
value={sourceTab}
+ options={SOURCE_TAB_OPTIONS}
onValueChange={handleSourceTabChange}
- className="w-full"
- >
- <TabsList
- unstyled={true}
- className="hub-menu-trigger hub-tab-toggle relative inline-flex h-9 w-full items-center rounded-full"
- >
- <TabsTrigger
- value="local"
- indicatorClassName="hub-tab-toggle-pill rounded-full"
- className="h-9 rounded-full border-0 px-3 text-ui-12p5 text-muted-foreground hover:text-foreground data-active:text-foreground data-[state=active]:text-foreground"
- >
- Local Model
- </TabsTrigger>
- <TabsTrigger
- value="checkpoint"
- indicatorClassName="hub-tab-toggle-pill rounded-full"
- className="h-9 rounded-full border-0 px-3 text-ui-12p5 text-muted-foreground hover:text-foreground data-active:text-foreground data-[state=active]:text-foreground"
- >
- Fine-tuned
- </TabsTrigger>
- <TabsTrigger
- value="hf"
- indicatorClassName="hub-tab-toggle-pill rounded-full"
- className="h-9 rounded-full border-0 px-3 text-ui-12p5 text-muted-foreground hover:text-foreground data-active:text-foreground data-[state=active]:text-foreground"
+ ariaLabel="Export source"
+ size="compact"
+ className="@md/train-card:w-[calc(300px*var(--ui-space-scale,1))]"
+ />
+ }
+ >
+ <div className="flex flex-col gap-4">
+ {sourceMode === "checkpoint" ? (
+ <div className="grid grid-cols-1 gap-4 overflow-visible @md/train-section:grid-cols-2">
+ <div
+ data-tour="export-training-run"
+ className="flex min-w-0 flex-col gap-2"
>
- Hugging Face
- </TabsTrigger>
- </TabsList>
- </Tabs>
- </div>
+ <label className={FIELD_LABEL}>Training run</label>
+ <Select
+ value={selectedModelIdx ?? ""}
+ onValueChange={setSelectedModelIdx}
+ >
+ <SelectTrigger className="w-full">
+ <SelectValue
+ placeholder={
+ models.length === 0
+ ? "No training runs found"
+ : "Select a training run…"
+ }
+ />
+ </SelectTrigger>
+ <SelectContent>
+ {models.map((m) => {
+ const tsMatch = m.name.match(/_(\d{10,})$/);
+ const displayName = tsMatch
+ ? m.name.slice(0, tsMatch.index)
+ : m.name;
+ const timeStr = tsMatch
+ ? new Date(
+ Number(tsMatch[1]) * 1000,
+ ).toLocaleString(undefined, {
+ dateStyle: "medium",
+ timeStyle: "short",
+ })
+ : null;
+ return (
+ <SelectItem key={m.name} value={m.name}>
+ <span className="flex items-center gap-2">
+ {displayName}
+ <span className="text-muted-foreground text-xs">
+ {m.checkpoints.length} checkpoint
+ {m.checkpoints.length !== 1 ? "s" : ""}
+ </span>
+ {timeStr && (
+ <span className="text-muted-foreground text-xs">
+ · {timeStr}
+ </span>
+ )}
+ </span>
+ </SelectItem>
+ );
+ })}
+ </SelectContent>
+ </Select>
+ </div>
- {sourceMode === "checkpoint" ? (
- <div className="flex flex-col gap-2 overflow-visible">
- <div
- data-tour="export-training-run"
- className="flex flex-col gap-2"
- >
- <label className="text-xs font-medium text-muted-foreground">
- Training Run
- </label>
- <Select
- value={selectedModelIdx ?? ""}
- onValueChange={setSelectedModelIdx}
+ <div
+ data-tour="export-checkpoint"
+ className="flex min-w-0 flex-col gap-2"
>
- <SelectTrigger className="w-full">
- <SelectValue
- placeholder={
- models.length === 0
- ? "No training runs found"
- : "Select a training run…"
- }
- />
- </SelectTrigger>
- <SelectContent>
- {models.map((m) => {
- const tsMatch = m.name.match(/_(\d{10,})$/);
- const displayName = tsMatch
- ? m.name.slice(0, tsMatch.index)
- : m.name;
- const timeStr = tsMatch
- ? new Date(
- Number(tsMatch[1]) * 1000,
- ).toLocaleString(undefined, {
- dateStyle: "medium",
- timeStyle: "short",
- })
- : null;
- return (
- <SelectItem key={m.name} value={m.name}>
+ <label className={FIELD_LABEL}>
+ Checkpoint
+ <Tooltip>
+ <TooltipTrigger asChild={true}>
+ <button
+ type="button"
+ className="text-foreground/70 hover:text-foreground"
+ >
+ <HugeiconsIcon
+ icon={InformationCircleIcon}
+ className="size-3"
+ />
+ </button>
+ </TooltipTrigger>
+ <TooltipContent>
+ Choose a saved checkpoint to export. Lower loss
+ generally means better quality.{" "}
+ <a
+ href="https://unsloth.ai/docs/basics/inference-and-deployment"
+ target="_blank"
+ rel="noopener noreferrer"
+ className="text-primary underline"
+ >
+ Read more
+ </a>
+ </TooltipContent>
+ </Tooltip>
+ </label>
+ <Select
+ value={checkpoint ?? ""}
+ onValueChange={setCheckpoint}
+ disabled={!selectedModelIdx}
+ >
+ <SelectTrigger className="w-full">
+ <SelectValue
+ placeholder={
+ selectedModelIdx
+ ? checkpointsForModel.length === 0
+ ? "No checkpoints found"
+ : "Select a checkpoint…"
+ : "Select a training run first"
+ }
+ />
+ </SelectTrigger>
+ <SelectContent>
+ {checkpointsForModel.map((cp) => (
+ <SelectItem
+ key={cp.path}
+ value={cp.display_name}
+ >
<span className="flex items-center gap-2">
- {displayName}
- <span className="text-muted-foreground text-xs">
- {m.checkpoints.length} checkpoint
- {m.checkpoints.length !== 1 ? "s" : ""}
- </span>
- {timeStr && (
+ {cp.display_name}
+ {cp.loss != null && (
<span className="text-muted-foreground text-xs">
- · {timeStr}
+ loss: {cp.loss.toFixed(4)}
</span>
)}
</span>
</SelectItem>
- );
- })}
- </SelectContent>
- </Select>
+ ))}
+ </SelectContent>
+ </Select>
+ </div>
</div>
-
- <div
- data-tour="export-checkpoint"
- className="flex flex-col gap-2"
- >
- <label className="flex items-center gap-1.5 text-xs font-medium text-muted-foreground">
- Checkpoint
- <Tooltip>
- <TooltipTrigger asChild={true}>
- <button
- type="button"
- className="text-foreground/70 hover:text-foreground"
- >
- <HugeiconsIcon
- icon={InformationCircleIcon}
- className="size-3"
+ ) : (
+ <div className="flex flex-col gap-4 overflow-visible">
+ {modelSource === "hf" ? (
+ <>
+ <div className="flex flex-col gap-2">
+ <label className={FIELD_LABEL}>
+ Hugging Face model
+ </label>
+ <div ref={hfComboboxAnchorRef}>
+ <Combobox
+ items={hfResultIds}
+ filteredItems={hfResultIds}
+ filter={null}
+ value={
+ modelInput || selectedSourceModel || null
+ }
+ onValueChange={handleHfSourceModelSelect}
+ onInputValueChange={handleHfSourceInputChange}
+ itemToStringValue={(id) => id}
+ autoHighlight={true}
+ >
+ <ComboboxInput
+ placeholder="Search models..."
+ className="w-full"
+ onBlur={() =>
+ applyHfSourceModel(
+ hfModelInputRef.current,
+ )
+ }
+ onKeyDown={(event) => {
+ if (event.key !== "Enter") return;
+ event.preventDefault();
+ applyHfSourceModel(
+ hfModelInputRef.current,
+ );
+ }}
+ >
+ <InputGroupAddon>
+ <HugeiconsIcon
+ icon={Search01Icon}
+ className="size-4"
+ />
+ </InputGroupAddon>
+ </ComboboxInput>
+ <ComboboxContent anchor={hfComboboxAnchorRef}>
+ {isLoadingHfModels ? (
+ <div className="flex items-center justify-center py-4 gap-2 text-xs text-muted-foreground">
+ <Spinner className="size-4" />{" "}
+ Searching…
+ </div>
+ ) : (
+ <ComboboxEmpty>
+ No models found
+ </ComboboxEmpty>
+ )}
+ <ComboboxList>
+ {(id: string) => (
+ <ComboboxItem
+ key={id}
+ value={id}
+ className="gap-2"
+ >
+ <span className="block min-w-0 flex-1 truncate">
+ {id}
+ </span>
+ </ComboboxItem>
+ )}
+ </ComboboxList>
+ </ComboboxContent>
+ </Combobox>
+ </div>
+ {(tokenValidationError ?? hfSearchError) && (
+ <p className="text-xs text-destructive">
+ {tokenValidationError ?? hfSearchError}
+ </p>
+ )}
+ </div>
+ <div className="flex flex-col gap-2">
+ <label className={FIELD_LABEL}>
+ Hugging Face token (optional)
+ </label>
+ <InputGroup>
+ <InputGroupAddon>
+ <HugeiconsIcon
+ icon={Key01Icon}
+ className="size-4"
+ />
+ </InputGroupAddon>
+ <InputGroupInput
+ type="password"
+ autoComplete="new-password"
+ name="hf-token-export-source"
+ placeholder="hf_..."
+ value={hfToken}
+ onChange={(e) => setHfToken(e.target.value)}
/>
- </button>
- </TooltipTrigger>
- <TooltipContent>
- Choose a saved checkpoint to export. Lower loss
- generally means better quality.{" "}
- <a
- href="https://unsloth.ai/docs/basics/inference-and-deployment"
- target="_blank"
- rel="noopener noreferrer"
- className="text-primary underline"
- >
- Read more
- </a>
- </TooltipContent>
- </Tooltip>
- </label>
- <Select
- value={checkpoint ?? ""}
- onValueChange={setCheckpoint}
- disabled={!selectedModelIdx}
- >
- <SelectTrigger className="w-full">
- <SelectValue
- placeholder={
- selectedModelIdx
- ? checkpointsForModel.length === 0
- ? "No checkpoints found"
- : "Select a checkpoint…"
- : "Select a training run first"
- }
- />
- </SelectTrigger>
- <SelectContent>
- {checkpointsForModel.map((cp) => (
- <SelectItem key={cp.path} value={cp.display_name}>
- <span className="flex items-center gap-2">
- {cp.display_name}
- {cp.loss != null && (
- <span className="text-muted-foreground text-xs">
- loss: {cp.loss.toFixed(4)}
- </span>
- )}
- </span>
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- </div>
- </div>
- ) : (
- <div className="flex flex-col gap-2 overflow-visible">
- {modelSource === "hf" ? (
- <>
+ </InputGroup>
+ {isCheckingToken && (
+ <p className="text-xs text-muted-foreground">
+ Checking token…
+ </p>
+ )}
+ </div>
+ </>
+ ) : (
<div className="flex flex-col gap-2">
- <label className="text-xs font-medium text-muted-foreground">
- Hugging Face Model
+ <label className={FIELD_LABEL}>
+ Local model path
</label>
- <div ref={hfComboboxAnchorRef}>
+ <div ref={localComboboxAnchorRef}>
<Combobox
- items={hfResultIds}
- filteredItems={hfResultIds}
+ items={localResultIds}
+ filteredItems={localFilteredIds}
filter={null}
- value={
- modelInput || selectedSourceModel || null
+ value={localModelInput || null}
+ onValueChange={(id) => {
+ const next = id ?? "";
+ localModelInputRef.current = next;
+ setLocalModelInput(next);
+ setSelectedSourceModel(next || null);
+ }}
+ onInputValueChange={
+ handleLocalSourceInputChange
}
- onValueChange={handleHfSourceModelSelect}
- onInputValueChange={handleHfSourceInputChange}
itemToStringValue={(id) => id}
autoHighlight={true}
>
<ComboboxInput
- placeholder="Search models..."
+ placeholder={
+ isLoadingLocalModels
+ ? "Scanning local and cached models..."
+ : "./models/my-model"
+ }
className="w-full"
onBlur={() =>
- applyHfSourceModel(hfModelInputRef.current)
+ applyLocalSourceModel(
+ localModelInputRef.current,
+ )
}
onKeyDown={(event) => {
if (event.key !== "Enter") return;
event.preventDefault();
- applyHfSourceModel(hfModelInputRef.current);
+ applyLocalSourceModel(
+ localModelInputRef.current,
+ );
}}
>
<InputGroupAddon>
<HugeiconsIcon
- icon={Search01Icon}
+ icon={FolderSearchIcon}
className="size-4"
/>
</InputGroupAddon>
</ComboboxInput>
- <ComboboxContent anchor={hfComboboxAnchorRef}>
- {isLoadingHfModels ? (
- <div className="flex items-center justify-center py-4 gap-2 text-xs text-muted-foreground">
- <Spinner className="size-4" /> Searching…
+ <ComboboxContent
+ anchor={localComboboxAnchorRef}
+ >
+ {isLoadingLocalModels ? (
+ <div className="flex items-center justify-center gap-2 py-4 text-xs text-muted-foreground">
+ <Spinner className="size-4" /> Scanning...
+ </div>
+ ) : localModelsError ? (
+ <div className="px-3 py-2 text-xs text-red-500">
+ {localModelsError}
</div>
) : (
<ComboboxEmpty>
- No models found
+ No local models found
</ComboboxEmpty>
)}
<ComboboxList>
- {(id: string) => (
- <ComboboxItem
- key={id}
- value={id}
- className="gap-2"
- >
- <span className="block min-w-0 flex-1 truncate">
- {id}
- </span>
- </ComboboxItem>
- )}
+ {(id: string) => {
+ const model = localMetaById.get(id);
+ const source =
+ model?.source === "hf_cache"
+ ? "HF cache"
+ : model?.source === "custom"
+ ? "Custom Folders"
+ : "Local dir";
+ return (
+ <ComboboxItem
+ key={id}
+ value={id}
+ className="gap-2"
+ >
+ <span className="block min-w-0 flex-1 truncate">
+ {model?.display_name ?? id}
+ </span>
+ <span className="ml-auto shrink-0 text-ui-10 text-muted-foreground">
+ {source}
+ </span>
+ </ComboboxItem>
+ );
+ }}
</ComboboxList>
</ComboboxContent>
</Combobox>
</div>
- {(tokenValidationError ?? hfSearchError) && (
- <p className="text-xs text-destructive">
- {tokenValidationError ?? hfSearchError}
+ {isLoadingLocalModels ? (
+ <p className="text-ui-10 text-muted-foreground">
+ Scanning local models...
</p>
- )}
- </div>
- <div className="flex flex-col gap-1.5">
- <label className="text-xs font-medium text-muted-foreground">
- Hugging Face Token (Optional)
- </label>
- <InputGroup>
- <InputGroupAddon>
- <HugeiconsIcon
- icon={Key01Icon}
- className="size-4"
- />
- </InputGroupAddon>
- <InputGroupInput
- type="password"
- autoComplete="new-password"
- name="hf-token-export-source"
- placeholder="hf_..."
- value={hfToken}
- onChange={(e) => setHfToken(e.target.value)}
- />
- </InputGroup>
- {isCheckingToken && (
- <p className="text-xs text-muted-foreground">
- Checking token…
+ ) : localModelsError ? (
+ <p className="text-ui-10 text-red-500">
+ {localModelsError}
+ </p>
+ ) : (
+ <p className="text-ui-10 text-muted-foreground">
+ {exportableLocalModels.length > 0
+ ? `${exportableLocalModels.length} local/cached models found`
+ : "No local models found. Enter path manually."}
</p>
)}
</div>
- </>
- ) : (
- <div className="flex flex-col gap-2">
- <label className="text-xs font-medium text-muted-foreground">
- Local Model Path
- </label>
- <div ref={localComboboxAnchorRef}>
- <Combobox
- items={localResultIds}
- filteredItems={localFilteredIds}
- filter={null}
- value={localModelInput || null}
- onValueChange={(id) => {
- const next = id ?? "";
- localModelInputRef.current = next;
- setLocalModelInput(next);
- setSelectedSourceModel(next || null);
- }}
- onInputValueChange={handleLocalSourceInputChange}
- itemToStringValue={(id) => id}
- autoHighlight={true}
- >
- <ComboboxInput
- placeholder={
- isLoadingLocalModels
- ? "Scanning local and cached models..."
- : "./models/my-model"
- }
- className="w-full"
- onBlur={() =>
- applyLocalSourceModel(
- localModelInputRef.current,
- )
- }
- onKeyDown={(event) => {
- if (event.key !== "Enter") return;
- event.preventDefault();
- applyLocalSourceModel(
- localModelInputRef.current,
- );
- }}
+ )}
+
+ <div className="rounded-lg bg-[color-mix(in_oklab,var(--foreground)_calc(4%*var(--contrast-wash-gain,1)),transparent)] p-3">
+ <p className="text-ui-11 text-muted-foreground">
+ Direct model exports currently support GGUF only.
+ </p>
+ </div>
+ </div>
+ )}
+ </div>
+ </SectionBox>
+
+ <SectionBox
+ title="Export method"
+ description="How the model is packaged for deployment"
+ icon={PackageIcon}
+ chipTint="var(--chart-1)"
+ >
+ <div className="flex flex-col gap-6">
+ {exportUnsupported && (
+ <Alert variant="destructive">
+ <HugeiconsIcon
+ icon={AlertCircleIcon}
+ className="size-4"
+ />
+ <AlertTitle>Export unavailable</AlertTitle>
+ <AlertDescription>
+ {exportUnsupportedMessage}
+ {fullInstall && (
+ <div className="mt-2">
+ <Button
+ size="xs"
+ onClick={() => setFullInstallOpen(true)}
>
- <InputGroupAddon>
- <HugeiconsIcon
- icon={FolderSearchIcon}
- className="size-4"
- />
- </InputGroupAddon>
- </ComboboxInput>
- <ComboboxContent anchor={localComboboxAnchorRef}>
- {isLoadingLocalModels ? (
- <div className="flex items-center justify-center gap-2 py-4 text-xs text-muted-foreground">
- <Spinner className="size-4" /> Scanning...
- </div>
- ) : localModelsError ? (
- <div className="px-3 py-2 text-xs text-red-500">
- {localModelsError}
- </div>
- ) : (
- <ComboboxEmpty>
- No local models found
- </ComboboxEmpty>
- )}
- <ComboboxList>
- {(id: string) => {
- const model = localMetaById.get(id);
- const source =
- model?.source === "hf_cache"
- ? "HF cache"
- : model?.source === "custom"
- ? "Custom Folders"
- : "Local dir";
- return (
- <ComboboxItem
- key={id}
- value={id}
- className="gap-2"
+ Install Training
+ </Button>
+ </div>
+ )}
+ </AlertDescription>
+ </Alert>
+ )}
+ {fullInstall && (
+ <FullInstallDialog
+ open={fullInstallOpen}
+ onOpenChange={setFullInstallOpen}
+ onConfirm={() => void fullInstall.repairInstall()}
+ />
+ )}
+
+ <MethodPicker
+ value={exportMethod}
+ onChange={handleMethodChange}
+ disabledMethods={
+ exportUnsupported
+ ? ["merged", "lora", "gguf"]
+ : isDecision
+ ? ["merged", "lora"]
+ : !effectiveIsAdapter && effectiveIsQuantized
+ ? ["merged", "lora", "gguf"]
+ : [
+ ...(effectiveIsAdapter
+ ? []
+ : (["lora"] as const)),
+ ...diffusionDisabledMethods,
+ ]
+ }
+ disabledReason={
+ exportUnsupported
+ ? exportUnsupportedMessage
+ : isDecision
+ ? t("exportDecision.ggufOnly")
+ : !effectiveIsAdapter && effectiveIsQuantized
+ ? "Pre-quantized (BNB 4-bit) models cannot be exported without LoRA adapters"
+ : [
+ effectiveIsAdapter
+ ? null
+ : "LoRA-only export needs a LoRA adapter checkpoint",
+ diffusionDisabledMethods.length > 0
+ ? diffusionLmInfo?.reason
+ : null,
+ ]
+ .filter(Boolean)
+ .join(" ") || undefined
+ }
+ />
+
+ {exportMethod === "merged" && !exportUnsupported && (
+ <div className="space-y-3">
+ <div className="space-y-2">
+ <div className="flex items-center justify-between">
+ <div className="text-sm font-medium">Precision</div>
+ {availableFormats.length > 1 && (
+ <span className="text-ui-11 text-muted-foreground/70">
+ Select one or more
+ </span>
+ )}
+ </div>
+ <div className="flex flex-wrap gap-2">
+ {availableFormats
+ .filter((f) => f.common)
+ .map((f) => {
+ const active = selectedFormats.includes(
+ f.value,
+ );
+ return (
+ <Button
+ key={f.value}
+ type="button"
+ variant={active ? "dark" : "outline"}
+ size="sm"
+ onClick={() => toggleFormat(f.value)}
+ title={f.hint}
+ >
+ {f.label}
+ {f.needsCalibration ? " *" : ""}
+ </Button>
+ );
+ })}
+
+ {availableFormats.some((f) => !f.common) && (
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild={true}>
+ <Button
+ type="button"
+ variant="outline"
+ size="sm"
+ >
+ More formats
+ {selectedFormats.some((v) =>
+ availableFormats.find(
+ (f) => f.value === v && !f.common,
+ ),
+ )
+ ? " ✓"
+ : "…"}
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent
+ align="start"
+ className="w-64"
+ >
+ <DropdownMenuLabel>
+ Additional formats
+ </DropdownMenuLabel>
+ <DropdownMenuSeparator />
+ {availableFormats
+ .filter((f) => !f.common)
+ .map((f) => (
+ <DropdownMenuCheckboxItem
+ key={f.value}
+ checked={selectedFormats.includes(
+ f.value,
+ )}
+ onCheckedChange={() =>
+ toggleFormat(f.value)
+ }
+ onSelect={(e) => e.preventDefault()}
>
- <span className="block min-w-0 flex-1 truncate">
- {model?.display_name ?? id}
+ <span className="flex flex-col">
+ <span>
+ {f.label}
+ {f.needsCalibration ? " *" : ""}
+ </span>
+ <span className="text-ui-10 text-muted-foreground">
+ {f.hint}
+ </span>
</span>
- <span className="ml-auto shrink-0 text-ui-10 text-muted-foreground">
- {source}
- </span>
- </ComboboxItem>
- );
- }}
- </ComboboxList>
- </ComboboxContent>
- </Combobox>
+ </DropdownMenuCheckboxItem>
+ ))}
+ </DropdownMenuContent>
+ </DropdownMenu>
+ )}
</div>
- {isLoadingLocalModels ? (
- <p className="text-ui-10 text-muted-foreground">
- Scanning local models...
- </p>
- ) : localModelsError ? (
- <p className="text-ui-10 text-red-500">
- {localModelsError}
- </p>
- ) : (
- <p className="text-ui-10 text-muted-foreground">
- {exportableLocalModels.length > 0
- ? `${exportableLocalModels.length} local/cached models found`
- : "No local models found. Enter path manually."}
- </p>
+
+ {availableFormats.length > 1 &&
+ selectedFormats.length > 0 && (
+ <div className="flex flex-wrap items-center gap-x-3 gap-y-1">
+ <span className="text-ui-11 text-muted-foreground">
+ {selectedFormats.length} selected:{" "}
+ {selectedFormats
+ .map(
+ (v) =>
+ MERGED_FORMATS.find(
+ (f) => f.value === v,
+ )?.label ?? v,
+ )
+ .join(", ")}
+ </span>
+ {selectedFormats.length > 1 && (
+ <button
+ type="button"
+ onClick={() =>
+ setSelectedFormats(["16-bit"])
+ }
+ className="text-ui-11 text-muted-foreground/70 hover:text-foreground transition-colors"
+ >
+ Reset to 16-bit
+ </button>
+ )}
+ </div>
+ )}
+
+ {hubMultiFormat && (
+ <div className="text-ui-11 text-amber-600 dark:text-amber-500">
+ Hub export supports one format at a time (each
+ writes to the repository root). Select a single
+ format, or export locally to produce several at
+ once.
+ </div>
)}
- </div>
- )}
- <div className="rounded-lg bg-[color-mix(in_oklab,var(--foreground)_calc(4%*var(--contrast-wash-gain,1)),transparent)] p-3">
- <p className="text-ui-11 text-muted-foreground">
- Direct model exports currently support GGUF only.
- </p>
- </div>
- </div>
- )}
-
- {sourceMode === "checkpoint" && (
- <div className="rounded-lg bg-[color-mix(in_oklab,var(--foreground)_calc(4%*var(--contrast-wash-gain,1)),transparent)] p-3 flex flex-col gap-2">
- <span className="text-ui-11 font-medium text-muted-foreground uppercase tracking-wider">
- Training Info
- </span>
- <div className="grid grid-cols-1 gap-x-6 gap-y-1.5 text-xs sm:grid-cols-2">
- <div className="flex justify-between">
- <span className="text-muted-foreground">
- Base Model
- </span>
- <span className="font-medium">{baseModelName}</span>
- </div>
- <div className="flex justify-between">
- <span className="text-muted-foreground">Method</span>
- <span className="font-medium">
- {trainingMethodLabel}
- </span>
- </div>
- <div className="flex justify-between">
- <span className="text-muted-foreground">
- Checkpoints
- </span>
- <span className="font-medium">
- {checkpointsForModel.length}
- </span>
- </div>
- {isAdapter && (
- <div className="flex justify-between">
- <span className="text-muted-foreground">
- LoRA Rank
- </span>
- <span className="font-medium">{loraRank}</span>
- </div>
- )}
- </div>
- </div>
- )}
- </div>
-
- <div className="flex flex-col gap-2.5">
- <span className="text-xs font-medium text-muted-foreground">
- Quick Guide
- </span>
- <ol className="flex flex-col gap-3">
- {exportGuideSteps.map((step, i) => (
- <li
- key={step}
- className="flex items-start gap-2 text-xs text-muted-foreground"
- >
- <span className="flex size-5 shrink-0 items-center justify-center rounded-full bg-[color-mix(in_oklab,var(--foreground)_calc(10%*var(--contrast-wash-gain,1)),transparent)] text-ui-10 font-semibold">
- {i + 1}
- </span>
- {step}
- </li>
- ))}
- </ol>
- </div>
- </div>
+ {selectedFormats.some(
+ (v) =>
+ MERGED_FORMATS.find((f) => f.value === v)
+ ?.needsCalibration,
+ ) && (
+ <div className="text-ui-11 text-muted-foreground">
+ * calibrates on data (uses a small calibration
+ set).
+ </div>
+ )}
- {exportUnsupported && (
- <Alert variant="destructive">
- <HugeiconsIcon icon={AlertCircleIcon} className="size-4" />
- <AlertTitle>Export unavailable</AlertTitle>
- <AlertDescription>
- {exportUnsupportedMessage}
- {fullInstall && (
- <div className="mt-2">
- <Button size="xs" onClick={() => setFullInstallOpen(true)}>
- Install Training
- </Button>
+ {!hasNvidia && !torchaoUnavailable && (
+ <div className="text-ui-11 text-muted-foreground">
+ No NVIDIA GPU detected: compressed-tensors formats
+ are hidden. 16-bit and portable FP8/INT8 (torchao)
+ still work here and load in vLLM.
+ </div>
+ )}
+
+ {torchaoUnavailable && (
+ <div className="text-ui-11 text-muted-foreground">
+ Portable FP8/INT8 (torchao) export needs torchao
+ 0.15 or newer, which is not installed here. Update
+ Unsloth, or use 16-bit or GGUF.
+ </div>
+ )}
+ </div>
</div>
)}
- </AlertDescription>
- </Alert>
- )}
- {fullInstall && (
- <FullInstallDialog
- open={fullInstallOpen}
- onOpenChange={setFullInstallOpen}
- onConfirm={() => void fullInstall.repairInstall()}
- />
- )}
-
- <MethodPicker
- value={exportMethod}
- onChange={handleMethodChange}
- disabledMethods={
- exportUnsupported
- ? ["merged", "lora", "gguf"]
- : isDecision
- ? ["merged", "lora"]
- : !effectiveIsAdapter && effectiveIsQuantized
- ? ["merged", "lora", "gguf"]
- : [
- ...(effectiveIsAdapter ? [] : (["lora"] as const)),
- ...diffusionDisabledMethods,
- ]
- }
- disabledReason={
- exportUnsupported
- ? exportUnsupportedMessage
- : isDecision
- ? t("exportDecision.ggufOnly")
- : !effectiveIsAdapter && effectiveIsQuantized
- ? "Pre-quantized (BNB 4-bit) models cannot be exported without LoRA adapters"
- : [
- effectiveIsAdapter
- ? null
- : "LoRA-only export needs a LoRA adapter checkpoint",
- diffusionDisabledMethods.length > 0
- ? diffusionLmInfo?.reason
- : null,
- ]
- .filter(Boolean)
- .join(" ") || undefined
- }
- />
-
- {exportMethod === "merged" && !exportUnsupported && (
- <div className="space-y-3">
- <div className="space-y-2">
- <div className="flex items-center justify-between">
- <div className="text-sm font-medium">Precision</div>
- <span className="text-ui-11 text-muted-foreground/70">
- — select one or more
- </span>
- </div>
- <div className="flex flex-wrap gap-2">
- {availableFormats
- .filter((f) => f.common)
- .map((f) => {
- const active = selectedFormats.includes(f.value);
- return (
- <Button
- key={f.value}
- type="button"
- variant={active ? "dark" : "outline"}
- size="sm"
- onClick={() => toggleFormat(f.value)}
- title={f.hint}
+
+ {exportMethod === "lora" &&
+ effectiveIsAdapter &&
+ !exportUnsupported && (
+ <div className="space-y-3">
+ <div className="space-y-2">
+ <div className="text-sm font-medium">
+ Adapter format
+ </div>
+ <div className="flex flex-wrap gap-2">
+ <Button
+ type="button"
+ variant={loraAsGguf ? "outline" : "dark"}
+ size="sm"
+ onClick={() => setLoraAsGguf(false)}
+ title="Adapter weights as safetensors."
+ >
+ Adapter (safetensors)
+ </Button>
+ <Button
+ type="button"
+ variant={loraAsGguf ? "dark" : "outline"}
+ size="sm"
+ onClick={() => setLoraAsGguf(true)}
+ disabled={diffusionDisabledMethods.includes(
+ "gguf",
+ )}
+ title={
+ diffusionDisabledMethods.includes("gguf")
+ ? (diffusionLmInfo?.reason ?? undefined)
+ : "llama.cpp GGUF LoRA, loadable with `llama-cli --lora`."
+ }
+ >
+ GGUF adapter
+ </Button>
+ </div>
+ <div className="text-xs text-muted-foreground">
+ {loraAsGguf
+ ? isMacHost
+ ? "Converts the adapter to a GGUF LoRA (llama.cpp `--lora`); the adapter files are written in PEFT format. Not available for adapters with per-module alpha values, rsLoRA with per-module ranks, DoRA, replaced embeddings or modules_to_save, or expert-parameter targets."
+ : "Converts the adapter to a GGUF LoRA (llama.cpp `--lora`). The base model stays separate."
+ : isMacHost
+ ? "Adapter weights only; pick the on-disk format below."
+ : "Standard PEFT adapter files. Pair with the base model at inference."}
+ </div>
+ </div>
+
+ {!loraAsGguf && isMacHost && (
+ <div
+ className="space-y-2"
+ data-testid="adapter-format-picker"
>
- {f.label}
- {f.needsCalibration ? " *" : ""}
- </Button>
- );
- })}
-
- {availableFormats.some((f) => !f.common) && (
- <DropdownMenu>
- <DropdownMenuTrigger asChild={true}>
- <Button type="button" variant="outline" size="sm">
- More formats
- {selectedFormats.some((v) =>
- availableFormats.find(
- (f) => f.value === v && !f.common,
- ),
- )
- ? " ✓"
- : "…"}
- </Button>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="start" className="w-64">
- <DropdownMenuLabel>
- Additional formats
- </DropdownMenuLabel>
- <DropdownMenuSeparator />
- {availableFormats
- .filter((f) => !f.common)
- .map((f) => (
- <DropdownMenuCheckboxItem
- key={f.value}
- checked={selectedFormats.includes(f.value)}
- onCheckedChange={() => toggleFormat(f.value)}
- onSelect={(e) => e.preventDefault()}
+ <div className="text-sm font-medium">
+ Safetensors format
+ </div>
+ <div className="flex flex-wrap gap-2">
+ <Button
+ type="button"
+ variant={
+ adapterFormat === "mlx" ? "dark" : "outline"
+ }
+ size="sm"
+ onClick={() => setAdapterFormat("mlx")}
+ title="Native mlx-lm adapter (adapters.safetensors)."
>
- <span className="flex flex-col">
- <span>
- {f.label}
- {f.needsCalibration ? " *" : ""}
- </span>
- <span className="text-ui-10 text-muted-foreground">
- {f.hint}
- </span>
- </span>
- </DropdownMenuCheckboxItem>
- ))}
- </DropdownMenuContent>
- </DropdownMenu>
- )}
- </div>
-
- {selectedFormats.length > 0 && (
- <div className="flex flex-wrap items-center gap-x-3 gap-y-1">
- <span className="text-ui-11 text-muted-foreground">
- {selectedFormats.length} selected:{" "}
- {selectedFormats
- .map(
- (v) =>
- MERGED_FORMATS.find((f) => f.value === v)
- ?.label ?? v,
- )
- .join(", ")}
- </span>
- {selectedFormats.length > 1 && (
- <button
- type="button"
- onClick={() => setSelectedFormats(["16-bit"])}
- className="text-ui-11 text-muted-foreground/70 hover:text-foreground transition-colors"
- >
- Reset to 16-bit
- </button>
- )}
- </div>
- )}
+ MLX
+ </Button>
+ <Button
+ type="button"
+ variant={
+ adapterFormat === "peft"
+ ? "dark"
+ : "outline"
+ }
+ size="sm"
+ onClick={() => setAdapterFormat("peft")}
+ title="Standard Hugging Face PEFT adapter (adapter_model.safetensors)."
+ >
+ PEFT
+ </Button>
+ </div>
+ <div className="text-xs text-muted-foreground">
+ {adapterCompatibilityTip(
+ adapterFormat,
+ selectedModelData?.adapter_features,
+ )}{" "}
+ Training checkpoints always remain MLX; this
+ choice only affects the exported copy.
+ </div>
+ </div>
+ )}
- {hubMultiFormat && (
- <div className="text-ui-11 text-amber-600 dark:text-amber-500">
- Hub export supports one format at a time (each writes to
- the repository root). Select a single format, or export
- locally to produce several at once.
- </div>
- )}
+ {loraAsGguf && (
+ <div className="space-y-1.5">
+ <div className="text-sm font-medium">
+ Output type
+ </div>
+ <Select
+ value={loraGgufOuttype}
+ onValueChange={(v) => setLoraGgufOuttype(v)}
+ >
+ <SelectTrigger className="w-full sm:w-56">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ {LORA_GGUF_OUTTYPES.map((t) => (
+ <SelectItem key={t} value={t}>
+ {t.toUpperCase()}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </div>
+ )}
+ </div>
+ )}
- {selectedFormats.some(
- (v) =>
- MERGED_FORMATS.find((f) => f.value === v)
- ?.needsCalibration,
- ) && (
- <div className="text-ui-11 text-muted-foreground">
- * calibrates on data (uses a small calibration set).
- </div>
- )}
+ {exportMethod === "gguf" &&
+ !exportUnsupported &&
+ decisionInfo && (
+ <div className="space-y-3">
+ {decisionIneligible ? (
+ <Alert variant="destructive">
+ <HugeiconsIcon
+ icon={AlertCircleIcon}
+ className="size-4"
+ />
+ <AlertTitle>
+ {t("exportDecision.notEligibleTitle")}
+ </AlertTitle>
+ <AlertDescription>
+ {decisionInfo.reason}
+ </AlertDescription>
+ </Alert>
+ ) : (
+ <>
+ <div className="space-y-1">
+ <div className="text-sm font-medium">
+ {t("exportDecision.title")}
+ </div>
+ <div className="text-xs text-muted-foreground">
+ {t("exportDecision.description", {
+ layout:
+ decisionInfo.layout === "clef"
+ ? "Clef"
+ : "Laya",
+ })}
+ </div>
+ {decisionInfo.adapter_only && (
+ <div className="text-xs text-muted-foreground">
+ {t("exportDecision.adapterNote")}
+ </div>
+ )}
+ </div>
+ <QuantPicker
+ value={quantLevels}
+ onChange={setQuantLevels}
+ options={decisionQuantOptions}
+ />
+ {decisionExistingQuants.length > 0 && (
+ <div className="text-xs text-muted-foreground">
+ {t("exportDecision.existing", {
+ quantizations:
+ decisionExistingQuants.join(", "),
+ })}
+ </div>
+ )}
+ </>
+ )}
+ </div>
+ )}
- {!hasNvidia && !torchaoUnavailable && (
- <div className="text-ui-11 text-muted-foreground">
- No NVIDIA GPU detected: compressed-tensors formats are
- hidden. 16-bit and portable FP8/INT8 (torchao) still
- work here and load in vLLM.
- </div>
- )}
+ {exportMethod === "gguf" &&
+ !exportUnsupported &&
+ !decisionInfo && (
+ <div className="space-y-3">
+ {effectiveIsAdapter && !isMacHost && (
+ <div className="space-y-2">
+ <div className="text-sm font-medium">
+ Export target
+ </div>
+ <div className="flex flex-wrap gap-2">
+ <Button
+ type="button"
+ variant={
+ ggufTarget === "model" ? "dark" : "outline"
+ }
+ size="sm"
+ onClick={() => setGgufTarget("model")}
+ title="Merge the adapter into the base model, then quantize the full model to GGUF."
+ >
+ Full model
+ </Button>
+ <Button
+ type="button"
+ variant={
+ ggufTarget === "lora" ? "dark" : "outline"
+ }
+ size="sm"
+ onClick={() => setGgufTarget("lora")}
+ title="Export just the adapter as a GGUF LoRA (llama.cpp `--lora`); the base model stays separate."
+ >
+ LoRA adapter
+ </Button>
+ </div>
+ <div className="text-xs text-muted-foreground">
+ {ggufTarget === "lora"
+ ? "Converts the adapter to a GGUF LoRA (llama.cpp `--lora`). The base model stays separate."
+ : "Merges the adapter into the base model, then quantizes the full model to GGUF."}
+ </div>
+ </div>
+ )}
- {torchaoUnavailable && (
- <div className="text-ui-11 text-muted-foreground">
- Portable FP8/INT8 (torchao) export needs torchao 0.15 or
- newer, which is not installed here. Update Unsloth, or use
- 16-bit or GGUF.
- </div>
+ {ggufAsLora ? (
+ <div className="space-y-1.5">
+ <div className="text-sm font-medium">
+ Output type
+ </div>
+ <Select
+ value={loraGgufOuttype}
+ onValueChange={(v) => setLoraGgufOuttype(v)}
+ >
+ <SelectTrigger className="w-full sm:w-56">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ {LORA_GGUF_OUTTYPES.map((t) => (
+ <SelectItem key={t} value={t}>
+ {t.toUpperCase()}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </div>
+ ) : (
+ <>
+ <QuantPicker
+ value={quantLevels}
+ onChange={setQuantLevels}
+ sizes={quantSizeLabels}
+ />
+ <div className="flex items-start justify-between gap-3 rounded-lg border p-3">
+ <div className="space-y-0.5">
+ <div className="text-sm font-medium">
+ Importance matrix (imatrix)
+ </div>
+ <div className="text-xs text-muted-foreground">
+ {requiresImatrix
+ ? "Required for the selected IQ low-bit quant."
+ : "Improves quant quality and unlocks the IQ low-bit quants."}
+ </div>
+ </div>
+ <Switch
+ className="mt-[var(--ui-title-cap-inset)]"
+ aria-label="Importance matrix (imatrix)"
+ checked={effectiveImatrix}
+ onCheckedChange={setUseImatrix}
+ disabled={requiresImatrix}
+ />
+ </div>
+ {effectiveImatrix && (
+ <div className="space-y-1.5">
+ <label
+ htmlFor="export-imatrix-path"
+ className="text-sm font-medium"
+ >
+ Local imatrix file (optional)
+ </label>
+ <InputGroup>
+ <InputGroupInput
+ id="export-imatrix-path"
+ aria-describedby="export-imatrix-path-help"
+ placeholder="/path/to/imatrix.gguf"
+ value={imatrixPath}
+ onChange={(e) =>
+ setCustomImatrix({
+ sourceKey: imatrixSourceKey,
+ path: e.target.value,
+ })
+ }
+ />
+ </InputGroup>
+ <p
+ id="export-imatrix-path-help"
+ className="text-xs text-muted-foreground"
+ >
+ Absolute path to a .dat or .gguf imatrix
+ file on the machine running Unsloth. Leave
+ blank to auto-download the upstream Unsloth
+ imatrix for the base model, if one exists.
+ </p>
+ </div>
+ )}
+ {hasNpu && (
+ <div className="flex items-start justify-between gap-3 rounded-lg border p-3">
+ <div className="space-y-0.5">
+ <div className="text-sm font-medium">
+ Also convert to Q4NX (AMD NPU)
+ </div>
+ <div className="text-xs text-muted-foreground">
+ {destination !== "local"
+ ? "Local destination only."
+ : q4nxSourceSelected
+ ? "Adds a Q4NX copy next to the GGUFs. Only supported on AMD NPUs."
+ : "Needs Q4_0, Q4_1 or Q4_K_M."}
+ </div>
+ </div>
+ <Switch
+ className="mt-[var(--ui-title-cap-inset)]"
+ aria-label="Also convert to Q4NX (AMD NPU)"
+ checked={effectiveNpuQ4nx}
+ onCheckedChange={setNpuQ4nx}
+ disabled={
+ !q4nxSourceSelected ||
+ destination !== "local"
+ }
+ />
+ </div>
+ )}
+ </>
+ )}
+ </div>
+ )}
+ {showReap && moeInfo && (
+ <ReapCard
+ moe={moeInfo}
+ settings={reapSettings}
+ onChange={setReapSettings}
+ disabled={isExporting}
+ />
)}
- </div>
- </div>
- )}
-
- {exportMethod === "lora" &&
- effectiveIsAdapter &&
- !exportUnsupported && (
- <div className="space-y-3">
- <div className="space-y-2">
- <div className="text-sm font-medium">Adapter format</div>
- <div className="flex flex-wrap gap-2">
- <Button
- type="button"
- variant={loraAsGguf ? "outline" : "dark"}
- size="sm"
- onClick={() => setLoraAsGguf(false)}
- title="Adapter weights as safetensors."
- >
- Adapter (safetensors)
- </Button>
- <Button
- type="button"
- variant={loraAsGguf ? "dark" : "outline"}
- size="sm"
- onClick={() => setLoraAsGguf(true)}
- disabled={diffusionDisabledMethods.includes("gguf")}
- title={
- diffusionDisabledMethods.includes("gguf")
- ? (diffusionLmInfo?.reason ?? undefined)
- : "llama.cpp GGUF LoRA, loadable with `llama-cli --lora`."
- }
- >
- GGUF adapter
- </Button>
- </div>
- <div className="text-xs text-muted-foreground">
- {loraAsGguf
- ? isMacHost
- ? "Converts the adapter to a GGUF LoRA (llama.cpp `--lora`); the adapter files are written in PEFT format. Not available for adapters with per-module alpha values, rsLoRA with per-module ranks, DoRA, replaced embeddings or modules_to_save, or expert-parameter targets."
- : "Converts the adapter to a GGUF LoRA (llama.cpp `--lora`). The base model stays separate."
- : isMacHost
- ? "Adapter weights only; pick the on-disk format below."
- : "Standard PEFT adapter files. Pair with the base model at inference."}
- </div>
- </div>
-
- {!loraAsGguf && isMacHost && (
+ {reapFailed && (
<div
- className="space-y-2"
- data-testid="adapter-format-picker"
+ role="alert"
+ className="rounded-lg border border-amber-500/40 bg-amber-500/5 p-3 text-xs"
>
- <div className="text-sm font-medium">
- Safetensors format
- </div>
- <div className="flex flex-wrap gap-2">
+ <p>
+ Expert pruning (REAP) is on, but checking whether this
+ model can be pruned failed. Retry, or turn pruning off
+ to export the full model.
+ </p>
+ <div className="mt-2 flex gap-2">
<Button
type="button"
- variant={
- adapterFormat === "mlx" ? "dark" : "outline"
- }
+ variant="outline"
size="sm"
- onClick={() => setAdapterFormat("mlx")}
- title="Native mlx-lm adapter (adapters.safetensors)."
+ onClick={() => setMoeRetry((n) => n + 1)}
>
- MLX
+ Retry
</Button>
<Button
type="button"
- variant={
- adapterFormat === "peft" ? "dark" : "outline"
- }
+ variant="ghost"
size="sm"
- onClick={() => setAdapterFormat("peft")}
- title="Standard Hugging Face PEFT adapter (adapter_model.safetensors)."
+ onClick={() =>
+ setReapSettings((s) => ({ ...s, enabled: false }))
+ }
>
- PEFT
+ Turn off expert pruning
</Button>
</div>
- <div className="text-xs text-muted-foreground">
- {adapterCompatibilityTip(
- adapterFormat,
- selectedModelData?.adapter_features,
- )}{" "}
- Training checkpoints always remain MLX; this choice
- only affects the exported copy.
- </div>
- </div>
- )}
-
- {loraAsGguf && (
- <div className="space-y-1.5">
- <div className="text-sm font-medium">Output type</div>
- <Select
- value={loraGgufOuttype}
- onValueChange={(v) => setLoraGgufOuttype(v)}
- >
- <SelectTrigger className="w-full sm:w-56">
- <SelectValue />
- </SelectTrigger>
- <SelectContent>
- {LORA_GGUF_OUTTYPES.map((t) => (
- <SelectItem key={t} value={t}>
- {t.toUpperCase()}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
</div>
)}
- </div>
- )}
-
- {exportMethod === "gguf" && !exportUnsupported && decisionInfo && (
- <div className="space-y-3">
- {decisionIneligible ? (
- <Alert variant="destructive">
- <HugeiconsIcon icon={AlertCircleIcon} className="size-4" />
- <AlertTitle>{t("exportDecision.notEligibleTitle")}</AlertTitle>
- <AlertDescription>{decisionInfo.reason}</AlertDescription>
- </Alert>
- ) : (
- <>
- <div className="space-y-1">
- <div className="text-sm font-medium">
- {t("exportDecision.title")}
- </div>
- <div className="text-xs text-muted-foreground">
- {t("exportDecision.description", {
- layout: decisionInfo.layout === "clef" ? "Clef" : "Laya",
- })}
- </div>
- {decisionInfo.adapter_only && (
- <div className="text-xs text-muted-foreground">
- {t("exportDecision.adapterNote")}
- </div>
- )}
- </div>
- <QuantPicker
- value={quantLevels}
- onChange={setQuantLevels}
- options={decisionQuantOptions}
- />
- {decisionExistingQuants.length > 0 && (
- <div className="text-xs text-muted-foreground">
- {t("exportDecision.existing", {
- quantizations: decisionExistingQuants.join(", "),
- })}
- </div>
- )}
- </>
- )}
- </div>
- )}
-
- {exportMethod === "gguf" && !exportUnsupported && !decisionInfo && (
- <div className="space-y-3">
- {effectiveIsAdapter && !isMacHost && (
- <div className="space-y-2">
- <div className="text-sm font-medium">Export target</div>
- <div className="flex flex-wrap gap-2">
- <Button
- type="button"
- variant={
- ggufTarget === "model" ? "dark" : "outline"
- }
- size="sm"
- onClick={() => setGgufTarget("model")}
- title="Merge the adapter into the base model, then quantize the full model to GGUF."
- >
- Full model
- </Button>
- <Button
- type="button"
- variant={
- ggufTarget === "lora" ? "dark" : "outline"
- }
- size="sm"
- onClick={() => setGgufTarget("lora")}
- title="Export just the adapter as a GGUF LoRA (llama.cpp `--lora`); the base model stays separate."
- >
- LoRA adapter
- </Button>
- </div>
- <div className="text-xs text-muted-foreground">
- {ggufTarget === "lora"
- ? "Converts the adapter to a GGUF LoRA (llama.cpp `--lora`). The base model stays separate."
- : "Merges the adapter into the base model, then quantizes the full model to GGUF."}
- </div>
- </div>
- )}
-
- {ggufAsLora ? (
- <div className="space-y-1.5">
- <div className="text-sm font-medium">Output type</div>
- <Select
- value={loraGgufOuttype}
- onValueChange={(v) => setLoraGgufOuttype(v)}
+ {reapBlocked && (
+ <div
+ role="alert"
+ className="rounded-lg border border-amber-500/40 bg-amber-500/5 p-3 text-xs"
>
- <SelectTrigger className="w-full sm:w-56">
- <SelectValue />
- </SelectTrigger>
- <SelectContent>
- {LORA_GGUF_OUTTYPES.map((t) => (
- <SelectItem key={t} value={t}>
- {t.toUpperCase()}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- </div>
- ) : (
- <>
- <QuantPicker
- value={quantLevels}
- onChange={setQuantLevels}
- sizes={quantSizeLabels}
- />
- <div className="flex items-start justify-between gap-3 rounded-lg border p-3">
- <div className="space-y-0.5">
- <div className="text-sm font-medium">
- Importance matrix (imatrix)
- </div>
- <div className="text-xs text-muted-foreground">
- {requiresImatrix
- ? "Required for the selected IQ low-bit quant."
- : "Improves quant quality and unlocks the IQ low-bit quants."}
- </div>
- </div>
- <Switch
- className="mt-[var(--ui-title-cap-inset)]"
- aria-label="Importance matrix (imatrix)"
- checked={effectiveImatrix}
- onCheckedChange={setUseImatrix}
- disabled={requiresImatrix}
- />
- </div>
- {effectiveImatrix && (
- <div className="space-y-1.5">
- <label
- htmlFor="export-imatrix-path"
- className="text-sm font-medium"
- >
- Local imatrix file (optional)
- </label>
- <InputGroup>
- <InputGroupInput
- id="export-imatrix-path"
- aria-describedby="export-imatrix-path-help"
- placeholder="/path/to/imatrix.gguf"
- value={imatrixPath}
- onChange={(e) =>
- setCustomImatrix({
- sourceKey: imatrixSourceKey,
- path: e.target.value,
- })
- }
- />
- </InputGroup>
- <p
- id="export-imatrix-path-help"
- className="text-xs text-muted-foreground"
+ <p>
+ Expert pruning (REAP) is on, but this model cannot be
+ pruned: it is not a routed MoE, or its weights or
+ setup are not supported. Turn pruning off to export
+ it.
+ </p>
+ <div className="mt-2 flex gap-2">
+ <Button
+ type="button"
+ variant="outline"
+ size="sm"
+ onClick={() =>
+ setReapSettings((s) => ({ ...s, enabled: false }))
+ }
>
- Absolute path to a .dat or .gguf imatrix file on the
- machine running Unsloth. Leave blank to
- auto-download the upstream Unsloth imatrix for the
- base model, if one exists.
- </p>
- </div>
- )}
- <div className="flex items-start justify-between gap-3 rounded-lg border p-3">
- <div className="space-y-0.5">
- <div className="text-sm font-medium">
- Also convert to Q4NX (AMD NPU)
- </div>
- <div className="text-xs text-muted-foreground">
- {destination !== "local"
- ? "Saves locally only: pick a local destination."
- : q4nxSourceSelected
- ? "Converts the Q4 GGUF into a FastFlowLM folder for Ryzen AI NPUs (XDNA 2), next to the GGUFs."
- : "Needs Q4_0, Q4_1 or Q4_K_M in the selection."}
- </div>
+ Turn off expert pruning
+ </Button>
</div>
- <Switch
- className="mt-[var(--ui-title-cap-inset)]"
- aria-label="Also convert to Q4NX (AMD NPU)"
- checked={effectiveNpuQ4nx}
- onCheckedChange={setNpuQ4nx}
- disabled={!q4nxSourceSelected || destination !== "local"}
- />
</div>
- </>
- )}
- </div>
- )}
- {showReap && moeInfo && (
- <ReapCard
- moe={moeInfo}
- settings={reapSettings}
- onChange={setReapSettings}
- disabled={isExporting}
- />
- )}
- {reapFailed && (
- <div
- role="alert"
- className="rounded-lg border border-amber-500/40 bg-amber-500/5 p-3 text-xs"
- >
- <p>
- Expert pruning (REAP) is on, but checking whether this model
- can be pruned failed. Retry, or turn pruning off to export
- the full model.
- </p>
- <div className="mt-2 flex gap-2">
- <Button
- type="button"
- variant="outline"
- size="sm"
- onClick={() => setMoeRetry((n) => n + 1)}
- >
- Retry
- </Button>
- <Button
- type="button"
- variant="ghost"
- size="sm"
- onClick={() =>
- setReapSettings((s) => ({ ...s, enabled: false }))
- }
- >
- Turn off expert pruning
- </Button>
- </div>
- </div>
- )}
- {reapBlocked && (
- <div
- role="alert"
- className="rounded-lg border border-amber-500/40 bg-amber-500/5 p-3 text-xs"
- >
- <p>
- Expert pruning (REAP) is on, but this model cannot be
- pruned: it is not a routed MoE, or its weights or setup are
- not supported. Turn pruning off to export it.
- </p>
- <div className="mt-2 flex gap-2">
- <Button
- type="button"
- variant="outline"
- size="sm"
- onClick={() =>
- setReapSettings((s) => ({ ...s, enabled: false }))
- }
- >
- Turn off expert pruning
- </Button>
+ )}
</div>
- </div>
- )}
- {estimatedSize && (
- <div className="flex items-center gap-1.5 text-xs text-muted-foreground">
- <HugeiconsIcon
- icon={InformationCircleIcon}
- className="size-3.5"
+ </SectionBox>
+
+ {showPanel && (
+ <ExportRunPanel
+ exportMethod={exportMethod}
+ quantLevels={quantLevels}
+ checkpoint={selectedExportSource}
+ baseModelName={sourceBaseModelName}
+ isAdapter={sourceMode === "checkpoint" && isAdapter}
+ destination={destination}
+ onDestinationChange={setDestination}
+ saveDirectory={saveDirectory}
+ saveDirectoryInput={saveDirectoryInput}
+ defaultSaveDirectory={defaultSaveDirectory}
+ saveDirectoryOverridden={!!customSaveDirectory}
+ onSaveDirectoryChange={setCustomSaveDirectory}
+ hfUsername={hfUsername}
+ onHfUsernameChange={setHfUsername}
+ modelName={modelName}
+ onModelNameChange={setModelName}
+ hfToken={hfToken}
+ onHfTokenChange={setHfToken}
+ privateRepo={privateRepo}
+ onPrivateRepoChange={setPrivateRepo}
+ onStart={handleStart}
+ onClose={handleClosePanel}
+ decisionNote={
+ decisionInfo
+ ? t("exportDecision.outputNote", {
+ path: decisionInfo.output_dir,
+ })
+ : undefined
+ }
+ reapLabel={reapLabel}
/>
- <span>Est. size: {estimatedSize}</span>
- </div>
- )}
-
- <Separator />
- {showPanel && (
- <ExportRunPanel
- exportMethod={exportMethod}
- quantLevels={quantLevels}
- checkpoint={selectedExportSource}
- baseModelName={sourceBaseModelName}
- isAdapter={sourceMode === "checkpoint" && isAdapter}
- destination={destination}
- onDestinationChange={setDestination}
- saveDirectory={saveDirectory}
- saveDirectoryInput={saveDirectoryInput}
- defaultSaveDirectory={defaultSaveDirectory}
- saveDirectoryOverridden={!!customSaveDirectory}
- onSaveDirectoryChange={setCustomSaveDirectory}
- hfUsername={hfUsername}
- onHfUsernameChange={setHfUsername}
- modelName={modelName}
- onModelNameChange={setModelName}
- hfToken={hfToken}
- onHfTokenChange={setHfToken}
- privateRepo={privateRepo}
- onPrivateRepoChange={setPrivateRepo}
- onStart={handleStart}
- onClose={handleClosePanel}
- decisionNote={
- decisionInfo
- ? t("exportDecision.outputNote", {
- path: decisionInfo.output_dir,
- })
- : undefined
- }
- reapLabel={reapLabel}
- />
- )}
- {showPanel && (
- <div
- ref={panelEndRef}
- aria-hidden="true"
- className="h-px w-full"
- />
- )}
- {showPanel && !panelEndVisible && (
- <button
- type="button"
- onClick={() =>
- panelEndRef.current?.scrollIntoView({
- behavior: "smooth",
- block: "end",
- })
- }
- aria-label="Scroll to export output"
- className="fixed bottom-6 right-6 z-30 flex size-10 items-center justify-center rounded-full bg-background/90 text-foreground shadow-md backdrop-blur transition-colors hover:bg-muted"
- >
- <HugeiconsIcon
- icon={ChevronDownStandardIcon}
- className="size-5"
+ )}
+ {showPanel && (
+ <div
+ ref={panelEndRef}
+ aria-hidden="true"
+ className="h-px w-full"
/>
- </button>
- )}
- {!showPanel && (
- <div className="flex items-center justify-end">
- <Button
- variant="dark"
- data-tour="export-cta"
- disabled={!canExport}
- onClick={handleOpenPanel}
+ )}
+ {showPanel && !panelEndVisible && (
+ <button
+ type="button"
+ onClick={() =>
+ panelEndRef.current?.scrollIntoView({
+ behavior: "smooth",
+ block: "end",
+ })
+ }
+ aria-label="Scroll to export output"
+ className="fixed bottom-6 right-6 z-30 flex size-10 items-center justify-center rounded-full bg-background/90 text-foreground shadow-md backdrop-blur transition-colors hover:bg-muted"
>
- Export Model
- </Button>
- </div>
- )}
- </>
- )}
- </SectionCard>
- <ImageLoraExportCard preselect={preselectImageLora} />
- <Q4nxConvertCard />
+ <HugeiconsIcon
+ icon={ChevronDownStandardIcon}
+ className="size-5"
+ />
+ </button>
+ )}
+ <ImageLoraExportCard preselect={preselectImageLora} />
+ {hasNpu && <Q4nxConvertCard />}
+ </div>
+ <div className="@4xl/export-configure:sticky @4xl/export-configure:top-6 @4xl/export-configure:self-start">
+ <ExportSummaryCard
+ ready={canExport}
+ rows={summaryRows}
+ steps={exportGuideSteps}
+ cta={
+ showPanel ? undefined : (
+ <Button
+ size="lg"
+ data-tour="export-cta"
+ disabled={!canExport}
+ onClick={handleOpenPanel}
+ className={cn(
+ "w-full justify-center rounded-full text-ui-13p5 font-semibold tracking-tight",
+ "bg-action text-background shadow-sm hover:opacity-90",
+ "disabled:bg-[color-mix(in_oklab,var(--foreground)_calc(8%*var(--contrast-wash-gain,1)),transparent)] disabled:text-muted-foreground disabled:shadow-none dark:disabled:bg-[rgb(255_255_255_/_calc(0.06*var(--contrast-wash-gain,1)))]",
+ )}
+ >
+ Export Model
+ </Button>
+ )
+ }
+ />
+ </div>
+ </div>
+ </div>
+ )}
</main>
</div>
);
diff --git a/studio/frontend/src/features/model-picker/components/model-config-page.tsx b/studio/frontend/src/features/model-picker/components/model-config-page.tsx
index 5890b376790..8613dc242e5 100644
--- a/studio/frontend/src/features/model-picker/components/model-config-page.tsx
+++ b/studio/frontend/src/features/model-picker/components/model-config-page.tsx
@@ -4241,7 +4241,7 @@ export function ModelConfigPage({
}
hint={
targetIsNpu
- ? `Tokens of context FastFlowLM loads the model with. Unset, it loads ${NPU_DEFAULT_CONTEXT_LENGTH.toLocaleString()}, or the model's limit if that is lower.`
+ ? `Context the NPU loads the model with. Default ${NPU_DEFAULT_CONTEXT_LENGTH.toLocaleString()}, or the model's limit if lower.`
: undefined
}
onChange={(value) =>
diff --git a/studio/frontend/src/features/studio/sections/dataset-section.tsx b/studio/frontend/src/features/studio/sections/dataset-section.tsx
index 8be26e92d51..5f34f431bdc 100644
--- a/studio/frontend/src/features/studio/sections/dataset-section.tsx
+++ b/studio/frontend/src/features/studio/sections/dataset-section.tsx
@@ -25,7 +25,7 @@ function FieldLabel({
hintLabel?: string;
}) {
return (
- <span className="flex items-center gap-1.5 text-ui-11 font-medium uppercase tracking-[0.05em] text-muted-foreground/70">
+ <span className="flex items-center gap-1.5 text-xs font-medium text-muted-foreground">
{children}
{hint ? <FieldHint text={hint} label={hintLabel ?? hint} /> : null}
</span>
@@ -65,7 +65,7 @@ export function DatasetPanel() {
{datasetSource === "s3" && <S3ConfigForm />}
{datasetSource !== "s3" && (
- <div className="grid grid-cols-1 items-start gap-4 @xl/train-section:grid-cols-2 @xl/train-section:gap-5">
+ <div className="grid grid-cols-1 items-start gap-4 @lg/train-section:grid-cols-2 @lg/train-section:gap-5">
<div className="flex flex-col gap-2">
<FieldLabel
hint={t("studio.wizard.datasetTooltip")}
diff --git a/studio/frontend/src/features/studio/sections/dataset-upload.tsx b/studio/frontend/src/features/studio/sections/dataset-upload.tsx
index c4edc092d14..71d03153012 100644
--- a/studio/frontend/src/features/studio/sections/dataset-upload.tsx
+++ b/studio/frontend/src/features/studio/sections/dataset-upload.tsx
@@ -37,7 +37,7 @@ export function DatasetUploadField({ uploads }: { uploads: DatasetUploads }) {
const fileInputRef = useRef<HTMLInputElement>(null);
return (
<div className="flex flex-col gap-2">
- <span className="flex items-center gap-1.5 text-ui-11 font-medium uppercase tracking-[0.05em] text-muted-foreground/70">
+ <span className="flex items-center gap-1.5 text-xs font-medium text-muted-foreground">
{t("studio.wizard.uploadLocalLabel")}
<Tooltip>
<TooltipTrigger asChild={true}>
diff --git a/studio/frontend/src/features/studio/sections/progress-section.tsx b/studio/frontend/src/features/studio/sections/progress-section.tsx
index d301258b588..5e12ec8b7ea 100644
--- a/studio/frontend/src/features/studio/sections/progress-section.tsx
+++ b/studio/frontend/src/features/studio/sections/progress-section.tsx
@@ -624,7 +624,7 @@ function ConfigPopoverButton({
<p className="text-xs font-semibold">{t("studio.progress.configLabel")}</p>
{configItems.map((group) => (
<div key={group.section} className="flex flex-col gap-1">
- <p className="text-ui-10 font-semibold uppercase tracking-wider text-muted-foreground">
+ <p className="text-ui-11 font-semibold text-muted-foreground">
{group.section}
</p>
{group.rows.map(([label, value]) => (
@@ -737,7 +737,7 @@ function MilestoneCallout({
<div className="flex items-start justify-between gap-3">
<div className="min-w-0">
{!showCompletedHint && (
- <p className="text-ui-10 font-medium uppercase tracking-[0.12em] text-muted-foreground">
+ <p className="text-ui-11 font-medium text-muted-foreground">
{t("studio.training.milestone")}
</p>
)}
diff --git a/studio/frontend/src/features/studio/sections/training-hyperparameters-section.tsx b/studio/frontend/src/features/studio/sections/training-hyperparameters-section.tsx
index 57c743c0dc3..913e564518d 100644
--- a/studio/frontend/src/features/studio/sections/training-hyperparameters-section.tsx
+++ b/studio/frontend/src/features/studio/sections/training-hyperparameters-section.tsx
@@ -140,7 +140,7 @@ export function TrainingHyperparametersSection({
onValueChange={(value) => setTab(value as HyperparameterTab)}
className="w-full"
>
- <div className="flex justify-center">
+ <div className="flex justify-start">
<SegmentedTabsList
value={tab}
options={tabs}
diff --git a/studio/frontend/src/features/studio/studio-navigation.tsx b/studio/frontend/src/features/studio/studio-navigation.tsx
index a38ae6874a8..a91b35e232d 100644
--- a/studio/frontend/src/features/studio/studio-navigation.tsx
+++ b/studio/frontend/src/features/studio/studio-navigation.tsx
@@ -38,7 +38,7 @@ export function TrainSubNav({
<TabsList
unstyled={true}
data-tour="studio-subnav"
- className="flex min-w-0 flex-1 flex-wrap items-center justify-start gap-3 pb-px text-ui-13 tracking-nav sm:gap-6"
+ className="flex min-w-0 flex-1 flex-wrap items-center justify-start gap-3 text-ui-13 tracking-nav sm:gap-6"
>
{items.map((item) => {
const active = value === item.value;
@@ -50,7 +50,8 @@ export function TrainSubNav({
indicatorClassName="hidden"
className={cn(
"relative h-9 flex-none select-none rounded-none border-0 px-0 py-0 text-ui-13 transition-colors disabled:cursor-not-allowed disabled:opacity-40",
- "after:pointer-events-none after:absolute after:inset-x-0 after:bottom-0 after:h-[2px] after:rounded-full after:bg-foreground after:transition-opacity",
+ // TabsTrigger's bottom-[-5px] dropped the bar below the row's border.
+ "after:pointer-events-none after:absolute after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:-bottom-px after:h-[2px] after:rounded-full after:bg-foreground after:transition-opacity",
active
? "font-semibold text-foreground after:opacity-100"
: "text-muted-foreground hover:text-foreground after:opacity-0",
diff --git a/studio/frontend/src/features/studio/wizard/config-actions.tsx b/studio/frontend/src/features/studio/wizard/config-actions.tsx
index cffae4b6ebe..cc1ccc56ed2 100644
--- a/studio/frontend/src/features/studio/wizard/config-actions.tsx
+++ b/studio/frontend/src/features/studio/wizard/config-actions.tsx
@@ -21,8 +21,8 @@ import {
} from "@/lib/native-files";
import { toast } from "@/lib/toast";
import {
- Archive04Icon,
- CleanIcon,
+ FloppyDiskIcon,
+ UndoIcon,
Upload01Icon,
} from "@hugeicons/core-free-icons";
import { HugeiconsIcon } from "@hugeicons/react";
@@ -158,7 +158,7 @@ export function ConfigActions() {
className="h-9 cursor-pointer rounded-full"
onClick={handleSaveConfig}
>
- <HugeiconsIcon icon={Archive04Icon} className="size-3.5" />
+ <HugeiconsIcon icon={FloppyDiskIcon} className="size-3.5" />
{t("studio.wizard.saveYaml")}
</Button>
</TooltipTrigger>
@@ -175,7 +175,7 @@ export function ConfigActions() {
onClick={handleResetConfig}
disabled={!selectedModel}
>
- <HugeiconsIcon icon={CleanIcon} className="size-3.5" />
+ <HugeiconsIcon icon={UndoIcon} className="size-3.5" />
{t("studio.wizard.resetDefaults")}
</Button>
</TooltipTrigger>
diff --git a/studio/frontend/src/features/studio/wizard/run-preview-card.tsx b/studio/frontend/src/features/studio/wizard/run-preview-card.tsx
index 66345cfe194..eee40ea0885 100644
--- a/studio/frontend/src/features/studio/wizard/run-preview-card.tsx
+++ b/studio/frontend/src/features/studio/wizard/run-preview-card.tsx
@@ -150,7 +150,7 @@ function ResourceNoticeList({
}
return (
<section className="flex flex-col gap-2">
- <p className="text-ui-10p5 font-medium uppercase tracking-[0.05em] text-muted-foreground/60">
+ <p className="text-ui-11 font-medium tracking-nav text-muted-foreground">
{t("studio.preview.files")}
</p>
{notices.map((notice) => (
@@ -245,7 +245,7 @@ function PreviewResource({
return (
<div className="flex flex-col gap-1">
{owner && (
- <p className="font-mono text-ui-10p5 uppercase tracking-[0.04em] text-muted-foreground/70">
+ <p className="font-mono text-ui-10p5 text-muted-foreground/70">
{owner}
</p>
)}
diff --git a/studio/frontend/src/features/studio/wizard/start-training-cta.tsx b/studio/frontend/src/features/studio/wizard/start-training-cta.tsx
index caa4ff10509..b0155fe927d 100644
--- a/studio/frontend/src/features/studio/wizard/start-training-cta.tsx
+++ b/studio/frontend/src/features/studio/wizard/start-training-cta.tsx
@@ -11,7 +11,7 @@ import {
import { useT } from "@/i18n";
import { cn } from "@/lib/utils";
import type { DatasetSource } from "@/types/training";
-import { Refresh01Icon, Rocket01Icon } from "@hugeicons/core-free-icons";
+import { PlayIcon, Refresh01Icon } from "@hugeicons/core-free-icons";
import { HugeiconsIcon } from "@hugeicons/react";
import { useShallow } from "zustand/react/shallow";
import { resolveStartTrainingButtonLabelKey } from "./start-training-cta-state";
@@ -149,7 +149,7 @@ export function StartTrainingCta() {
disabled={disabled}
>
<HugeiconsIcon
- icon={Rocket01Icon}
+ icon={PlayIcon}
strokeWidth={1.75}
className="size-4"
/>
diff --git a/studio/frontend/src/features/studio/wizard/training-wizard.tsx b/studio/frontend/src/features/studio/wizard/training-wizard.tsx
index 87f807ac770..ff27a18e925 100644
--- a/studio/frontend/src/features/studio/wizard/training-wizard.tsx
+++ b/studio/frontend/src/features/studio/wizard/training-wizard.tsx
@@ -2,6 +2,7 @@
// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
import { PICKER_TRIGGER_CLASS } from "@/components/resource-picker/picker-focus";
+import { SectionBox, SectionField } from "@/components/section-box";
import { SegmentedTabsList } from "@/components/segmented-tabs";
import {
Select,
@@ -33,13 +34,12 @@ import { useT } from "@/i18n";
import { cn } from "@/lib/utils";
import type { TrainingMethod } from "@/types/training";
import {
- AiBrain01Icon,
+ ChipIcon,
Database02Icon,
- FloppyDiskIcon,
+ PencilEdit02Icon,
Settings02Icon,
} from "@hugeicons/core-free-icons";
-import { HugeiconsIcon, type IconSvgElement } from "@hugeicons/react";
-import type { CSSProperties, ReactNode } from "react";
+import type { ReactNode } from "react";
import { DatasetPanel } from "../sections/dataset-section";
import { DatasetSourceToggleAction } from "../sections/dataset-source-toggle";
import { FieldHint } from "../sections/field-hint";
@@ -47,89 +47,6 @@ import { ParamsSection } from "../sections/params-section";
import { ConfigActions } from "./config-actions";
import type { ParamMode } from "./training-param-mode";
-function SectionBox({
- title,
- description,
- icon,
- chipTint,
- titleAction,
- children,
- dataTour,
-}: {
- title?: string;
- description?: string;
- icon?: IconSvgElement;
- chipTint?: string;
- titleAction?: ReactNode;
- children: ReactNode;
- dataTour?: string;
-}) {
- return (
- <section
- data-tour={dataTour}
- className="@container/train-card elevated-card flex flex-col gap-7 bg-card p-5 pb-7"
- >
- {title && (
- <div
- className={cn(
- "flex flex-col items-stretch gap-3 @md/train-card:flex-row @md/train-card:justify-between",
- description
- ? "@md/train-card:items-start"
- : "@md/train-card:items-center",
- )}
- >
- <div
- className={cn(
- "flex min-w-0 gap-3",
- description ? "items-start" : "items-center",
- )}
- >
- {icon && (
- <span
- className="train-section-chip inline-flex size-9 shrink-0 items-center justify-center rounded-full"
- style={
- chipTint
- ? ({ "--chip-tint": chipTint } as CSSProperties)
- : undefined
- }
- >
- <HugeiconsIcon
- icon={icon}
- strokeWidth={1.5}
- className="size-[calc(18px*var(--ui-space-scale,1))]"
- />
- </span>
- )}
- <div className="min-w-0">
- <h2 className="select-none text-ui-13p5 font-semibold leading-ui-18 tracking-[-0.012em] text-foreground">
- {title}
- </h2>
- {description && (
- <p className="text-ui-11p5 leading-ui-15 text-muted-foreground/85">
- {description}
- </p>
- )}
- </div>
- </div>
- {titleAction && (
- <div
- className={cn(
- "w-full min-w-0 @md/train-card:w-auto @md/train-card:shrink-0",
- // Top edge on the h2's cap top (13.5px at leading 18px; Hellix: 0.289em).
- description &&
- "@md/train-card:mt-[calc(var(--text-ui-13p5)*0.289)]",
- )}
- >
- {titleAction}
- </div>
- )}
- </div>
- )}
- <div className="@container/train-section min-w-0">{children}</div>
- </section>
- );
-}
-
function ParamModeToggle({
mode,
onChange,
@@ -170,13 +87,12 @@ function SetupField({
children: ReactNode;
}) {
return (
- <div className="flex flex-col gap-2">
- <span className="flex items-center gap-1.5 text-ui-11 font-medium uppercase tracking-[0.05em] text-muted-foreground/70">
- {label}
- {hint ? <FieldHint text={hint} label={label} /> : null}
- </span>
- <div className="min-w-0">{children}</div>
- </div>
+ <SectionField
+ label={label}
+ hint={hint ? <FieldHint text={hint} label={label} /> : null}
+ >
+ {children}
+ </SectionField>
);
}
@@ -440,7 +356,7 @@ export function TrainingWizard({
<SectionBox
title={t("studio.wizard.modelTitle")}
description={t("studio.wizard.modelDescription")}
- icon={AiBrain01Icon}
+ icon={ChipIcon}
chipTint="var(--chart-1)"
>
<ModelPanel />
@@ -473,7 +389,7 @@ export function TrainingWizard({
<SectionBox
title={t("studio.wizard.configTitle")}
description={t("studio.wizard.configDescription")}
- icon={FloppyDiskIcon}
+ icon={PencilEdit02Icon}
chipTint="var(--chart-1)"
>
<ConfigActions />
diff --git a/studio/frontend/src/i18n/locales/en.ts b/studio/frontend/src/i18n/locales/en.ts
index 6244ca4a674..946f9e798c0 100644
--- a/studio/frontend/src/i18n/locales/en.ts
+++ b/studio/frontend/src/i18n/locales/en.ts
@@ -3501,7 +3501,7 @@ export const en = {
datasetLabel: "Dataset",
datasetTooltip: "The training data used to fine-tune the model.",
hfTokenDescription: "Required for gated or private models and datasets.",
- uploadLocalLabel: "Or upload a local file",
+ uploadLocalLabel: "Upload a local file",
sourceBrowse: "Browse",
releaseToUpload: "Release to upload",
loadYaml: "Load YAML",
diff --git a/studio/frontend/src/index.css b/studio/frontend/src/index.css
index 41f777353c2..fe1bbfb57b1 100644
--- a/studio/frontend/src/index.css
+++ b/studio/frontend/src/index.css
@@ -2882,11 +2882,11 @@ html[data-chat-font] .aui-root {
background-color: rgb(255 255 255 / calc(0.1 * var(--contrast-wash-gain, 1)));
}
- /* Elevated cards sink the shared track; the API page's buttons lift above them instead. */
- html.dark .api-monitor-page .elevated-card .btn-fill {
+ /* Elevated cards sink the shared track; their buttons lift above it. */
+ html.dark :is(.api-monitor-page .elevated-card, .section-box) .btn-fill {
background-color: rgb(255 255 255 / calc(0.06 * var(--contrast-wash-gain, 1)));
}
- html.dark .api-monitor-page .elevated-card .btn-fill:hover {
+ html.dark :is(.api-monitor-page .elevated-card, .section-box) .btn-fill:hover {
background-color: rgb(255 255 255 / calc(0.1 * var(--contrast-wash-gain, 1)));
}
diff --git a/studio/frontend/tests/train-configure-preview-column.test.ts b/studio/frontend/tests/train-configure-preview-column.test.ts
index e727925929c..676be942f4e 100644
--- a/studio/frontend/tests/train-configure-preview-column.test.ts
+++ b/studio/frontend/tests/train-configure-preview-column.test.ts
@@ -18,8 +18,8 @@ const STUDIO_PAGE = new URL(
"../src/features/studio/studio-page.tsx",
import.meta.url,
);
-const TRAINING_WIZARD = new URL(
- "../src/features/studio/wizard/training-wizard.tsx",
+const SECTION_BOX = new URL(
+ "../src/components/section-box.tsx",
import.meta.url,
);
const STUDIO_CSS = new URL("../src/index.css", import.meta.url);
@@ -112,7 +112,7 @@ async function smallestTrainSectionTier(
test("the run preview column reaches a laptop window without dropping the wizard below @md/train-section", async () => {
const { containers, spacing } = await tailwindScales();
const page = await readFile(STUDIO_PAGE, "utf8");
- const wizard = await readFile(TRAINING_WIZARD, "utf8");
+ const wizard = await readFile(SECTION_BOX, "utf8");
// Every tier below is inert unless the named containers are still declared.
classNameContaining(page, "@container/train-configure");