Spaces:
Runtime error
Runtime error
fetch all tokenizer configs
Browse files12 unmodified lines131415161617181819202 unmodified lines232425262728293031323312 unmodified lines Authorization: `Bearer ${HF_TOKEN}` } }); let compatibleModels: ModelEntry[] = await res.json(); const compatibleModels: ModelEntry[] = await res.json(); compatibleModels.sort((a, b) => a.id.toLowerCase().localeCompare(b.id.toLowerCase())); compatibleModels = compatibleModels.slice(0, 2);
const promises = compatibleModels.map(async (model) => { const configUrl = `https://huggingface.co/${model.modelId}/raw/main/tokenizer_config.json`;2 unmodified lines Authorization: `Bearer ${HF_TOKEN}` } }); if (!res.ok) { throw new Error( `Failed to fetch tokenizer configuration for model ${model.id}: ${res.status} ${res.statusText}` ); } const tokenizerConfig = await res.json(); return { ...model, tokenizerConfig } satisfies ModelEntryWithTokenizer; });src/routes/+page.server.ts+6-2