victor HF staff commited on
Commit
24e0413
·
1 Parent(s): ca9d5ef
src/lib/components/InferencePlayground/InferencePlayground.svelte CHANGED
@@ -9,7 +9,7 @@
9
  handleStreamingResponse,
10
  handleNonStreamingResponse,
11
  isSystemPromptSupported,
12
- FEATUED_MODELS_IDS,
13
  } from "./inferencePlaygroundUtils";
14
 
15
  import { onDestroy, onMount } from "svelte";
@@ -30,7 +30,7 @@
30
  const modelFromQueryParam = models.find(model => model.id === modelIdFromQueryParam);
31
 
32
  let conversation: Conversation = {
33
- model: modelFromQueryParam ?? models.find(m => FEATUED_MODELS_IDS.includes(m.id)) ?? models[0],
34
  config: defaultGenerationConfig,
35
  messages: [{ ...startMessageUser }],
36
  systemMessage: startMessageSystem,
 
9
  handleStreamingResponse,
10
  handleNonStreamingResponse,
11
  isSystemPromptSupported,
12
+ FEATURED_MODELS_IDS,
13
  } from "./inferencePlaygroundUtils";
14
 
15
  import { onDestroy, onMount } from "svelte";
 
30
  const modelFromQueryParam = models.find(model => model.id === modelIdFromQueryParam);
31
 
32
  let conversation: Conversation = {
33
+ model: modelFromQueryParam ?? models.find(m => FEATURED_MODELS_IDS.includes(m.id)) ?? models[0],
34
  config: defaultGenerationConfig,
35
  messages: [{ ...startMessageUser }],
36
  systemMessage: startMessageSystem,
src/lib/components/InferencePlayground/InferencePlaygroundModelSelectorModal.svelte CHANGED
@@ -3,7 +3,7 @@
3
 
4
  import { createEventDispatcher, tick } from "svelte";
5
 
6
- import { FEATUED_MODELS_IDS } from "./inferencePlaygroundUtils";
7
  import IconSearch from "../Icons/IconSearch.svelte";
8
  import IconStar from "../Icons/IconStar.svelte";
9
 
@@ -17,8 +17,8 @@
17
 
18
  const dispatch = createEventDispatcher<{ modelSelected: string; close: void }>();
19
 
20
- let featuredModels = models.filter(m => FEATUED_MODELS_IDS.includes(m.id));
21
- let otherModels = models.filter(m => !FEATUED_MODELS_IDS.includes(m.id));
22
 
23
  if (featuredModels.findIndex(model => model.id === conversation.model.id) !== -1) {
24
  highlightIdx = featuredModels.findIndex(model => model.id === conversation.model.id);
@@ -83,14 +83,14 @@
83
  function filterModels(query: string) {
84
  featuredModels = models.filter(m =>
85
  query
86
- ? FEATUED_MODELS_IDS.includes(m.id) && m.id.toLocaleLowerCase().includes(query.toLocaleLowerCase().trim())
87
- : FEATUED_MODELS_IDS.includes(m.id)
88
  );
89
 
90
  otherModels = models.filter(m =>
91
  query
92
- ? !FEATUED_MODELS_IDS.includes(m.id) && m.id.toLocaleLowerCase().includes(query.toLocaleLowerCase().trim())
93
- : !FEATUED_MODELS_IDS.includes(m.id)
94
  );
95
  }
96
  </script>
@@ -119,56 +119,60 @@
119
  />
120
  </div>
121
  <div class="max-h-[300px] overflow-y-auto overflow-x-hidden">
122
- <div>
123
- <div class="px-2 py-1.5 text-xs font-medium text-gray-500">Trending</div>
124
  <div>
125
- {#each featuredModels as model, idx}
126
- {@const [nameSpace, modelName] = model.id.split("/")}
127
- <button
128
- class="flex w-full cursor-pointer items-center px-2 py-1.5 text-sm {highlightIdx === idx
129
- ? 'highlighted bg-gray-100 dark:bg-gray-800'
130
- : ''}"
131
- on:mouseenter={() => highlightRow(idx)}
132
- on:click={() => {
133
- dispatch("modelSelected", model.id);
134
- dispatch("close");
135
- }}
136
- >
137
- <IconStar classNames="lucide lucide-star mr-2 h-4 w-4 text-yellow-400" />
138
- <span class="inline-flex items-center"
139
- ><span class="text-gray-500 dark:text-gray-400">{nameSpace}</span><span
140
- class="mx-1 text-gray-300 dark:text-gray-700">/</span
141
- ><span class="text-black dark:text-white">{modelName}</span></span
142
  >
143
- </button>
144
- {/each}
 
 
 
 
 
 
 
145
  </div>
146
- </div>
147
- <div>
148
- <div class="px-2 py-1.5 text-xs font-medium text-gray-500">Other Models</div>
149
  <div>
150
- {#each otherModels as model, _idx}
151
- {@const [nameSpace, modelName] = model.id.split("/")}
152
- {@const idx = featuredModels.length + _idx}
153
- <button
154
- class="flex w-full cursor-pointer items-center px-2 py-1.5 text-sm {highlightIdx === idx
155
- ? 'highlighted bg-gray-100 dark:bg-gray-800'
156
- : ''}"
157
- on:mouseenter={() => highlightRow(idx)}
158
- on:click={() => {
159
- dispatch("modelSelected", model.id);
160
- dispatch("close");
161
- }}
162
- >
163
- <span class="inline-flex items-center"
164
- ><span class="text-gray-500 dark:text-gray-400">{nameSpace}</span><span
165
- class="mx-1 text-gray-300 dark:text-gray-700">/</span
166
- ><span class="text-black dark:text-white">{modelName}</span></span
167
  >
168
- </button>
169
- {/each}
 
 
 
 
 
 
170
  </div>
171
- </div>
172
  </div>
173
  </div>
174
  </div>
 
3
 
4
  import { createEventDispatcher, tick } from "svelte";
5
 
6
+ import { FEATURED_MODELS_IDS } from "./inferencePlaygroundUtils";
7
  import IconSearch from "../Icons/IconSearch.svelte";
8
  import IconStar from "../Icons/IconStar.svelte";
9
 
 
17
 
18
  const dispatch = createEventDispatcher<{ modelSelected: string; close: void }>();
19
 
20
+ let featuredModels = models.filter(m => FEATURED_MODELS_IDS.includes(m.id));
21
+ let otherModels = models.filter(m => !FEATURED_MODELS_IDS.includes(m.id));
22
 
23
  if (featuredModels.findIndex(model => model.id === conversation.model.id) !== -1) {
24
  highlightIdx = featuredModels.findIndex(model => model.id === conversation.model.id);
 
83
  function filterModels(query: string) {
84
  featuredModels = models.filter(m =>
85
  query
86
+ ? FEATURED_MODELS_IDS.includes(m.id) && m.id.toLocaleLowerCase().includes(query.toLocaleLowerCase().trim())
87
+ : FEATURED_MODELS_IDS.includes(m.id)
88
  );
89
 
90
  otherModels = models.filter(m =>
91
  query
92
+ ? !FEATURED_MODELS_IDS.includes(m.id) && m.id.toLocaleLowerCase().includes(query.toLocaleLowerCase().trim())
93
+ : !FEATURED_MODELS_IDS.includes(m.id)
94
  );
95
  }
96
  </script>
 
119
  />
120
  </div>
121
  <div class="max-h-[300px] overflow-y-auto overflow-x-hidden">
122
+ {#if featuredModels.length}
 
123
  <div>
124
+ <div class="px-2 py-1.5 text-xs font-medium text-gray-500">Trending</div>
125
+ <div>
126
+ {#each featuredModels as model, idx}
127
+ {@const [nameSpace, modelName] = model.id.split("/")}
128
+ <button
129
+ class="flex w-full cursor-pointer items-center px-2 py-1.5 text-sm {highlightIdx === idx
130
+ ? 'highlighted bg-gray-100 dark:bg-gray-800'
131
+ : ''}"
132
+ on:mouseenter={() => highlightRow(idx)}
133
+ on:click={() => {
134
+ dispatch("modelSelected", model.id);
135
+ dispatch("close");
136
+ }}
 
 
 
 
137
  >
138
+ <IconStar classNames="lucide lucide-star mr-1.5 size-4 text-yellow-400" />
139
+ <span class="inline-flex items-center"
140
+ ><span class="text-gray-500 dark:text-gray-400">{nameSpace}</span><span
141
+ class="mx-1 text-gray-300 dark:text-gray-700">/</span
142
+ ><span class="text-black dark:text-white">{modelName}</span></span
143
+ >
144
+ </button>
145
+ {/each}
146
+ </div>
147
  </div>
148
+ {/if}
149
+ {#if otherModels.length}
 
150
  <div>
151
+ <div class="px-2 py-1.5 text-xs font-medium text-gray-500">Other Models</div>
152
+ <div>
153
+ {#each otherModels as model, _idx}
154
+ {@const [nameSpace, modelName] = model.id.split("/")}
155
+ {@const idx = featuredModels.length + _idx}
156
+ <button
157
+ class="flex w-full cursor-pointer items-center px-2 py-1.5 text-sm {highlightIdx === idx
158
+ ? 'highlighted bg-gray-100 dark:bg-gray-800'
159
+ : ''}"
160
+ on:mouseenter={() => highlightRow(idx)}
161
+ on:click={() => {
162
+ dispatch("modelSelected", model.id);
163
+ dispatch("close");
164
+ }}
 
 
 
165
  >
166
+ <span class="inline-flex items-center"
167
+ ><span class="text-gray-500 dark:text-gray-400">{nameSpace}</span><span
168
+ class="mx-1 text-gray-300 dark:text-gray-700">/</span
169
+ ><span class="text-black dark:text-white">{modelName}</span></span
170
+ >
171
+ </button>
172
+ {/each}
173
+ </div>
174
  </div>
175
+ {/if}
176
  </div>
177
  </div>
178
  </div>
src/lib/components/InferencePlayground/inferencePlaygroundUtils.ts CHANGED
@@ -65,7 +65,9 @@ export function isSystemPromptSupported(model: ModelEntryWithTokenizer) {
65
  return model.tokenizerConfig?.chat_template?.includes("system");
66
  }
67
 
68
- export const FEATUED_MODELS_IDS = [
 
 
69
  "meta-llama/Meta-Llama-3.1-70B-Instruct",
70
  "meta-llama/Meta-Llama-3.1-8B-Instruct",
71
  "google/gemma-2-9b-it",
 
65
  return model.tokenizerConfig?.chat_template?.includes("system");
66
  }
67
 
68
+ export const FEATURED_MODELS_IDS = [
69
+ "Qwen/Qwen2.5-72B-Instruct",
70
+ "meta-llama/Meta-Llama-3.1-70B-Instruct",
71
  "meta-llama/Meta-Llama-3.1-70B-Instruct",
72
  "meta-llama/Meta-Llama-3.1-8B-Instruct",
73
  "google/gemma-2-9b-it",