Download more, file labels, split-file grouping, settings for labels and tags
- Files tab: "Download more" adds files to a model's selection and queues them - Colored file labels (Model, MTP, Vision/mmproj, imatrix, Config, …) - Split GGUF/safetensors parts shown and selected as one entry everywhere - Settings page with a Labels section: file label names/colors, tag rename/recolor/delete; new settings table and tags.color - Quants only count model weights Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5211ec9064
commit
df18415e02
34 files changed
+2256
-132
No files matched your search
@@ -0,0 +1,66 @@
|
||||
// What a file in a model repo is for, guessed from its path. Shared by UI and server.
|
||||
|
||||
import type { LabelColor } from "./colors";
|
||||
|
||||
export type FileRole =
|
||||
| "model"
|
||||
| "mtp"
|
||||
| "vision"
|
||||
| "draft"
|
||||
| "adapter"
|
||||
| "imatrix"
|
||||
| "config"
|
||||
| "tokenizer"
|
||||
| "template"
|
||||
| "docs"
|
||||
| "image"
|
||||
| "git"
|
||||
| "other";
|
||||
|
||||
/** Defaults; label and color can be changed in Settings. */
|
||||
export const FILE_ROLES: Record<FileRole, { label: string; color: LabelColor; description: string }> = {
|
||||
model: { label: "Model", color: "indigo", description: "Model weights" },
|
||||
mtp: { label: "MTP", color: "amber", description: "Multi-token prediction head (speculative decoding draft)" },
|
||||
vision: { label: "Vision", color: "fuchsia", description: "Multimodal projector (mmproj) for image input" },
|
||||
draft: { label: "Draft", color: "orange", description: "Draft model for speculative decoding" },
|
||||
adapter: { label: "Adapter", color: "violet", description: "LoRA / adapter weights" },
|
||||
imatrix: { label: "imatrix", color: "gray", description: "Importance matrix used to make the quants; not needed to run the model" },
|
||||
config: { label: "Config", color: "sky", description: "Model or generation config" },
|
||||
tokenizer: { label: "Tokenizer", color: "teal", description: "Tokenizer / vocabulary" },
|
||||
template: { label: "Template", color: "cyan", description: "Chat template" },
|
||||
docs: { label: "Docs", color: "gray", description: "Documentation or license" },
|
||||
image: { label: "Image", color: "pink", description: "Image (e.g. for the model card)" },
|
||||
git: { label: "Git", color: "gray", description: "Git metadata" },
|
||||
other: { label: "Other", color: "gray", description: "Other file" },
|
||||
};
|
||||
|
||||
export const FILE_ROLE_ORDER = Object.keys(FILE_ROLES) as FileRole[];
|
||||
|
||||
export type FileRoleStyle = { label: string; color: LabelColor };
|
||||
export type FileRoleStyles = Record<FileRole, FileRoleStyle>;
|
||||
|
||||
const WEIGHTS = /\.(gguf|safetensors|bin|pt|pth|ckpt|onnx|ggml|mlmodel|npz|h5)$/i;
|
||||
|
||||
export function fileRole(path: string): FileRole {
|
||||
const lower = path.toLowerCase();
|
||||
const name = lower.slice(lower.lastIndexOf("/") + 1);
|
||||
const dirs = lower.split("/").slice(0, -1);
|
||||
|
||||
if (name.startsWith(".git")) return "git";
|
||||
if (name.includes("imatrix")) return "imatrix";
|
||||
if (name.includes("mmproj") || dirs.includes("mmproj")) return "vision";
|
||||
if (name.startsWith("mtp-") || name.startsWith("mtp_") || dirs.includes("mtp")) return "mtp";
|
||||
if (WEIGHTS.test(name)) {
|
||||
if (name.includes("adapter")) return "adapter";
|
||||
if (/(^|[-_.])draft([-_.]|$)/.test(name)) return "draft";
|
||||
return "model";
|
||||
}
|
||||
if (/^tokenizer|^vocab|^merges\.txt$|^special_tokens_map\.json$|^added_tokens\.json$|\.tiktoken$|^tokenizer\.model$/.test(name)) {
|
||||
return "tokenizer";
|
||||
}
|
||||
if (name.endsWith(".jinja") || name.includes("chat_template") || name === "template") return "template";
|
||||
if (name.endsWith(".json") || name === "params" || name.endsWith(".yaml") || name.endsWith(".yml")) return "config";
|
||||
if (/\.(md|txt|rst)$/.test(name) || name.startsWith("license") || name.startsWith("notice")) return "docs";
|
||||
if (/\.(png|jpe?g|gif|webp|svg)$/.test(name)) return "image";
|
||||
return "other";
|
||||
}
|
||||
Reference in new issue
Block a user