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.

2.0 KB
Raw Blame
// 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 assert from "node:assert/strict";
import test from "node:test";

import { classifyUnslothSupport } from "../src/features/hub/lib/unsloth-support.ts";

// sd.cpp companion mirrors are taskless "diffusion-single-file" repos holding only a VAE or
// text encoder; Hub search must not classify them as chat models.
test("a taskless companion mirror is not offered as a chat model", () => {
  for (const mirror of [
    {
      modelId: "unsloth/Qwen-Image-ComfyUI",
      tags: ["diffusion-single-file", "vae", "comfyui", "qwen-image"],
      libraryName: "diffusion-single-file",
    },
    {
      modelId: "unsloth/Z-Image-Turbo-ComfyUI",
      tags: ["diffusion-single-file", "vae", "text-encoder", "comfyui", "z-image"],
      libraryName: "diffusion-single-file",
    },
  ]) {
    const support = classifyUnslothSupport({ ...mirror, pipelineTag: null });
    assert.equal(support.status, "unsupported", mirror.modelId);
  }
});

test("a real single-file checkpoint keeps its Images routing", () => {
  // With a pipeline task these load on the Images page, so they stay routed there.
  const support = classifyUnslothSupport({
    modelId: "unsloth/FLUX.2-klein-9B-GGUF",
    pipelineTag: "image-to-image",
    tags: ["gguf", "flux", "diffusion-single-file", "image-to-image"],
    libraryName: "gguf",
  });
  assert.equal(support.status, "unsupported");
  assert.equal(support.supportedIn, "images");
});

test("a chat GGUF that sd.cpp borrows as a text encoder stays supported", () => {
  // Some companion-set repos are also good chat models, so do not filter the picker on that set.
  const support = classifyUnslothSupport({
    modelId: "unsloth/Qwen2.5-VL-7B-Instruct-GGUF",
    pipelineTag: "image-text-to-text",
    tags: ["transformers", "gguf", "qwen2_5_vl", "image-text-to-text", "multimodal"],
    libraryName: "gguf",
  });
  assert.equal(support.status, "supported");
});