fetch all tokenizer configs
Browse files
src/routes/+page.server.ts
CHANGED
@@ -13,9 +13,8 @@ export const load: PageServerLoad = async ({ fetch }) => {
|
|
13 |
Authorization: `Bearer ${HF_TOKEN}`
|
14 |
}
|
15 |
});
|
16 |
-
|
17 |
compatibleModels.sort((a, b) => a.id.toLowerCase().localeCompare(b.id.toLowerCase()));
|
18 |
-
compatibleModels = compatibleModels.slice(0, 2);
|
19 |
|
20 |
const promises = compatibleModels.map(async (model) => {
|
21 |
const configUrl = `https://huggingface.co/${model.modelId}/raw/main/tokenizer_config.json`;
|
@@ -24,6 +23,11 @@ export const load: PageServerLoad = async ({ fetch }) => {
|
|
24 |
Authorization: `Bearer ${HF_TOKEN}`
|
25 |
}
|
26 |
});
|
|
|
|
|
|
|
|
|
|
|
27 |
const tokenizerConfig = await res.json();
|
28 |
return { ...model, tokenizerConfig } satisfies ModelEntryWithTokenizer;
|
29 |
});
|
|
|
13 |
Authorization: `Bearer ${HF_TOKEN}`
|
14 |
}
|
15 |
});
|
16 |
+
const compatibleModels: ModelEntry[] = await res.json();
|
17 |
compatibleModels.sort((a, b) => a.id.toLowerCase().localeCompare(b.id.toLowerCase()));
|
|
|
18 |
|
19 |
const promises = compatibleModels.map(async (model) => {
|
20 |
const configUrl = `https://huggingface.co/${model.modelId}/raw/main/tokenizer_config.json`;
|
|
|
23 |
Authorization: `Bearer ${HF_TOKEN}`
|
24 |
}
|
25 |
});
|
26 |
+
if (!res.ok) {
|
27 |
+
throw new Error(
|
28 |
+
`Failed to fetch tokenizer configuration for model ${model.id}: ${res.status} ${res.statusText}`
|
29 |
+
);
|
30 |
+
}
|
31 |
const tokenizerConfig = await res.json();
|
32 |
return { ...model, tokenizerConfig } satisfies ModelEntryWithTokenizer;
|
33 |
});
|