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 Images: SDXL-Turbo opens at its native 512x512 canvas (#16168)

Daniel Han377738b59e78
diff --git a/studio/frontend/src/features/images/image-generation-defaults.ts b/studio/frontend/src/features/images/image-generation-defaults.ts
index 6f6eaf949b7..0ad871d3bf0 100644
--- a/studio/frontend/src/features/images/image-generation-defaults.ts
+++ b/studio/frontend/src/features/images/image-generation-defaults.ts
@@ -147,6 +147,11 @@ export function residentDefaultsKey(
export const DEFAULT_RESOLUTION = { width: 1024, height: 1024 } as const;
+// Families trained at a smaller canvas on every build (incl. GGUF); SDXL-Turbo is a 512x512 model.
+const NATIVE_CANVAS: Array<{ match: string; width: number; height: number }> = [
+ { match: "sdxl-turbo", width: 512, height: 512 },
+];
+
// Quantised builds of activation-heavy families default to a smaller canvas so they fit 24 GB
// (Qwen-Image-2.1: ~26 GB at 1024 vs ~19 GB at 512). Only a picked quant shrinks it; GGUF keeps 1024.
const QUANTISED_CANVAS: Array<{
@@ -171,6 +176,13 @@ export function resolutionFor(
transformerQuantSource?: string | null;
},
): { width: number; height: number } {
+ const fold = (text: string) => text.toLowerCase().replace(/[-_.\s]+/g, "-");
+ const native = NATIVE_CANVAS.find((entry) =>
+ fold(repoId).includes(fold(entry.match)),
+ );
+ if (native) {
+ return { width: native.width, height: native.height };
+ }
// A GGUF resident has no family substring in repo_id, so exclude it by kind.
if ((build.modelKind ?? "").toLowerCase() === "gguf") {
return DEFAULT_RESOLUTION;
diff --git a/studio/frontend/tests/image-generation-canvas-defaults.test.ts b/studio/frontend/tests/image-generation-canvas-defaults.test.ts
index 6410181aff7..c937439badf 100644
--- a/studio/frontend/tests/image-generation-canvas-defaults.test.ts
+++ b/studio/frontend/tests/image-generation-canvas-defaults.test.ts
@@ -75,3 +75,37 @@ test("an unloaded or unknown model keeps 1024", () => {
DEFAULT_RESOLUTION,
);
});
+
+test("SDXL-Turbo defaults to its native 512 on every build", () => {
+ for (const repo of [
+ "stabilityai/sdxl-turbo",
+ "unsloth/sdxl-turbo",
+ "local/SDXL_Turbo",
+ ]) {
+ for (const build of [
+ { modelKind: "pipeline", transformerQuant: null },
+ { modelKind: "pipeline", transformerQuant: "int8" },
+ { modelKind: "single_file", transformerQuant: "fp8" },
+ { modelKind: "gguf", transformerQuant: null },
+ ]) {
+ assert.deepEqual(
+ resolutionFor(repo, build),
+ { width: 512, height: 512 },
+ `${repo} ${build.modelKind}`,
+ );
+ }
+ }
+});
+
+test("SDXL base keeps 1024", () => {
+ for (const repo of [
+ "stabilityai/stable-diffusion-xl-base-1.0",
+ "unsloth/sdxl-base",
+ ]) {
+ assert.deepEqual(
+ resolutionFor(repo, { modelKind: "pipeline", transformerQuant: null }),
+ DEFAULT_RESOLUTION,
+ repo,
+ );
+ }
+});