Merge pull request #1 from huggingface/list_currently_running_models
Browse files
package.json
CHANGED
@@ -30,6 +30,7 @@
|
|
30 |
},
|
31 |
"type": "module",
|
32 |
"dependencies": {
|
|
|
33 |
"@huggingface/inference": "^2.7.0",
|
34 |
"@tailwindcss/container-queries": "^0.1.1"
|
35 |
}
|
|
|
30 |
},
|
31 |
"type": "module",
|
32 |
"dependencies": {
|
33 |
+
"@huggingface/hub": "^0.15.1",
|
34 |
"@huggingface/inference": "^2.7.0",
|
35 |
"@tailwindcss/container-queries": "^0.1.1"
|
36 |
}
|
pnpm-lock.yaml
CHANGED
@@ -5,6 +5,9 @@ settings:
|
|
5 |
excludeLinksFromLockfile: false
|
6 |
|
7 |
dependencies:
|
|
|
|
|
|
|
8 |
'@huggingface/inference':
|
9 |
specifier: ^2.7.0
|
10 |
version: 2.7.0
|
@@ -280,6 +283,14 @@ packages:
|
|
280 |
dev: true
|
281 |
optional: true
|
282 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
283 |
/@huggingface/inference@2.7.0:
|
284 |
resolution: {integrity: sha512-u7Fn637Q3f7nUB1tajM4CgzhvoFQkOQr5W5Fm+2wT9ETgGoLBh25BLlYPTJRjAd2WY01s71v0lqAwNvHHCc3mg==}
|
285 |
engines: {node: '>=18'}
|
@@ -1043,6 +1054,10 @@ packages:
|
|
1043 |
resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==}
|
1044 |
dev: true
|
1045 |
|
|
|
|
|
|
|
|
|
1046 |
/hasown@2.0.2:
|
1047 |
resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==}
|
1048 |
engines: {node: '>= 0.4'}
|
|
|
5 |
excludeLinksFromLockfile: false
|
6 |
|
7 |
dependencies:
|
8 |
+
'@huggingface/hub':
|
9 |
+
specifier: ^0.15.1
|
10 |
+
version: 0.15.1
|
11 |
'@huggingface/inference':
|
12 |
specifier: ^2.7.0
|
13 |
version: 2.7.0
|
|
|
283 |
dev: true
|
284 |
optional: true
|
285 |
|
286 |
+
/@huggingface/hub@0.15.1:
|
287 |
+
resolution: {integrity: sha512-uHb4aFkJDoGfLeRHfFTjkI36Z8IV6Z1c+KzhMDqUSC56opyr7Mn1Nsx7Rri/C7KDwROhQfBp/fOOqqjTzn6Cgg==}
|
288 |
+
engines: {node: '>=18'}
|
289 |
+
dependencies:
|
290 |
+
'@huggingface/tasks': 0.10.19
|
291 |
+
hash-wasm: 4.11.0
|
292 |
+
dev: false
|
293 |
+
|
294 |
/@huggingface/inference@2.7.0:
|
295 |
resolution: {integrity: sha512-u7Fn637Q3f7nUB1tajM4CgzhvoFQkOQr5W5Fm+2wT9ETgGoLBh25BLlYPTJRjAd2WY01s71v0lqAwNvHHCc3mg==}
|
296 |
engines: {node: '>=18'}
|
|
|
1054 |
resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==}
|
1055 |
dev: true
|
1056 |
|
1057 |
+
/hash-wasm@4.11.0:
|
1058 |
+
resolution: {integrity: sha512-HVusNXlVqHe0fzIzdQOGolnFN6mX/fqcrSAOcTBXdvzrXVHwTz11vXeKRmkR5gTuwVpvHZEIyKoePDvuAR+XwQ==}
|
1059 |
+
dev: false
|
1060 |
+
|
1061 |
/hasown@2.0.2:
|
1062 |
resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==}
|
1063 |
engines: {node: '>= 0.4'}
|
src/lib/components/Playground/Playground.svelte
CHANGED
@@ -10,32 +10,10 @@
|
|
10 |
import PlaygroundOptions from '$lib/components/Playground/PlaygroundOptions.svelte';
|
11 |
import PlaygroundTokenModal from './PlaygroundTokenModal.svelte';
|
12 |
import PlaygroundModelSelector from './PlaygroundModelSelector.svelte';
|
13 |
-
import { onDestroy } from 'svelte';
|
|
|
14 |
|
15 |
-
|
16 |
-
'01-ai/Yi-1.5-34B-Chat',
|
17 |
-
'codellama/CodeLlama-34b-Instruct-hf',
|
18 |
-
'CohereForAI/c4ai-command-r-plus',
|
19 |
-
'google/gemma-1.1-2b-it',
|
20 |
-
'google/gemma-1.1-7b-it',
|
21 |
-
'google/gemma-2-27b-it',
|
22 |
-
|
23 |
-
'HuggingFaceH4/zephyr-7b-beta',
|
24 |
-
'HuggingFaceH4/zephyr-orpo-141b-A35b-v0.1',
|
25 |
-
'HuggingFaceM4/idefics-9b-instruct',
|
26 |
-
|
27 |
-
'meta-llama/Llama-2-13b-chat-hf',
|
28 |
-
'meta-llama/Llama-2-70b-chat-hf',
|
29 |
-
'meta-llama/Llama-2-7b-chat-hf',
|
30 |
-
'meta-llama/Meta-Llama-3-70B-Instruct',
|
31 |
-
'meta-llama/Meta-Llama-3-8B-Instruct',
|
32 |
-
'microsoft/Phi-3-mini-4k-instruct',
|
33 |
-
'mistralai/Mistral-7B-Instruct-v0.1',
|
34 |
-
'mistralai/Mistral-7B-Instruct-v0.2',
|
35 |
-
'mistralai/Mistral-7B-Instruct-v0.3',
|
36 |
-
'mistralai/Mixtral-8x7B-Instruct-v0.1',
|
37 |
-
'tiiuae/falcon-7b-instruct'
|
38 |
-
];
|
39 |
|
40 |
const startMessages: Message[] = [{ role: 'user', content: '' }];
|
41 |
|
@@ -66,6 +44,14 @@
|
|
66 |
let messageContainer: HTMLDivElement | null = null;
|
67 |
let abortController: AbortController | null = null;
|
68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
onDestroy(() => {
|
70 |
if (abortController) {
|
71 |
abortController.abort();
|
@@ -424,7 +410,7 @@
|
|
424 |
}}
|
425 |
>
|
426 |
{#each compatibleModels as model}
|
427 |
-
<option value={model}>{model}</option>
|
428 |
{/each}
|
429 |
</select>
|
430 |
</div>
|
|
|
10 |
import PlaygroundOptions from '$lib/components/Playground/PlaygroundOptions.svelte';
|
11 |
import PlaygroundTokenModal from './PlaygroundTokenModal.svelte';
|
12 |
import PlaygroundModelSelector from './PlaygroundModelSelector.svelte';
|
13 |
+
import { onDestroy, onMount } from 'svelte';
|
14 |
+
import { type ModelEntry } from "@huggingface/hub";
|
15 |
|
16 |
+
let compatibleModels: ModelEntry[] = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
const startMessages: Message[] = [{ role: 'user', content: '' }];
|
19 |
|
|
|
44 |
let messageContainer: HTMLDivElement | null = null;
|
45 |
let abortController: AbortController | null = null;
|
46 |
|
47 |
+
onMount(() => {
|
48 |
+
(async () => {
|
49 |
+
// TODO: use hfjs.hub listModels after https://github.com/huggingface/huggingface.js/pull/795
|
50 |
+
const res = await fetch("https://huggingface.co/api/models?pipeline_tag=text-generation&inferenceStatus=loaded&filter=conversational");
|
51 |
+
compatibleModels = await res.json() as ModelEntry[];
|
52 |
+
})();
|
53 |
+
})
|
54 |
+
|
55 |
onDestroy(() => {
|
56 |
if (abortController) {
|
57 |
abortController.abort();
|
|
|
410 |
}}
|
411 |
>
|
412 |
{#each compatibleModels as model}
|
413 |
+
<option value={model.id}>{model.id}</option>
|
414 |
{/each}
|
415 |
</select>
|
416 |
</div>
|
src/lib/components/Playground/PlaygroundModelSelector.svelte
CHANGED
@@ -1,5 +1,7 @@
|
|
1 |
<script lang="ts">
|
2 |
-
|
|
|
|
|
3 |
export let currentModel = compatibleModels[0];
|
4 |
export let disabled = false;
|
5 |
</script>
|
@@ -16,7 +18,7 @@
|
|
16 |
class="block w-full rounded-lg border border-gray-300 bg-gray-50 p-2.5 text-sm text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400 dark:focus:border-blue-500 dark:focus:ring-blue-500"
|
17 |
>
|
18 |
{#each compatibleModels as model}
|
19 |
-
<option value={model}>{model}</option>
|
20 |
{/each}
|
21 |
</select>
|
22 |
</div>
|
|
|
1 |
<script lang="ts">
|
2 |
+
import { type ModelEntry } from "@huggingface/hub";
|
3 |
+
|
4 |
+
export let compatibleModels: ModelEntry[] = [];
|
5 |
export let currentModel = compatibleModels[0];
|
6 |
export let disabled = false;
|
7 |
</script>
|
|
|
18 |
class="block w-full rounded-lg border border-gray-300 bg-gray-50 p-2.5 text-sm text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400 dark:focus:border-blue-500 dark:focus:ring-blue-500"
|
19 |
>
|
20 |
{#each compatibleModels as model}
|
21 |
+
<option value={model.id}>{model.id}</option>
|
22 |
{/each}
|
23 |
</select>
|
24 |
</div>
|
src/lib/types/index.d.ts
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
type Message = {
|
2 |
role: string;
|
3 |
content: string;
|
@@ -14,7 +16,7 @@ type ModelConfig = {
|
|
14 |
|
15 |
type Conversation = {
|
16 |
id: string;
|
17 |
-
model:
|
18 |
config: ModelConfig;
|
19 |
messages: Message[];
|
20 |
};
|
|
|
1 |
+
import type { ModelEntry } from "@huggingface/hub";
|
2 |
+
|
3 |
type Message = {
|
4 |
role: string;
|
5 |
content: string;
|
|
|
16 |
|
17 |
type Conversation = {
|
18 |
id: string;
|
19 |
+
model: ModelEntry;
|
20 |
config: ModelConfig;
|
21 |
messages: Message[];
|
22 |
};
|