mirror of
https://github.com/ggml-org/llama.cpp.git
synced 2026-11-26 23:29:34 +00:00
ui: NVFP4 as 4-bit in Discover, model details inside Search (#33120)
* ui: show NVFP4 quants in the 4-bit row of Discover Models details The quant regexes only knew MXFP, so NVFP4 files had no quant token, landed in "Other" and showed their whole filename on the chip. Assisted-by: Claude (Opus 5.5 Medium) * ui: show a model's details inside the search dialog Picking a Hugging Face model in Search now keeps the dialog open and shows the Discover details pane under the search input, below the picked row, instead of opening the full Discover dialog. Esc, typing or picking the row again goes back to the results. Assisted-by: Claude (Opus 5.5 Medium) * ui: keep the search dialog one size, match the model details skeleton The search dialog no longer grows when a model's details open in it. The details skeleton follows the loaded layout: row heights, chip widths that wrap where the real ones do, a readme title, and no leftover block under the quant rows. Assisted-by: Claude (Opus 5.5 Medium) * ui: leaner model details in the search dialog The details shown in Search drop the "View on Hugging Face" button and the description, through a `compact` prop on the details pane, and the search dialog is a step wider so the metadata chips fit on one line. Assisted-by: Claude (Opus 5.5 Medium)
This commit is contained in:
parent
fa9f928f25
commit
0ac39e4705
10 changed files with 220 additions and 138 deletions
|
|
@ -10,6 +10,7 @@
|
|||
X
|
||||
} from '@lucide/svelte';
|
||||
import { ActionIcon, KeyboardShortcutInfo, ModelOrgAvatar } from '#lib/components/app/index.ts';
|
||||
import { ModelsDiscoverDetailsContainer } from '#lib/components/app/models/discover/index.ts';
|
||||
import {
|
||||
CONVERSATION_SEARCH_CONTENT_DEBOUNCE_MS,
|
||||
CONVERSATION_SEARCH_CONTENT_LIMIT,
|
||||
|
|
@ -77,6 +78,8 @@
|
|||
let query = $state('');
|
||||
let highlighted = $state(0);
|
||||
let inputRef = $state<HTMLInputElement | null>(null);
|
||||
/** The Hub repo picked from the results, shown in place of them. */
|
||||
let selectedModel = $state<SearchEntry | null>(null);
|
||||
|
||||
const needle = $derived(query.trim().toLowerCase());
|
||||
const limit = $derived(
|
||||
|
|
@ -157,11 +160,10 @@
|
|||
if (open && isDiscoverEnabled) untrack(() => void modelsDiscoverStore.fetch());
|
||||
});
|
||||
|
||||
/** A Hub repo as a result; picking it opens Discover on that repo. */
|
||||
/** A Hub repo as a result; picking it shows the repo's details under the search. */
|
||||
function modelEntry(model: HfModelInfo, section: string): SearchEntry {
|
||||
const range = modelsDiscoverStore.cachedSizeRangeFor(model.id);
|
||||
|
||||
return {
|
||||
const entry: SearchEntry = {
|
||||
icon: DISCOVER_ICON,
|
||||
id: `${section}-${model.id}`,
|
||||
label: model.id,
|
||||
|
|
@ -170,8 +172,16 @@
|
|||
: `${HuggingFaceService.formatDownloads(model.downloads)} downloads`,
|
||||
// the model's own org, the way the model cards show it
|
||||
org: orgOf(HuggingFaceService.getBaseModels(model)[0]) || orgOf(model.id),
|
||||
run: () => close(() => uiStore.openModelsDiscover(model.id))
|
||||
run: () => (selectedModel = entry)
|
||||
};
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
/** Back from a picked repo to the results it was picked from. */
|
||||
function clearSelectedModel() {
|
||||
selectedModel = null;
|
||||
inputRef?.focus();
|
||||
}
|
||||
|
||||
const suggestedEntries = $derived.by((): SearchEntry[] =>
|
||||
|
|
@ -307,6 +317,9 @@
|
|||
// while an IME is composing, Enter confirms a candidate and the arrows move through them
|
||||
if (isIMEComposing(event)) return;
|
||||
|
||||
// a picked repo replaces the results: there is nothing to move through or open
|
||||
if (selectedModel) return;
|
||||
|
||||
if (event.key === KeyboardKey.ARROW_DOWN) {
|
||||
event.preventDefault();
|
||||
move(1);
|
||||
|
|
@ -323,6 +336,7 @@
|
|||
if (!nextOpen) {
|
||||
query = '';
|
||||
highlighted = 0;
|
||||
selectedModel = null;
|
||||
}
|
||||
|
||||
open = nextOpen;
|
||||
|
|
@ -349,18 +363,82 @@
|
|||
</span>
|
||||
{/snippet}
|
||||
|
||||
{#snippet row(entry: SearchEntry, index: number | null, isActive: boolean)}
|
||||
<button
|
||||
aria-selected={isActive}
|
||||
class="flex w-full cursor-pointer items-center gap-2.5 rounded-md px-2.5 py-2 text-left text-body-sm transition-colors max-md:rounded-xl max-md:py-3 max-md:text-body {isActive
|
||||
? 'bg-accent text-accent-foreground'
|
||||
: ''}"
|
||||
id={index === null ? undefined : `search-result-${index}`}
|
||||
onclick={entry.run}
|
||||
onmousemove={() => {
|
||||
if (index !== null) highlighted = index;
|
||||
}}
|
||||
role="option"
|
||||
tabindex={-1}
|
||||
type="button"
|
||||
>
|
||||
{#if entry.org && HuggingFaceService.isEnabled()}
|
||||
<ModelOrgAvatar class="shrink-0" org={entry.org} size="size-icon-md" />
|
||||
{:else}
|
||||
<entry.icon class="{ICON_CLASS_DEFAULT} shrink-0 text-muted-foreground" />
|
||||
{/if}
|
||||
|
||||
{#if entry.snippet}
|
||||
<span class="flex min-w-0 flex-1 flex-col">
|
||||
<span class="truncate">{entry.label}</span>
|
||||
|
||||
<span class="truncate text-caption text-muted-foreground">
|
||||
{entry.snippet.before}<mark class="bg-transparent font-medium text-foreground"
|
||||
>{entry.snippet.match}</mark
|
||||
>{entry.snippet.after}
|
||||
</span>
|
||||
</span>
|
||||
{:else}
|
||||
<span class="min-w-0 flex-1 truncate">{entry.label}</span>
|
||||
{/if}
|
||||
|
||||
{#if entry.pinned}
|
||||
<Pin aria-label="Pinned" class="{ICON_CLASS_SM} shrink-0 text-muted-foreground" />
|
||||
{/if}
|
||||
|
||||
{#if entry.meta}
|
||||
<span class="max-w-2/5 shrink-0 truncate text-caption text-muted-foreground">
|
||||
{entry.meta}
|
||||
</span>
|
||||
{/if}
|
||||
|
||||
{#if entry.keys && !deviceStore.isMobile}
|
||||
<KeyboardShortcutInfo class="opacity-100" keys={entry.keys} />
|
||||
{/if}
|
||||
|
||||
{#if index !== null}
|
||||
<CornerDownLeft
|
||||
class="{ICON_CLASS_SM} shrink-0 max-md:hidden text-muted-foreground {isActive
|
||||
? 'opacity-100'
|
||||
: 'opacity-0'}"
|
||||
/>
|
||||
{/if}
|
||||
</button>
|
||||
{/snippet}
|
||||
|
||||
{#snippet search()}
|
||||
<div class="border-b border-border/30 px-4 py-3 dark:border-border/20">
|
||||
<div class="flex items-center gap-2">
|
||||
<input
|
||||
bind:this={inputRef}
|
||||
bind:value={query}
|
||||
aria-activedescendant={entries.length > 0 ? `search-result-${activeIndex}` : undefined}
|
||||
aria-activedescendant={entries.length > 0 && !selectedModel
|
||||
? `search-result-${activeIndex}`
|
||||
: undefined}
|
||||
aria-controls="search-results"
|
||||
aria-expanded="true"
|
||||
autocomplete="off"
|
||||
class="h-10 min-w-0 flex-1 border-0 bg-transparent px-1 text-title font-normal outline-none placeholder:text-muted-foreground focus:outline-none focus-visible:ring-0"
|
||||
oninput={() => (highlighted = 0)}
|
||||
oninput={() => {
|
||||
highlighted = 0;
|
||||
selectedModel = null;
|
||||
}}
|
||||
onkeydown={handleKeydown}
|
||||
placeholder="Search"
|
||||
role="combobox"
|
||||
|
|
@ -377,100 +455,74 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="min-h-0 flex-1 overflow-y-auto p-2" id="search-results" role="listbox">
|
||||
{#each sections as section, sectionIndex (section.title)}
|
||||
{@const offset = sections
|
||||
.slice(0, sectionIndex)
|
||||
.reduce((total, previous) => total + previous.entries.length, 0)}
|
||||
{#if selectedModel}
|
||||
<!-- the picked repo stays in sight; picking it again goes back to the results -->
|
||||
<div class="border-b border-border/30 p-2 dark:border-border/20" role="listbox">
|
||||
{@render row({ ...selectedModel, run: clearSelectedModel }, null, true)}
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col gap-0.5 {sectionIndex > 0 ? 'mt-3' : ''}" role="group">
|
||||
<p class="flex items-center gap-1.5 px-2.5 pt-1 pb-1.5 text-label-sm text-muted-foreground">
|
||||
{section.title}
|
||||
<!-- the details pane leaves its right edge to its host, as Discover pads it -->
|
||||
<div class="min-h-0 flex-1 overflow-y-auto pr-6">
|
||||
<ModelsDiscoverDetailsContainer compact modelId={selectedModel.label} />
|
||||
</div>
|
||||
{:else}
|
||||
<div class="min-h-0 flex-1 overflow-y-auto p-2" id="search-results" role="listbox">
|
||||
{#each sections as section, sectionIndex (section.title)}
|
||||
{@const offset = sections
|
||||
.slice(0, sectionIndex)
|
||||
.reduce((total, previous) => total + previous.entries.length, 0)}
|
||||
|
||||
{#if section.loading}
|
||||
<Loader2 aria-label="Searching" class="{ICON_CLASS_XS} animate-spin" />
|
||||
{/if}
|
||||
</p>
|
||||
|
||||
{#each section.entries as entry, entryIndex (entry.id)}
|
||||
{@const index = offset + entryIndex}
|
||||
{@const isActive = index === activeIndex && !deviceStore.isMobile}
|
||||
|
||||
<!-- a phone has no keyboard to move a highlight with: no row is lit there -->
|
||||
<button
|
||||
aria-selected={isActive}
|
||||
class="flex w-full cursor-pointer items-center gap-2.5 rounded-md px-2.5 py-2 text-left text-body-sm transition-colors max-md:rounded-xl max-md:py-3 max-md:text-body {isActive
|
||||
? 'bg-accent text-accent-foreground'
|
||||
: ''}"
|
||||
id="search-result-{index}"
|
||||
onclick={entry.run}
|
||||
onmousemove={() => (highlighted = index)}
|
||||
role="option"
|
||||
tabindex={-1}
|
||||
type="button"
|
||||
<div class="flex flex-col gap-0.5 {sectionIndex > 0 ? 'mt-3' : ''}" role="group">
|
||||
<p
|
||||
class="flex items-center gap-1.5 px-2.5 pt-1 pb-1.5 text-label-sm text-muted-foreground"
|
||||
>
|
||||
{#if entry.org && HuggingFaceService.isEnabled()}
|
||||
<ModelOrgAvatar class="shrink-0" org={entry.org} size="size-icon-md" />
|
||||
{:else}
|
||||
<entry.icon class="{ICON_CLASS_DEFAULT} shrink-0 text-muted-foreground" />
|
||||
{section.title}
|
||||
|
||||
{#if section.loading}
|
||||
<Loader2 aria-label="Searching" class="{ICON_CLASS_XS} animate-spin" />
|
||||
{/if}
|
||||
</p>
|
||||
|
||||
{#if entry.snippet}
|
||||
<span class="flex min-w-0 flex-1 flex-col">
|
||||
<span class="truncate">{entry.label}</span>
|
||||
{#each section.entries as entry, entryIndex (entry.id)}
|
||||
{@const index = offset + entryIndex}
|
||||
{@const isActive = index === activeIndex && !deviceStore.isMobile}
|
||||
|
||||
<span class="truncate text-caption text-muted-foreground">
|
||||
{entry.snippet.before}<mark class="bg-transparent font-medium text-foreground"
|
||||
>{entry.snippet.match}</mark
|
||||
>{entry.snippet.after}
|
||||
</span>
|
||||
</span>
|
||||
{:else}
|
||||
<span class="min-w-0 flex-1 truncate">{entry.label}</span>
|
||||
{/if}
|
||||
|
||||
{#if entry.pinned}
|
||||
<Pin aria-label="Pinned" class="{ICON_CLASS_SM} shrink-0 text-muted-foreground" />
|
||||
{/if}
|
||||
|
||||
{#if entry.meta}
|
||||
<span class="max-w-2/5 shrink-0 truncate text-caption text-muted-foreground">
|
||||
{entry.meta}
|
||||
</span>
|
||||
{/if}
|
||||
|
||||
{#if entry.keys && !deviceStore.isMobile}
|
||||
<KeyboardShortcutInfo class="opacity-100" keys={entry.keys} />
|
||||
{/if}
|
||||
|
||||
<CornerDownLeft
|
||||
class="{ICON_CLASS_SM} shrink-0 max-md:hidden text-muted-foreground {isActive
|
||||
? 'opacity-100'
|
||||
: 'opacity-0'}"
|
||||
/>
|
||||
</button>
|
||||
{/each}
|
||||
</div>
|
||||
{:else}
|
||||
<p class="px-3 py-12 text-center text-body-sm text-muted-foreground">{emptyMessage}</p>
|
||||
{/each}
|
||||
</div>
|
||||
<!-- a phone has no keyboard to move a highlight with: no row is lit there -->
|
||||
{@render row(entry, index, isActive)}
|
||||
{/each}
|
||||
</div>
|
||||
{:else}
|
||||
<p class="px-3 py-12 text-center text-body-sm text-muted-foreground">{emptyMessage}</p>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div
|
||||
class="flex items-center gap-5 border-t border-border/30 px-4 py-2.5 text-caption text-muted-foreground max-md:hidden dark:border-border/20"
|
||||
>
|
||||
{@render hint('Close', ['Esc'])}
|
||||
{#if selectedModel}
|
||||
{@render hint('Back', ['Esc'])}
|
||||
{:else}
|
||||
{@render hint('Close', ['Esc'])}
|
||||
|
||||
{@render hint('Navigate', [ArrowUp, ArrowDown])}
|
||||
{@render hint('Navigate', [ArrowUp, ArrowDown])}
|
||||
|
||||
<span class="ml-auto">{@render hint('Open', [CornerDownLeft])}</span>
|
||||
<span class="ml-auto">{@render hint('Open', [CornerDownLeft])}</span>
|
||||
{/if}
|
||||
</div>
|
||||
{/snippet}
|
||||
|
||||
<!-- like every dialog, a phone shows it full screen -->
|
||||
<Dialog.Root onOpenChange={handleOpenChange} {open}>
|
||||
<Dialog.Content
|
||||
class="top-[12%] flex h-[min(36rem,76dvh)]! w-full max-w-2xl! md:w-[calc(100%-2rem)] translate-y-0 flex-col gap-0 overflow-hidden rounded-xl p-0"
|
||||
class="top-[12%] flex h-[min(36rem,76dvh)]! w-full max-w-3xl! md:w-[calc(100%-2rem)] translate-y-0 flex-col gap-0 overflow-hidden rounded-xl p-0"
|
||||
onEscapeKeydown={(event) => {
|
||||
// Esc steps back from a picked repo before it closes the search
|
||||
if (!selectedModel) return;
|
||||
|
||||
event.preventDefault();
|
||||
clearSelectedModel();
|
||||
}}
|
||||
onOpenAutoFocus={(event) => {
|
||||
event.preventDefault();
|
||||
inputRef?.focus();
|
||||
|
|
|
|||
|
|
@ -23,9 +23,19 @@
|
|||
loading?: boolean;
|
||||
/** Error message when loading failed. */
|
||||
error?: string | null;
|
||||
/** Leaner pane for a narrow host such as Search: no Hugging Face link, no description. */
|
||||
compact?: boolean;
|
||||
}
|
||||
|
||||
let { details, error = null, files, loading = false, modelId, readme }: Props = $props();
|
||||
let {
|
||||
compact = false,
|
||||
details,
|
||||
error = null,
|
||||
files,
|
||||
loading = false,
|
||||
modelId,
|
||||
readme
|
||||
}: Props = $props();
|
||||
|
||||
let gguf = $derived(details?.gguf);
|
||||
let baseModels = $derived(HuggingFaceService.getBaseModels(details));
|
||||
|
|
@ -77,7 +87,7 @@
|
|||
</script>
|
||||
|
||||
{#if loading}
|
||||
<ModelsDiscoverDetailsSkeleton />
|
||||
<ModelsDiscoverDetailsSkeleton {compact} />
|
||||
{:else if error}
|
||||
<div class="flex h-full items-center justify-center py-20">
|
||||
<p class="text-body-sm text-destructive">{error}</p>
|
||||
|
|
@ -86,6 +96,7 @@
|
|||
<div class="@container space-y-6 p-6 pr-0">
|
||||
<ModelsDiscoverDetailsHeader
|
||||
{baseModels}
|
||||
{compact}
|
||||
{details}
|
||||
{gguf}
|
||||
{hasReasoning}
|
||||
|
|
|
|||
|
|
@ -6,9 +6,11 @@
|
|||
interface Props {
|
||||
/** Full HuggingFace model id, e.g. `ggml-org/gemma-3-4b-it-GGUF`. */
|
||||
modelId: string;
|
||||
/** Leaner pane for a narrow host such as Search: no Hugging Face link, no description. */
|
||||
compact?: boolean;
|
||||
}
|
||||
|
||||
let { modelId }: Props = $props();
|
||||
let { compact = false, modelId }: Props = $props();
|
||||
|
||||
let details = $state<HfModelDetailInfo | null>(null);
|
||||
let files = $state<HfModelSibling[]>([]);
|
||||
|
|
@ -63,4 +65,4 @@
|
|||
});
|
||||
</script>
|
||||
|
||||
<ModelsDiscoverDetails {details} {error} {files} {loading} {modelId} {readme} />
|
||||
<ModelsDiscoverDetails {compact} {details} {error} {files} {loading} {modelId} {readme} />
|
||||
|
|
|
|||
|
|
@ -20,10 +20,13 @@
|
|||
modalities: ModelModalities;
|
||||
hasTools: boolean;
|
||||
hasReasoning: boolean;
|
||||
/** Leaner pane for a narrow host such as Search: no Hugging Face link, no description. */
|
||||
compact?: boolean;
|
||||
}
|
||||
|
||||
let {
|
||||
baseModels,
|
||||
compact = false,
|
||||
details,
|
||||
gguf,
|
||||
hasReasoning,
|
||||
|
|
@ -83,23 +86,25 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<Button
|
||||
class="h-auto gap-1.5 px-2.5 py-1.5 text-caption"
|
||||
href={HuggingFaceService.getModelUrl(modelId)}
|
||||
rel="noopener noreferrer"
|
||||
size="sm"
|
||||
target="_blank"
|
||||
variant="secondary"
|
||||
>
|
||||
<img alt="" class="size-3.5" src={asset('recommended-mcp/huggingface.ico')} />
|
||||
{#if !compact}
|
||||
<Button
|
||||
class="h-auto gap-1.5 px-2.5 py-1.5 text-caption"
|
||||
href={HuggingFaceService.getModelUrl(modelId)}
|
||||
rel="noopener noreferrer"
|
||||
size="sm"
|
||||
target="_blank"
|
||||
variant="secondary"
|
||||
>
|
||||
<img alt="" class="size-3.5" src={asset('recommended-mcp/huggingface.ico')} />
|
||||
|
||||
View on Hugging Face
|
||||
View on Hugging Face
|
||||
|
||||
<ExternalLink class="size-3.5" />
|
||||
</Button>
|
||||
<ExternalLink class="size-3.5" />
|
||||
</Button>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<ModelsDiscoverDetailsHfHubStats {details} />
|
||||
|
||||
<ModelsDiscoverDetailsMetadata {details} {gguf} {licenseTag} {modelId} />
|
||||
<ModelsDiscoverDetailsMetadata {compact} {details} {gguf} {licenseTag} {modelId} />
|
||||
</header>
|
||||
|
|
|
|||
|
|
@ -13,9 +13,11 @@
|
|||
details: HfModelDetailInfo;
|
||||
gguf?: HfModelGguf;
|
||||
licenseTag: string | null;
|
||||
/** Leaner pane for a narrow host such as Search: no Hugging Face link, no description. */
|
||||
compact?: boolean;
|
||||
}
|
||||
|
||||
let { details, gguf, licenseTag, modelId }: Props = $props();
|
||||
let { compact = false, details, gguf, licenseTag, modelId }: Props = $props();
|
||||
|
||||
// Catalog family description when curated, else the HF card description.
|
||||
let description = $derived(
|
||||
|
|
@ -25,7 +27,7 @@
|
|||
let chatTemplateOpen = $state(false);
|
||||
</script>
|
||||
|
||||
{#if description}
|
||||
{#if description && !compact}
|
||||
<p class="text-body-sm text-muted-foreground">{description}</p>
|
||||
{/if}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,27 +1,36 @@
|
|||
<script lang="ts">
|
||||
import { Skeleton } from '@ggml-org/llama-ui/ui/skeleton';
|
||||
|
||||
interface Props {
|
||||
/** Leaner pane for a narrow host such as Search: no Hugging Face link, no description. */
|
||||
compact?: boolean;
|
||||
}
|
||||
|
||||
let { compact = false }: Props = $props();
|
||||
</script>
|
||||
|
||||
<!-- Static skeleton of ModelsDiscoverDetails: header, metadata chips, download options and readme lines. -->
|
||||
<!-- Static skeleton of ModelsDiscoverDetails: header, metadata chips, download options and readme. -->
|
||||
<div class="@container space-y-6 p-6 pr-0" data-slot="model-details-skeleton">
|
||||
<!-- Header: avatar, name with capability icons, base model line, HF link -->
|
||||
<div class="space-y-3">
|
||||
<div class="flex items-start justify-between gap-3">
|
||||
<div class="flex flex-wrap items-start justify-between gap-3">
|
||||
<div class="flex min-w-0 items-center gap-2">
|
||||
<Skeleton class="size-12 rounded-md" />
|
||||
|
||||
<div class="min-w-0 space-y-1.5">
|
||||
<Skeleton class="h-5 w-56 max-w-full" />
|
||||
<Skeleton class="h-6 w-64 max-w-full" />
|
||||
|
||||
<Skeleton class="h-3 w-40 max-w-full" />
|
||||
<Skeleton class="h-3.5 w-44 max-w-full" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Skeleton class="h-7.5 w-44 shrink-0 rounded-md" />
|
||||
{#if !compact}
|
||||
<Skeleton class="h-7.5 w-44 shrink-0 rounded-md" />
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<!-- downloads / likes / last updated -->
|
||||
<div class="flex items-center gap-4">
|
||||
<div class="flex h-5 items-center gap-4">
|
||||
<Skeleton class="h-3.5 w-16" />
|
||||
|
||||
<Skeleton class="h-3.5 w-12" />
|
||||
|
|
@ -29,63 +38,61 @@
|
|||
<Skeleton class="h-3.5 w-24" />
|
||||
</div>
|
||||
|
||||
<!-- catalog family description, else the HF card description -->
|
||||
<Skeleton class="h-3.5 my-4 w-full" />
|
||||
<!-- catalog family description, else the HF card description: it wraps to a
|
||||
second line in a narrow host -->
|
||||
{#if !compact}
|
||||
<div class="space-y-2 py-0.75">
|
||||
<Skeleton class="h-3.5 w-full" />
|
||||
|
||||
<!-- metadata chips -->
|
||||
<Skeleton class="hidden h-3.5 w-2/5 @max-2xl:block" />
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- metadata chips, as wide as the usual four so they wrap where those do -->
|
||||
<div class="space-y-3">
|
||||
<div class="flex flex-wrap items-center gap-1.5">
|
||||
<Skeleton class="h-7 w-36 rounded-md" />
|
||||
<Skeleton class="h-6.5 w-45 rounded-md" />
|
||||
|
||||
<Skeleton class="h-7 w-28 rounded-md" />
|
||||
<Skeleton class="h-6.5 w-36 rounded-md" />
|
||||
|
||||
<Skeleton class="h-7 w-32 rounded-md" />
|
||||
<Skeleton class="h-6.5 w-47 rounded-md" />
|
||||
|
||||
<Skeleton class="h-7 w-24 rounded-md" />
|
||||
<Skeleton class="h-6.5 w-30 rounded-md" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Download options: quant rows and the draft opt-in line -->
|
||||
<!-- Download options: one row per bit depth, its quant chips on the right -->
|
||||
<div class="rounded-3xl bg-muted/60 elevated-control">
|
||||
<div class="flex w-full flex-col divide-y divide-border/50 px-4 pb-1 dark:divide-border/35">
|
||||
{#each [0, 1, 2] as _, index (index)}
|
||||
<div
|
||||
class="grid grid-cols-[5rem_1fr] items-center gap-3 py-3 @max-lg:grid-cols-1 @max-lg:gap-1.5"
|
||||
>
|
||||
<div class="space-y-1.5">
|
||||
<Skeleton class="h-4 w-14" />
|
||||
<div class="space-y-1">
|
||||
<Skeleton class="h-5 w-12" />
|
||||
|
||||
<Skeleton class="h-2.5 w-24" />
|
||||
<Skeleton class="h-3 w-28" />
|
||||
</div>
|
||||
|
||||
<div class="flex flex-wrap items-center justify-end gap-1.5">
|
||||
<Skeleton class="h-6 w-28 rounded-md" />
|
||||
<div class="flex flex-wrap items-center justify-end gap-1.5 @max-lg:justify-start">
|
||||
<Skeleton class="h-6.5 w-30 rounded-md" />
|
||||
|
||||
<Skeleton class="h-6 w-20 rounded-md" />
|
||||
{#if index === 0}
|
||||
<Skeleton class="h-6.5 w-30 rounded-md" />
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
<div class="space-y-2.5 border-t border-border/50 px-4 pt-3.5 dark:border-border/35">
|
||||
<Skeleton class="h-9 w-full rounded-md" />
|
||||
|
||||
<div class="flex items-center gap-3">
|
||||
<span class="h-px flex-1 bg-border/50"></span>
|
||||
|
||||
<Skeleton class="h-3 w-44" />
|
||||
|
||||
<span class="h-px flex-1 bg-border/50"></span>
|
||||
</div>
|
||||
|
||||
<Skeleton class="h-11 w-full rounded-md" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Readme -->
|
||||
<div class="p-3 rounded-3xl bg-muted/60 elevated-control">
|
||||
<div class="space-y-2.5">
|
||||
<!-- the card's title, then its first paragraph -->
|
||||
<Skeleton class="mt-1 mb-4 h-7 w-1/3" />
|
||||
|
||||
<Skeleton class="h-3.5 w-full" />
|
||||
|
||||
<Skeleton class="h-3.5 w-full" />
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ export const HF_SHARED_DRAFT_TOKEN = 'shared';
|
|||
* Extracts the leading precision digits from a quant token, e.g.
|
||||
* `Q4_K_XL` -> 4, `IQ2_XXS` -> 2, `TQ1_0` -> 1, `BF16` -> 16.
|
||||
*/
|
||||
export const HF_QUANT_PRECISION_REGEX = /^(?:I?Q|TQ|BF|F|MXFP)?(\d+)/i;
|
||||
export const HF_QUANT_PRECISION_REGEX = /^(?:I?Q|TQ|BF|F|MXFP|NVFP)?(\d+)/i;
|
||||
|
||||
// Model card tags
|
||||
|
||||
|
|
|
|||
|
|
@ -48,10 +48,10 @@ export const MODEL_ID = {
|
|||
PARAMS_REGEX: /^[Ee]?\d+(\.\d+)?[BbMmKkTt]$/,
|
||||
|
||||
/**
|
||||
* Matches a quantization/precision segment, e.g. `Q4_K_M`, `IQ4_XS`, `F16`, `BF16`, `MXFP4`.
|
||||
* Matches a quantization/precision segment, e.g. `Q4_K_M`, `IQ4_XS`, `F16`, `BF16`, `MXFP4`, `NVFP4`.
|
||||
* Case-insensitive to handle both uppercase and lowercase inputs.
|
||||
*/
|
||||
QUANTIZATION_SEGMENT_REGEX: /^(I?Q\d+(_[A-Z0-9]+)*|F\d+|BF\d+|MXFP\d+(_[A-Z0-9]+)*)$/i,
|
||||
QUANTIZATION_SEGMENT_REGEX: /^(I?Q\d+(_[A-Z0-9]+)*|F\d+|BF\d+|(?:MX|NV)FP\d+(_[A-Z0-9]+)*)$/i,
|
||||
|
||||
/** Separates the model path from the quantization tag, e.g. `model:Q4_K_M`. */
|
||||
QUANTIZATION_SEPARATOR: ':',
|
||||
|
|
|
|||
|
|
@ -59,6 +59,8 @@ describe('getBitDepth', () => {
|
|||
it('falls back to the leading precision digits', () => {
|
||||
expect(getBitDepth('TQ1_0')).toBe(1);
|
||||
expect(getBitDepth('MXFP4_MOE')).toBe(4);
|
||||
expect(getBitDepth('NVFP4')).toBe(4);
|
||||
expect(HuggingFaceService.extractQuantMeta('Inkling-2-Mini-NVFP4.gguf')?.quant).toBe('NVFP4');
|
||||
});
|
||||
|
||||
it('returns null for unrecognized tokens', () => {
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ describe('parseModelId', () => {
|
|||
expect(parseModelId('model-100B-F16')).toMatchObject({ quantization: 'F16' });
|
||||
expect(parseModelId('model-100B-BF16')).toMatchObject({ quantization: 'BF16' });
|
||||
expect(parseModelId('model-100B-MXFP4')).toMatchObject({ quantization: 'MXFP4' });
|
||||
expect(parseModelId('model-26B-NVFP4')).toMatchObject({ quantization: 'NVFP4' });
|
||||
|
||||
// Colon-separated quantization
|
||||
expect(parseModelId('model-100B:UD-IQ1_S')).toMatchObject({ quantization: 'UD-IQ1_S' });
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue