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.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
// SPDX-License-Identifier: AGPL-3.0-only
// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
type HubModelTaskMetadata = {
id?: string | null;
pipelineTag?: string | null;
tags?: readonly string[] | null;
};
// Admit only conversational pipelines; a missing pipeline stays eligible since many GGUF repos omit it.
const CHAT_GENERATION_TASKS: ReadonlySet<string> = new Set([
"text-generation",
"conversational",
"image-text-to-text",
"audio-text-to-text",
"any-to-any",
]);
// Narrower than generic audio tags so audio-capable chat and VLM models stay available.
const SPEECH_ONLY_TAGS: ReadonlySet<string> = new Set([
"text-to-speech",
"automatic-speech-recognition",
]);
const CLASSIFIER_TASKS: ReadonlySet<string> = new Set([
"text-classification",
"token-classification",
"zero-shot-classification",
]);
const RERANKER_TAGS: ReadonlySet<string> = new Set([
"reranker",
"reranking",
"text-ranking",
"cross-encoder",
]);
const RERANKER_ID_PATTERN =
/(?:^|[-_./])(?:rerank(?:er|ing)?|classif(?:ier|ication))(?:$|[-_./])/i;
function normalize(value: string | null | undefined): string | null {
const normalized = value?.toLowerCase().trim();
return normalized || null;
}
export function isChatGenerativeHubModel(model: HubModelTaskMetadata): boolean {
const pipeline = normalize(model.pipelineTag);
return pipeline == null || CHAT_GENERATION_TASKS.has(pipeline);
}
export function isSpeechOnlyHubModel(model: HubModelTaskMetadata): boolean {
const pipeline = normalize(model.pipelineTag);
if (pipeline) {
return SPEECH_ONLY_TAGS.has(pipeline);
}
return (model.tags ?? []).some((tag) => {
const normalized = normalize(tag);
return normalized != null && SPEECH_ONLY_TAGS.has(normalized);
});
}
export function isClassifierOrRerankerHubModel(
model: HubModelTaskMetadata,
): boolean {
const pipeline = normalize(model.pipelineTag);
if (
pipeline &&
(CLASSIFIER_TASKS.has(pipeline) || RERANKER_TAGS.has(pipeline))
) {
return true;
}
if (RERANKER_ID_PATTERN.test(model.id ?? "")) {
return true;
}
if (pipeline) {
return false;
}
return (model.tags ?? []).some((tag) => {
const normalized = normalize(tag);
return (
normalized != null &&
(CLASSIFIER_TASKS.has(normalized) || RERANKER_TAGS.has(normalized))
);
});
}