Disabling model discovery for now.
Browse files- package-lock.json +2 -2
- package.json +2 -2
- src/app/worker-connection.js +0 -7
- src/worker/boot-worker.js +18 -12
- src/worker/curated-model-list.json +151 -0
package-lock.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
| 1 |
{
|
| 2 |
"name": "localm",
|
| 3 |
-
"version": "1.1.
|
| 4 |
"lockfileVersion": 3,
|
| 5 |
"requires": true,
|
| 6 |
"packages": {
|
| 7 |
"": {
|
| 8 |
"name": "localm",
|
| 9 |
-
"version": "1.1.
|
| 10 |
"license": "ISC",
|
| 11 |
"dependencies": {
|
| 12 |
"@huggingface/transformers": "^3.7.2",
|
|
|
|
| 1 |
{
|
| 2 |
"name": "localm",
|
| 3 |
+
"version": "1.1.35",
|
| 4 |
"lockfileVersion": 3,
|
| 5 |
"requires": true,
|
| 6 |
"packages": {
|
| 7 |
"": {
|
| 8 |
"name": "localm",
|
| 9 |
+
"version": "1.1.35",
|
| 10 |
"license": "ISC",
|
| 11 |
"dependencies": {
|
| 12 |
"@huggingface/transformers": "^3.7.2",
|
package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
{
|
| 2 |
"name": "localm",
|
| 3 |
-
"version": "1.1.
|
| 4 |
-
"description": "Chat application
|
| 5 |
"scripts": {
|
| 6 |
"build": "esbuild src/index.js --target=es6 --bundle --sourcemap --outfile=./index.js --format=iife --external:fs --external:path --external:child_process --external:ws --external:katex/dist/katex.min.css",
|
| 7 |
"start": "npm run build -- --watch --serve=0.0.0.0:8812 --servedir=. --serve-fallback=index.html",
|
|
|
|
| 1 |
{
|
| 2 |
"name": "localm",
|
| 3 |
+
"version": "1.1.37",
|
| 4 |
+
"description": "Chat application",
|
| 5 |
"scripts": {
|
| 6 |
"build": "esbuild src/index.js --target=es6 --bundle --sourcemap --outfile=./index.js --format=iife --external:fs --external:path --external:child_process --external:ws --external:katex/dist/katex.min.css",
|
| 7 |
"start": "npm run build -- --watch --serve=0.0.0.0:8812 --servedir=. --serve-fallback=index.html",
|
src/app/worker-connection.js
CHANGED
|
@@ -7,7 +7,6 @@ export function workerConnection() {
|
|
| 7 |
|
| 8 |
const connection = {
|
| 9 |
loaded: workerLoaded.then(worker => ({ env: worker.env })),
|
| 10 |
-
listModels,
|
| 11 |
loadModel,
|
| 12 |
runPrompt,
|
| 13 |
listChatModels
|
|
@@ -75,12 +74,6 @@ export function workerConnection() {
|
|
| 75 |
});
|
| 76 |
}
|
| 77 |
|
| 78 |
-
async function listModels() {
|
| 79 |
-
await workerLoaded;
|
| 80 |
-
const { send } = await workerLoaded;
|
| 81 |
-
return send({ type: 'listModels' });
|
| 82 |
-
}
|
| 83 |
-
|
| 84 |
/**
|
| 85 |
* List and classify chat-capable models via worker. Returns a promise and accepts an onProgress callback.
|
| 86 |
* @param {object} params
|
|
|
|
| 7 |
|
| 8 |
const connection = {
|
| 9 |
loaded: workerLoaded.then(worker => ({ env: worker.env })),
|
|
|
|
| 10 |
loadModel,
|
| 11 |
runPrompt,
|
| 12 |
listChatModels
|
|
|
|
| 74 |
});
|
| 75 |
}
|
| 76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
/**
|
| 78 |
* List and classify chat-capable models via worker. Returns a promise and accepts an onProgress callback.
|
| 79 |
* @param {object} params
|
src/worker/boot-worker.js
CHANGED
|
@@ -3,6 +3,8 @@
|
|
| 3 |
import { ModelCache } from './model-cache';
|
| 4 |
import { listChatModelsIterator } from './list-chat-models.js';
|
| 5 |
|
|
|
|
|
|
|
| 6 |
export function bootWorker() {
|
| 7 |
const modelCache = new ModelCache();
|
| 8 |
let selectedModel = modelCache.knownModels[0];
|
|
@@ -27,9 +29,7 @@ export function bootWorker() {
|
|
| 27 |
async function handleMessage({ data }) {
|
| 28 |
const { id } = data;
|
| 29 |
try {
|
| 30 |
-
if (data.type === '
|
| 31 |
-
self.postMessage({ id, type: 'response', result: modelCache.knownModels });
|
| 32 |
-
} else if (data.type === 'listChatModels') {
|
| 33 |
// kick off the long-running listing/classification task
|
| 34 |
handleListChatModels(data).catch(err => {
|
| 35 |
self.postMessage({ id, type: 'error', error: String(err) });
|
|
@@ -74,6 +74,10 @@ export function bootWorker() {
|
|
| 74 |
|
| 75 |
// Implementation of the listChatModels worker action using the async-iterator action.
|
| 76 |
async function handleListChatModels({ id, params = {} }) {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
const iterator = listChatModelsIterator(params);
|
| 78 |
let sawDone = false;
|
| 79 |
// batching buffer
|
|
@@ -99,26 +103,28 @@ export function bootWorker() {
|
|
| 99 |
}
|
| 100 |
}
|
| 101 |
|
| 102 |
-
activeTasks.set(id, { abort: () =>
|
|
|
|
| 103 |
try {
|
| 104 |
for await (const delta of iterator) {
|
| 105 |
-
try { enqueueProgress(delta); } catch (e) {}
|
|
|
|
| 106 |
if (delta && delta.status === 'done') {
|
| 107 |
sawDone = true;
|
| 108 |
-
// flush any remaining progress messages synchronously
|
| 109 |
-
try { flushBatch(); } catch (e) {}
|
| 110 |
-
try { self.postMessage({ id, type: 'response', result: { models: delta.models, meta: delta.meta } }); } catch (e) {}
|
| 111 |
}
|
| 112 |
}
|
| 113 |
|
|
|
|
|
|
|
| 114 |
if (!sawDone) {
|
| 115 |
// iterator exited early (likely cancelled)
|
| 116 |
-
|
| 117 |
-
|
|
|
|
| 118 |
}
|
| 119 |
} catch (err) {
|
| 120 |
-
|
| 121 |
-
|
| 122 |
} finally {
|
| 123 |
activeTasks.delete(id);
|
| 124 |
}
|
|
|
|
| 3 |
import { ModelCache } from './model-cache';
|
| 4 |
import { listChatModelsIterator } from './list-chat-models.js';
|
| 5 |
|
| 6 |
+
import curatedList from './curated-model-list.json' assert { type: 'json' };
|
| 7 |
+
|
| 8 |
export function bootWorker() {
|
| 9 |
const modelCache = new ModelCache();
|
| 10 |
let selectedModel = modelCache.knownModels[0];
|
|
|
|
| 29 |
async function handleMessage({ data }) {
|
| 30 |
const { id } = data;
|
| 31 |
try {
|
| 32 |
+
if (data.type === 'listChatModels') {
|
|
|
|
|
|
|
| 33 |
// kick off the long-running listing/classification task
|
| 34 |
handleListChatModels(data).catch(err => {
|
| 35 |
self.postMessage({ id, type: 'error', error: String(err) });
|
|
|
|
| 74 |
|
| 75 |
// Implementation of the listChatModels worker action using the async-iterator action.
|
| 76 |
async function handleListChatModels({ id, params = {} }) {
|
| 77 |
+
|
| 78 |
+
self.postMessage({ id, type: 'response', result: { models: curatedList } });
|
| 79 |
+
return;
|
| 80 |
+
|
| 81 |
const iterator = listChatModelsIterator(params);
|
| 82 |
let sawDone = false;
|
| 83 |
// batching buffer
|
|
|
|
| 103 |
}
|
| 104 |
}
|
| 105 |
|
| 106 |
+
activeTasks.set(id, { abort: () => iterator.return() });
|
| 107 |
+
let lastBatchDelta;
|
| 108 |
try {
|
| 109 |
for await (const delta of iterator) {
|
| 110 |
+
try { enqueueProgress(delta); } catch (e) { }
|
| 111 |
+
if (delta.models) lastBatchDelta = delta;
|
| 112 |
if (delta && delta.status === 'done') {
|
| 113 |
sawDone = true;
|
|
|
|
|
|
|
|
|
|
| 114 |
}
|
| 115 |
}
|
| 116 |
|
| 117 |
+
// flush any remaining progress messages synchronously
|
| 118 |
+
flushBatch();
|
| 119 |
if (!sawDone) {
|
| 120 |
// iterator exited early (likely cancelled)
|
| 121 |
+
self.postMessage({ id, type: 'response', result: { cancelled: true } });
|
| 122 |
+
} else {
|
| 123 |
+
self.postMessage({ id, type: 'response', result: lastBatchDelta });
|
| 124 |
}
|
| 125 |
} catch (err) {
|
| 126 |
+
flushBatch();
|
| 127 |
+
self.postMessage({ id, type: 'error', error: String(err), code: err.code || null });
|
| 128 |
} finally {
|
| 129 |
activeTasks.delete(id);
|
| 130 |
}
|
src/worker/curated-model-list.json
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"id": "Xenova/llama2.c-stories15M",
|
| 4 |
+
"name": "Llama2.c Stories 15M",
|
| 5 |
+
"model_type": "llama",
|
| 6 |
+
"architectures": ["llama"],
|
| 7 |
+
"classification": "gen",
|
| 8 |
+
"confidence": "high",
|
| 9 |
+
"fetchStatus": "ok",
|
| 10 |
+
"hasTokenizer": true,
|
| 11 |
+
"hasOnnxModel": true,
|
| 12 |
+
"isTransformersJsReady": true,
|
| 13 |
+
"info": {
|
| 14 |
+
"display_name": "Llama2.c Stories 15M (Xenova)",
|
| 15 |
+
"params": "15M",
|
| 16 |
+
"params_count": 15000000,
|
| 17 |
+
"architecture": "LLaMA-family (tiny conversion for stories use via Xenova toolchain)",
|
| 18 |
+
"context_window": 2048,
|
| 19 |
+
"quantization": "likely float16/uint8/packed formats supported by Xenova runtime",
|
| 20 |
+
"hf_url": "https://huggingface.co/Xenova/llama2.c-stories15M",
|
| 21 |
+
"recommended_runtime": "transformers.js / Xenova runtime (wasm/webgpu)",
|
| 22 |
+
"is_mobile_capable": true,
|
| 23 |
+
"verified": false,
|
| 24 |
+
"assumed": true,
|
| 25 |
+
"notes": "Original curated metadata preserved; tokenizer/ONNX flags assumed for Xenova-converted tiny model."
|
| 26 |
+
}
|
| 27 |
+
},
|
| 28 |
+
{
|
| 29 |
+
"id": "Xenova/phi-3-mini-4k-instruct",
|
| 30 |
+
"name": "phi-3-mini-4k-instruct",
|
| 31 |
+
"model_type": "phi3",
|
| 32 |
+
"architectures": ["phi3"],
|
| 33 |
+
"classification": "gen",
|
| 34 |
+
"confidence": "high",
|
| 35 |
+
"fetchStatus": "ok",
|
| 36 |
+
"hasTokenizer": true,
|
| 37 |
+
"hasOnnxModel": true,
|
| 38 |
+
"isTransformersJsReady": true,
|
| 39 |
+
"info": {
|
| 40 |
+
"display_name": "Phi-3 Mini 4k Instruct (Xenova)",
|
| 41 |
+
"params": "mini (estimate)",
|
| 42 |
+
"params_count": null,
|
| 43 |
+
"architecture": "Phi family (Phi-3 mini conversion)",
|
| 44 |
+
"context_window": 4096,
|
| 45 |
+
"hf_url": "https://huggingface.co/Xenova/phi-3-mini-4k-instruct",
|
| 46 |
+
"recommended_runtime": "transformers.js / Xenova runtime (wasm/webgpu)",
|
| 47 |
+
"is_mobile_capable": true,
|
| 48 |
+
"verified": false,
|
| 49 |
+
"assumed": true,
|
| 50 |
+
"notes": "Parameter count and asset layout should be verified against HF API."
|
| 51 |
+
}
|
| 52 |
+
},
|
| 53 |
+
{
|
| 54 |
+
"id": "Xenova/all-MiniLM-L6-v2",
|
| 55 |
+
"name": "all-MiniLM-L6-v2",
|
| 56 |
+
"model_type": "sentence-transformers",
|
| 57 |
+
"architectures": ["MiniLM"],
|
| 58 |
+
"classification": "encoder",
|
| 59 |
+
"confidence": "high",
|
| 60 |
+
"fetchStatus": "ok",
|
| 61 |
+
"hasTokenizer": true,
|
| 62 |
+
"hasOnnxModel": true,
|
| 63 |
+
"isTransformersJsReady": true,
|
| 64 |
+
"info": {
|
| 65 |
+
"display_name": "all-MiniLM-L6-v2 (Xenova mirror)",
|
| 66 |
+
"params": "β22M",
|
| 67 |
+
"params_count": 22000000,
|
| 68 |
+
"architecture": "MiniLM (distilled transformer)",
|
| 69 |
+
"context_window": 512,
|
| 70 |
+
"hf_url": "https://huggingface.co/Xenova/all-MiniLM-L6-v2",
|
| 71 |
+
"recommended_runtime": "transformers.js (wasm)",
|
| 72 |
+
"is_mobile_capable": true,
|
| 73 |
+
"verified": false,
|
| 74 |
+
"assumed": true,
|
| 75 |
+
"notes": "Encoder-style model (worker prefilter normally excludes sentence-transformers from generation lists)."
|
| 76 |
+
}
|
| 77 |
+
},
|
| 78 |
+
{
|
| 79 |
+
"id": "Xenova/distilgpt2",
|
| 80 |
+
"name": "distilgpt2",
|
| 81 |
+
"model_type": "gpt2",
|
| 82 |
+
"architectures": ["gpt2"],
|
| 83 |
+
"classification": "gen",
|
| 84 |
+
"confidence": "high",
|
| 85 |
+
"fetchStatus": "ok",
|
| 86 |
+
"hasTokenizer": true,
|
| 87 |
+
"hasOnnxModel": true,
|
| 88 |
+
"isTransformersJsReady": true,
|
| 89 |
+
"info": {
|
| 90 |
+
"display_name": "DistilGPT-2 (Xenova mirror)",
|
| 91 |
+
"params": "β82M",
|
| 92 |
+
"params_count": 82000000,
|
| 93 |
+
"architecture": "GPT-2 distilled",
|
| 94 |
+
"context_window": 1024,
|
| 95 |
+
"hf_url": "https://huggingface.co/Xenova/distilgpt2",
|
| 96 |
+
"recommended_runtime": "transformers.js",
|
| 97 |
+
"is_mobile_capable": true,
|
| 98 |
+
"verified": false,
|
| 99 |
+
"assumed": true
|
| 100 |
+
}
|
| 101 |
+
},
|
| 102 |
+
{
|
| 103 |
+
"id": "Xenova/gpt2",
|
| 104 |
+
"name": "gpt2",
|
| 105 |
+
"model_type": "gpt2",
|
| 106 |
+
"architectures": ["gpt2"],
|
| 107 |
+
"classification": "gen",
|
| 108 |
+
"confidence": "high",
|
| 109 |
+
"fetchStatus": "ok",
|
| 110 |
+
"hasTokenizer": true,
|
| 111 |
+
"hasOnnxModel": true,
|
| 112 |
+
"isTransformersJsReady": true,
|
| 113 |
+
"info": {
|
| 114 |
+
"display_name": "GPT-2 (Xenova mirror)",
|
| 115 |
+
"params": "117M (base)",
|
| 116 |
+
"params_count": 117000000,
|
| 117 |
+
"architecture": "GPT-2",
|
| 118 |
+
"context_window": 1024,
|
| 119 |
+
"hf_url": "https://huggingface.co/Xenova/gpt2",
|
| 120 |
+
"recommended_runtime": "transformers.js",
|
| 121 |
+
"is_mobile_capable": true,
|
| 122 |
+
"verified": false,
|
| 123 |
+
"assumed": true
|
| 124 |
+
}
|
| 125 |
+
},
|
| 126 |
+
{
|
| 127 |
+
"id": "Xenova/qwen-2.5-small-instruct",
|
| 128 |
+
"name": "qwen-2.5-small-instruct",
|
| 129 |
+
"model_type": "qwen",
|
| 130 |
+
"architectures": ["qwen"],
|
| 131 |
+
"classification": "gen",
|
| 132 |
+
"confidence": "medium",
|
| 133 |
+
"fetchStatus": "ok",
|
| 134 |
+
"hasTokenizer": true,
|
| 135 |
+
"hasOnnxModel": false,
|
| 136 |
+
"isTransformersJsReady": false,
|
| 137 |
+
"info": {
|
| 138 |
+
"display_name": "Qwen-2.5 Small Instruct (Xenova mirror)",
|
| 139 |
+
"params": "β2.5B (estimate)",
|
| 140 |
+
"params_count": null,
|
| 141 |
+
"architecture": "Qwen family",
|
| 142 |
+
"context_window": 8192,
|
| 143 |
+
"hf_url": "https://huggingface.co/Xenova/qwen-2.5-small-instruct",
|
| 144 |
+
"recommended_runtime": "Xenova runtime / transformers.js (quantized)",
|
| 145 |
+
"is_mobile_capable": false,
|
| 146 |
+
"verified": false,
|
| 147 |
+
"assumed": true,
|
| 148 |
+
"notes": "Marked conservatively as not transformers.js-ready / no ONNX in HF assets."
|
| 149 |
+
}
|
| 150 |
+
}
|
| 151 |
+
]
|