- Rename the app to Kaname - Hub metadata per model (base models, architecture, license, Hub tags), backfilled by the worker for existing models - Library search across repo/author/family/quant/tags and multi-select facet filters (author, family, quant, tag, status) kept in the URL - Custom tags (model page editor, on add, click-to-filter) - README rewritten around a quick install, with banner and screenshots - deploy/compose.yaml: models in a host folder (KANAME_MODELS_DIR) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2167ea0950
commit
67191b3e16
37 files changed
+2028
-206
No files matched your search
@@ -0,0 +1,91 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { describe, it } from "node:test";
|
||||
import { modelFamilies, parseRepoMetadata } from "./hub/metadata";
|
||||
import { EMPTY_FILTERS, facetCounts, matchesFilters, matchesQuery, type SearchableModel } from "./search";
|
||||
|
||||
describe("parseRepoMetadata (real Hub responses, trimmed)", () => {
|
||||
it("unsloth GGUF quant of Qwen", () => {
|
||||
const m = parseRepoMetadata({
|
||||
id: "unsloth/Qwen3-8B-GGUF",
|
||||
author: "unsloth",
|
||||
pipeline_tag: "text-generation",
|
||||
tags: ["transformers", "gguf", "qwen3", "qwen", "unsloth", "base_model:Qwen/Qwen3-8B", "base_model:quantized:Qwen/Qwen3-8B", "license:apache-2.0", "endpoints_compatible", "conversational", "arxiv:2309.00071"],
|
||||
cardData: { base_model: "Qwen/Qwen3-8B", license: "apache-2.0" },
|
||||
gguf: { architecture: "qwen3" },
|
||||
});
|
||||
assert.deepEqual(m.baseModels, ["Qwen/Qwen3-8B"]);
|
||||
assert.equal(m.architecture, "qwen3");
|
||||
assert.equal(m.license, "apache-2.0");
|
||||
assert.deepEqual(m.hubTags, ["transformers", "gguf", "qwen3", "qwen", "unsloth"]);
|
||||
assert.deepEqual(modelFamilies("unsloth/Qwen3-8B-GGUF", m.baseModels), ["Qwen"]);
|
||||
});
|
||||
|
||||
it("finetune with base_model as array and config.model_type", () => {
|
||||
const m = parseRepoMetadata({
|
||||
id: "TheDrummer/Cydonia-24B-v4.1",
|
||||
author: "TheDrummer",
|
||||
tags: ["safetensors", "mistral"],
|
||||
cardData: { base_model: ["mistralai/Mistral-Small-3.2-24B-Instruct-2507"] },
|
||||
config: { model_type: "mistral" },
|
||||
});
|
||||
assert.deepEqual(m.baseModels, ["mistralai/Mistral-Small-3.2-24B-Instruct-2507"]);
|
||||
assert.equal(m.architecture, "mistral");
|
||||
assert.deepEqual(modelFamilies("TheDrummer/Cydonia-24B-v4.1", m.baseModels), ["mistralai"]);
|
||||
});
|
||||
|
||||
it("falls back to base_model tags; original models are their own family", () => {
|
||||
const m = parseRepoMetadata({ id: "x/y", tags: ["base_model:finetune:Qwen/Qwen3-8B-Base"] });
|
||||
assert.deepEqual(m.baseModels, ["Qwen/Qwen3-8B-Base"]);
|
||||
assert.equal(m.author, "x");
|
||||
assert.deepEqual(modelFamilies("Qwen/Qwen3-8B", []), ["Qwen"]);
|
||||
});
|
||||
});
|
||||
|
||||
const model = (over: Partial<SearchableModel>): SearchableModel => ({
|
||||
repoId: "unsloth/Qwen3-8B-GGUF",
|
||||
author: "unsloth",
|
||||
families: ["Qwen"],
|
||||
baseModels: ["Qwen/Qwen3-8B"],
|
||||
architecture: "qwen3",
|
||||
quants: ["Q4_K_M"],
|
||||
tags: ["roleplay"],
|
||||
hubTags: ["gguf"],
|
||||
pipelineTag: "text-generation",
|
||||
license: "apache-2.0",
|
||||
status: "ready",
|
||||
...over,
|
||||
});
|
||||
|
||||
describe("matchesQuery", () => {
|
||||
it("matches author, family, quant and tags case-insensitively, all terms required", () => {
|
||||
const m = model({});
|
||||
assert.ok(matchesQuery(m, "qwen"));
|
||||
assert.ok(matchesQuery(m, "unsloth qwen"));
|
||||
assert.ok(matchesQuery(m, "q4_k_m"));
|
||||
assert.ok(matchesQuery(m, "ROLEPLAY"));
|
||||
assert.ok(matchesQuery(m, " "));
|
||||
assert.ok(!matchesQuery(m, "unsloth gemma"));
|
||||
});
|
||||
});
|
||||
|
||||
describe("filters and facet counts", () => {
|
||||
const models = [
|
||||
model({}),
|
||||
model({ repoId: "bartowski/Qwen_Qwen3-8B-GGUF", author: "bartowski", quants: ["Q6_K"], tags: [] }),
|
||||
model({ repoId: "unsloth/gemma-3-27b-it-GGUF", families: ["google"], quants: ["Q4_K_M"], tags: ["security"] }),
|
||||
];
|
||||
|
||||
it("ORs within a facet and ANDs across facets", () => {
|
||||
const f = { ...EMPTY_FILTERS, author: ["unsloth"], quant: ["Q4_K_M", "Q6_K"] };
|
||||
assert.deepEqual(
|
||||
models.filter((m) => matchesFilters(m, f)).map((m) => m.repoId),
|
||||
["unsloth/Qwen3-8B-GGUF", "unsloth/gemma-3-27b-it-GGUF"],
|
||||
);
|
||||
});
|
||||
|
||||
it("counts a facet without applying its own selection", () => {
|
||||
const f = { ...EMPTY_FILTERS, author: ["unsloth"] };
|
||||
assert.deepEqual(facetCounts(models, "author", "", f), [["unsloth", 2], ["bartowski", 1]]);
|
||||
assert.deepEqual(facetCounts(models, "family", "", f), [["google", 1], ["Qwen", 1]]);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user