mishig HF staff commited on
Commit
d36fc40
1 Parent(s): 15a83db

show only non-gated models

Browse files
Files changed (1) hide show
  1. src/routes/+page.server.ts +5 -9
src/routes/+page.server.ts CHANGED
@@ -18,21 +18,17 @@ export const load: PageServerLoad = async ({ fetch }) => {
18
 
19
  const promises = compatibleModels.map(async (model) => {
20
  const configUrl = `https://huggingface.co/${model.modelId}/raw/main/tokenizer_config.json`;
21
- const res = await fetch(configUrl, {
22
- headers: {
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
  });
34
 
35
- const models: ModelEntryWithTokenizer[] = await Promise.all(promises);
 
 
36
 
37
  return { models };
38
  };
 
18
 
19
  const promises = compatibleModels.map(async (model) => {
20
  const configUrl = `https://huggingface.co/${model.modelId}/raw/main/tokenizer_config.json`;
21
+ const res = await fetch(configUrl);
 
 
 
 
22
  if (!res.ok) {
23
+ return null; // Ignore failed requests by returning null
 
 
24
  }
25
  const tokenizerConfig = await res.json();
26
  return { ...model, tokenizerConfig } satisfies ModelEntryWithTokenizer;
27
  });
28
 
29
+ const models: ModelEntryWithTokenizer[] = (await Promise.all(promises)).filter(
30
+ (model) => model !== null
31
+ );
32
 
33
  return { models };
34
  };