Spaces:
Runtime error
Runtime error
show only non-gated models
Browse files17 unmodified lines181920212223242521222728292324252627283529303132333417 unmodified lines
const promises = compatibleModels.map(async (model) => { const configUrl = `https://huggingface.co/${model.modelId}/raw/main/tokenizer_config.json`; const res = await fetch(configUrl, { headers: { Authorization: `Bearer ${HF_TOKEN}` } }); const res = await fetch(configUrl); if (!res.ok) { throw new Error( `Failed to fetch tokenizer configuration for model ${model.id}: ${res.status} ${res.statusText}` ); return null; // Ignore failed requests by returning null } const tokenizerConfig = await res.json(); return { ...model, tokenizerConfig } satisfies ModelEntryWithTokenizer; });
const models: ModelEntryWithTokenizer[] = await Promise.all(promises); const models: ModelEntryWithTokenizer[] = (await Promise.all(promises)).filter( (model) => model !== null );
return { models };};src/routes/+page.server.ts+5-9