webslm 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -6
- package/dist/cache/models.d.ts +27 -3
- package/dist/cache/models.js +108 -11
- package/dist/cache/node-fs.d.ts +26 -3
- package/dist/cache/node-fs.js +43 -9
- package/dist/cache-management.d.ts +1 -1
- package/dist/download.d.ts +9 -0
- package/dist/download.js +38 -8
- package/dist/engine.js +42 -12
- package/dist/hub.d.ts +22 -2
- package/dist/hub.js +53 -5
- package/dist/models.d.ts +8 -2
- package/dist/models.js +46 -12
- package/dist/protocol.d.ts +4 -0
- package/dist/simple.d.ts +2 -2
- package/dist/simple.js +2 -2
- package/dist/types.d.ts +18 -4
- package/native-manifest.json +29 -29
- package/package.json +1 -1
- package/wasm/relaxed/webslm_wasm.d.ts +6 -0
- package/wasm/relaxed/webslm_wasm.js +12 -6
- package/wasm/relaxed/webslm_wasm_bg.wasm +0 -0
- package/wasm/simd/webslm_wasm.d.ts +6 -0
- package/wasm/simd/webslm_wasm.js +12 -6
- package/wasm/simd/webslm_wasm_bg.wasm +0 -0
- package/wasm/threads/webslm_wasm.d.ts +6 -0
- package/wasm/threads/webslm_wasm.js +14 -8
- package/wasm/threads/webslm_wasm_bg.wasm +0 -0
package/dist/hub.d.ts
CHANGED
|
@@ -16,6 +16,19 @@ export declare const SUPPORTED_MODEL_TYPES: readonly string[];
|
|
|
16
16
|
export declare const CHECKPOINT_SIDE_FILES: readonly string[];
|
|
17
17
|
export declare const SAFETENSORS_INDEX = "model.safetensors.index.json";
|
|
18
18
|
export declare const SAFETENSORS_SINGLE = "model.safetensors";
|
|
19
|
+
/**
|
|
20
|
+
* GGUF architectures the engine runs (`general.architecture`), with the
|
|
21
|
+
* `model_type` each runs as.
|
|
22
|
+
*/
|
|
23
|
+
export declare const GGUF_ARCHITECTURES: Readonly<Record<string, string>>;
|
|
24
|
+
/** Whether `name` is a GGUF file. */
|
|
25
|
+
export declare function isGgufFile(name: string): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* The GGUF file a repository runs when none is named: Q8_0, else Q4_K_M,
|
|
28
|
+
* Q4_0, Q4_K_S, F16, BF16, else the first by name (split files and
|
|
29
|
+
* multimodal projectors left out). The engine's `pick_gguf`.
|
|
30
|
+
*/
|
|
31
|
+
export declare function pickGgufFile(names: readonly string[]): string | undefined;
|
|
19
32
|
/** Configuration of a PEFT LoRA adapter. */
|
|
20
33
|
export declare const ADAPTER_CONFIG = "adapter_config.json";
|
|
21
34
|
/** Weights of a PEFT LoRA adapter. */
|
|
@@ -76,10 +89,12 @@ export declare function fetchRevision(repo: string, revision: string, options?:
|
|
|
76
89
|
* Picks the files to download: the side files the repository has, plus the
|
|
77
90
|
* weights (the shards named by the index, `model.safetensors`, or every
|
|
78
91
|
* top-level `*.safetensors`). `index` is the parsed index when there is one.
|
|
92
|
+
* With `gguf`, or for a repository without safetensors weights, the weights
|
|
93
|
+
* are one GGUF file ({@link pickGgufFile}).
|
|
79
94
|
*/
|
|
80
95
|
export declare function selectCheckpointFiles(names: readonly string[], index?: {
|
|
81
96
|
weight_map?: Record<string, string>;
|
|
82
|
-
}): {
|
|
97
|
+
}, gguf?: string): {
|
|
83
98
|
side: string[];
|
|
84
99
|
weights: string[];
|
|
85
100
|
index?: string;
|
|
@@ -102,8 +117,13 @@ export interface HubModel {
|
|
|
102
117
|
};
|
|
103
118
|
/** Whether a token with accepted terms is needed to download it. */
|
|
104
119
|
readonly gated: false | "auto" | "manual";
|
|
105
|
-
/**
|
|
120
|
+
/**
|
|
121
|
+
* Whether webslm can run it (architecture supported, safetensors weights
|
|
122
|
+
* or GGUF files, under `maxParams`).
|
|
123
|
+
*/
|
|
106
124
|
readonly supported: boolean;
|
|
125
|
+
/** Whether it runs from its GGUF files (their architecture is supported). */
|
|
126
|
+
readonly gguf?: boolean;
|
|
107
127
|
/** Why it is not supported. */
|
|
108
128
|
readonly reason?: string;
|
|
109
129
|
readonly downloads?: number;
|
package/dist/hub.js
CHANGED
|
@@ -33,6 +33,39 @@ export const CHECKPOINT_SIDE_FILES = [
|
|
|
33
33
|
];
|
|
34
34
|
export const SAFETENSORS_INDEX = "model.safetensors.index.json";
|
|
35
35
|
export const SAFETENSORS_SINGLE = "model.safetensors";
|
|
36
|
+
/**
|
|
37
|
+
* GGUF architectures the engine runs (`general.architecture`), with the
|
|
38
|
+
* `model_type` each runs as.
|
|
39
|
+
*/
|
|
40
|
+
export const GGUF_ARCHITECTURES = {
|
|
41
|
+
llama: "llama",
|
|
42
|
+
qwen2: "qwen2",
|
|
43
|
+
qwen3: "qwen3",
|
|
44
|
+
lfm2: "lfm2",
|
|
45
|
+
};
|
|
46
|
+
/** Whether `name` is a GGUF file. */
|
|
47
|
+
export function isGgufFile(name) {
|
|
48
|
+
return name.toLowerCase().endsWith(".gguf");
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The GGUF file a repository runs when none is named: Q8_0, else Q4_K_M,
|
|
52
|
+
* Q4_0, Q4_K_S, F16, BF16, else the first by name (split files and
|
|
53
|
+
* multimodal projectors left out). The engine's `pick_gguf`.
|
|
54
|
+
*/
|
|
55
|
+
export function pickGgufFile(names) {
|
|
56
|
+
const candidates = names
|
|
57
|
+
.filter((n) => {
|
|
58
|
+
const lower = n.toLowerCase();
|
|
59
|
+
return isGgufFile(n) && !n.includes("/") && !lower.includes("mmproj") && !lower.includes("-of-0");
|
|
60
|
+
})
|
|
61
|
+
.sort();
|
|
62
|
+
for (const preferred of ["q8_0", "q4_k_m", "q4_0", "q4_k_s", "f16", "bf16"]) {
|
|
63
|
+
const found = candidates.find((n) => n.toLowerCase().includes(preferred));
|
|
64
|
+
if (found !== undefined)
|
|
65
|
+
return found;
|
|
66
|
+
}
|
|
67
|
+
return candidates[0];
|
|
68
|
+
}
|
|
36
69
|
/** Configuration of a PEFT LoRA adapter. */
|
|
37
70
|
export const ADAPTER_CONFIG = "adapter_config.json";
|
|
38
71
|
/** Weights of a PEFT LoRA adapter. */
|
|
@@ -156,13 +189,19 @@ function parseGated(value) {
|
|
|
156
189
|
* Picks the files to download: the side files the repository has, plus the
|
|
157
190
|
* weights (the shards named by the index, `model.safetensors`, or every
|
|
158
191
|
* top-level `*.safetensors`). `index` is the parsed index when there is one.
|
|
192
|
+
* With `gguf`, or for a repository without safetensors weights, the weights
|
|
193
|
+
* are one GGUF file ({@link pickGgufFile}).
|
|
159
194
|
*/
|
|
160
|
-
export function selectCheckpointFiles(names, index) {
|
|
195
|
+
export function selectCheckpointFiles(names, index, gguf) {
|
|
161
196
|
// A LoRA adapter needs only its two files.
|
|
162
197
|
if (isAdapterListing(names))
|
|
163
198
|
return { side: [ADAPTER_CONFIG], weights: [ADAPTER_WEIGHTS] };
|
|
164
199
|
const present = new Set(names);
|
|
165
200
|
const side = CHECKPOINT_SIDE_FILES.filter((f) => present.has(f));
|
|
201
|
+
const hasSafetensors = present.has(SAFETENSORS_INDEX) || names.some((n) => !n.includes("/") && n.endsWith(".safetensors"));
|
|
202
|
+
const ggufFile = gguf ?? (hasSafetensors ? undefined : pickGgufFile(names));
|
|
203
|
+
if (ggufFile !== undefined)
|
|
204
|
+
return { side, weights: present.has(ggufFile) ? [ggufFile] : [] };
|
|
166
205
|
if (present.has(SAFETENSORS_INDEX) && index !== undefined) {
|
|
167
206
|
const weights = [...new Set(Object.values(index.weight_map ?? {}))].sort();
|
|
168
207
|
return { side, weights, index: SAFETENSORS_INDEX };
|
|
@@ -258,7 +297,7 @@ export async function searchModels(query, options = {}) {
|
|
|
258
297
|
const maxParams = options.maxParams ?? 2e9;
|
|
259
298
|
const limit = Math.max(1, Math.min(options.limit ?? 20, 100));
|
|
260
299
|
const params = new URLSearchParams({ search: query.trim(), sort: "downloads", limit: String(limit) });
|
|
261
|
-
for (const field of ["safetensors", "config", "gated", "downloads", "pipeline_tag", "library_name", "tags"]) {
|
|
300
|
+
for (const field of ["safetensors", "gguf", "config", "gated", "downloads", "pipeline_tag", "library_name", "tags"]) {
|
|
262
301
|
params.append("expand[]", field);
|
|
263
302
|
}
|
|
264
303
|
const url = `${hubBase(options.hubUrl)}/api/models?${params.toString()}`;
|
|
@@ -285,17 +324,22 @@ function toHubModel(entry, maxParams) {
|
|
|
285
324
|
byDtype[dtype] = count;
|
|
286
325
|
}
|
|
287
326
|
const total = entry.safetensors?.total;
|
|
288
|
-
const
|
|
327
|
+
const ggufArchitecture = typeof entry.gguf?.architecture === "string" ? entry.gguf.architecture : undefined;
|
|
328
|
+
const ggufType = ggufArchitecture === undefined ? undefined : GGUF_ARCHITECTURES[ggufArchitecture];
|
|
329
|
+
const ggufTotal = entry.gguf?.total;
|
|
330
|
+
const params = typeof total === "number" ? total : typeof ggufTotal === "number" && ggufType !== undefined ? ggufTotal : undefined;
|
|
289
331
|
const embedding = isEmbeddingModel({
|
|
290
332
|
repo: entry.id,
|
|
291
333
|
pipelineTag: typeof entry.pipeline_tag === "string" ? entry.pipeline_tag : undefined,
|
|
292
334
|
libraryName: typeof entry.library_name === "string" ? entry.library_name : undefined,
|
|
293
335
|
tags: Array.isArray(entry.tags) ? entry.tags.filter((t) => typeof t === "string") : undefined,
|
|
294
336
|
});
|
|
295
|
-
|
|
337
|
+
// GGUF files of a supported architecture run whatever else the repository holds.
|
|
338
|
+
const gguf = ggufType !== undefined && SUPPORTED_MODEL_TYPES.includes(ggufType);
|
|
339
|
+
let reason = embedding ? EMBEDDING_REASON : gguf ? undefined : unsupportedReason(modelType);
|
|
296
340
|
if (reason === undefined && params === undefined)
|
|
297
341
|
reason = "no safetensors weights";
|
|
298
|
-
if (reason === undefined)
|
|
342
|
+
if (reason === undefined && !gguf)
|
|
299
343
|
reason = packedWeightsReason(byDtype);
|
|
300
344
|
if (reason === undefined && params !== undefined && params > maxParams) {
|
|
301
345
|
reason = `${formatParams(params)} parameters exceed the ${formatParams(maxParams)} limit`;
|
|
@@ -307,6 +351,10 @@ function toHubModel(entry, maxParams) {
|
|
|
307
351
|
};
|
|
308
352
|
if (modelType !== undefined)
|
|
309
353
|
model.modelType = modelType;
|
|
354
|
+
else if (gguf)
|
|
355
|
+
model.modelType = ggufType;
|
|
356
|
+
if (gguf)
|
|
357
|
+
model.gguf = true;
|
|
310
358
|
if (architectures !== undefined)
|
|
311
359
|
model.architectures = architectures;
|
|
312
360
|
if (params !== undefined) {
|
package/dist/models.d.ts
CHANGED
|
@@ -48,15 +48,20 @@ export type NormalizedSource = {
|
|
|
48
48
|
readonly repo: string;
|
|
49
49
|
readonly revision?: string;
|
|
50
50
|
readonly hubUrl?: string;
|
|
51
|
+
readonly file?: string;
|
|
51
52
|
} | {
|
|
52
53
|
readonly kind: "files";
|
|
53
54
|
readonly files: NonNullable<Extract<ModelSource, {
|
|
54
55
|
files: unknown;
|
|
55
56
|
}>["files"]>;
|
|
57
|
+
readonly file?: string;
|
|
56
58
|
} | {
|
|
57
59
|
readonly kind: "fetch";
|
|
58
60
|
readonly fetch: FetchFile;
|
|
61
|
+
readonly file?: string;
|
|
59
62
|
};
|
|
63
|
+
/** Whether a normalized source loads a GGUF file (named, or the only weights of `files`). */
|
|
64
|
+
export declare function isGgufSource(source: NormalizedSource): boolean;
|
|
60
65
|
/** Checks a source and turns a repository id string into a hub source. */
|
|
61
66
|
export declare function normalizeSource(source: string | ModelSource, revision?: string): NormalizedSource;
|
|
62
67
|
/**
|
|
@@ -74,8 +79,9 @@ export declare function normalizeAdapterSource(source: AdapterSource, revision?:
|
|
|
74
79
|
* for await (const delta of model.chat([{ role: "user", content: "Hi!" }])) console.log(delta);
|
|
75
80
|
* ```
|
|
76
81
|
*
|
|
77
|
-
* Hub checkpoints are downloaded once into the cache (OPFS in browsers,
|
|
78
|
-
*
|
|
82
|
+
* Hub checkpoints are downloaded once into the cache (OPFS in browsers, the
|
|
83
|
+
* command-line tool's cache directory in Node) and read from it afterwards,
|
|
84
|
+
* without network.
|
|
79
85
|
*/
|
|
80
86
|
export declare function loadModel(source: string | ModelSource, options?: LoadModelOptions): Promise<Model>;
|
|
81
87
|
/**
|
package/dist/models.js
CHANGED
|
@@ -4,7 +4,7 @@ import { EngineClient } from "./client.js";
|
|
|
4
4
|
import { recommendedSampling } from "./curated.js";
|
|
5
5
|
import { WebslmError, abortError, isAborted, toWebslmError } from "./errors.js";
|
|
6
6
|
import { autoQuant, getBrowserResources, readCheckpointShapes } from "./fit.js";
|
|
7
|
-
import { checkModel } from "./hub.js";
|
|
7
|
+
import { checkModel, isGgufFile } from "./hub.js";
|
|
8
8
|
import { isNode } from "./runtime.js";
|
|
9
9
|
const QUANTS = ["q8", "q4", "f32"];
|
|
10
10
|
const ADAPTER_MODES = ["unmerged", "merged"];
|
|
@@ -77,6 +77,24 @@ export function resolveBackend(backend, env = globalThis.process?.env) {
|
|
|
77
77
|
}
|
|
78
78
|
return value;
|
|
79
79
|
}
|
|
80
|
+
/** Checks the `file` of a source: a GGUF file name. */
|
|
81
|
+
function checkGgufName(file) {
|
|
82
|
+
if (file === undefined)
|
|
83
|
+
return undefined;
|
|
84
|
+
if (typeof file !== "string" || !isGgufFile(file.trim())) {
|
|
85
|
+
throw new WebslmError("INVALID_ARGUMENT", "`file` must name a .gguf file");
|
|
86
|
+
}
|
|
87
|
+
return file.trim();
|
|
88
|
+
}
|
|
89
|
+
/** Whether a normalized source loads a GGUF file (named, or the only weights of `files`). */
|
|
90
|
+
export function isGgufSource(source) {
|
|
91
|
+
if (source.file !== undefined)
|
|
92
|
+
return true;
|
|
93
|
+
if (source.kind !== "files")
|
|
94
|
+
return false;
|
|
95
|
+
const names = Object.keys(source.files);
|
|
96
|
+
return names.some(isGgufFile) && !names.some((n) => n.endsWith(".safetensors"));
|
|
97
|
+
}
|
|
80
98
|
/** Checks a source and turns a repository id string into a hub source. */
|
|
81
99
|
export function normalizeSource(source, revision) {
|
|
82
100
|
if (typeof source === "string") {
|
|
@@ -92,6 +110,8 @@ export function normalizeSource(source, revision) {
|
|
|
92
110
|
if (keys.length !== 1) {
|
|
93
111
|
throw new WebslmError("INVALID_ARGUMENT", "a model source must have exactly one of `hub`, `files` or `fetch`");
|
|
94
112
|
}
|
|
113
|
+
const file = checkGgufName(source.file);
|
|
114
|
+
const withFile = file === undefined ? {} : { file };
|
|
95
115
|
if ("hub" in source) {
|
|
96
116
|
if (typeof source.hub !== "string" || source.hub.trim() === "") {
|
|
97
117
|
throw new WebslmError("INVALID_ARGUMENT", "`hub` must be a repository id");
|
|
@@ -102,6 +122,7 @@ export function normalizeSource(source, revision) {
|
|
|
102
122
|
repo: source.hub.trim(),
|
|
103
123
|
...(rev === undefined ? {} : { revision: rev }),
|
|
104
124
|
...(source.hubUrl === undefined ? {} : { hubUrl: source.hubUrl }),
|
|
125
|
+
...withFile,
|
|
105
126
|
};
|
|
106
127
|
}
|
|
107
128
|
if ("files" in source) {
|
|
@@ -114,15 +135,19 @@ export function normalizeSource(source, revision) {
|
|
|
114
135
|
throw new WebslmError("INVALID_ARGUMENT", `file "${name}" must be a Blob, an ArrayBuffer or a Uint8Array`);
|
|
115
136
|
}
|
|
116
137
|
}
|
|
117
|
-
if (!(
|
|
118
|
-
throw new WebslmError("INVALID_ARGUMENT",
|
|
138
|
+
if (file !== undefined && !(file in files)) {
|
|
139
|
+
throw new WebslmError("INVALID_ARGUMENT", `\`files\` has no "${file}"`);
|
|
119
140
|
}
|
|
120
|
-
|
|
141
|
+
// A GGUF file carries its configuration.
|
|
142
|
+
if (!("config.json" in files) && !Object.keys(files).some(isGgufFile)) {
|
|
143
|
+
throw new WebslmError("INVALID_ARGUMENT", "`files` must include config.json or a .gguf file");
|
|
144
|
+
}
|
|
145
|
+
return { kind: "files", files, ...withFile };
|
|
121
146
|
}
|
|
122
147
|
if (typeof source.fetch !== "function") {
|
|
123
148
|
throw new WebslmError("INVALID_ARGUMENT", "`fetch` must be a function");
|
|
124
149
|
}
|
|
125
|
-
return { kind: "fetch", fetch: source.fetch };
|
|
150
|
+
return { kind: "fetch", fetch: source.fetch, ...withFile };
|
|
126
151
|
}
|
|
127
152
|
/**
|
|
128
153
|
* Checks a LoRA adapter source: like {@link normalizeSource}, but `files`
|
|
@@ -154,11 +179,12 @@ function toWire(normalized, token) {
|
|
|
154
179
|
...(normalized.revision === undefined ? {} : { revision: normalized.revision }),
|
|
155
180
|
...(normalized.hubUrl === undefined ? {} : { hubUrl: normalized.hubUrl }),
|
|
156
181
|
...(token === undefined ? {} : { token }),
|
|
182
|
+
...(normalized.file === undefined ? {} : { file: normalized.file }),
|
|
157
183
|
};
|
|
158
184
|
case "files":
|
|
159
|
-
return { kind: "files", files: normalized.files };
|
|
185
|
+
return { kind: "files", files: normalized.files, ...(normalized.file === undefined ? {} : { file: normalized.file }) };
|
|
160
186
|
case "fetch":
|
|
161
|
-
return { kind: "fetch" };
|
|
187
|
+
return { kind: "fetch", ...(normalized.file === undefined ? {} : { file: normalized.file }) };
|
|
162
188
|
}
|
|
163
189
|
}
|
|
164
190
|
function checkScale(scale) {
|
|
@@ -186,17 +212,20 @@ function requestPersistentStorage() {
|
|
|
186
212
|
* for await (const delta of model.chat([{ role: "user", content: "Hi!" }])) console.log(delta);
|
|
187
213
|
* ```
|
|
188
214
|
*
|
|
189
|
-
* Hub checkpoints are downloaded once into the cache (OPFS in browsers,
|
|
190
|
-
*
|
|
215
|
+
* Hub checkpoints are downloaded once into the cache (OPFS in browsers, the
|
|
216
|
+
* command-line tool's cache directory in Node) and read from it afterwards,
|
|
217
|
+
* without network.
|
|
191
218
|
*/
|
|
192
219
|
export async function loadModel(source, options = {}) {
|
|
193
220
|
const device = resolveDevice(options.device);
|
|
194
221
|
const backend = resolveBackend(options.backend);
|
|
195
|
-
const
|
|
222
|
+
const normalized = normalizeSource(source, options.revision);
|
|
223
|
+
// A GGUF file loads in its own format unless told otherwise.
|
|
224
|
+
const gguf = isGgufSource(normalized);
|
|
225
|
+
const requested = options.quant ?? (gguf ? "auto" : "q8");
|
|
196
226
|
if (requested !== "auto" && !QUANTS.includes(requested)) {
|
|
197
227
|
throw new WebslmError("INVALID_ARGUMENT", `quant must be one of ${QUANTS.join(", ")} or auto`);
|
|
198
228
|
}
|
|
199
|
-
const normalized = normalizeSource(source, options.revision);
|
|
200
229
|
const adapter = options.adapter === undefined ? undefined : normalizeAdapterSource(options.adapter);
|
|
201
230
|
checkScale(options.adapterScale);
|
|
202
231
|
if (options.adapterMode !== undefined && !ADAPTER_MODES.includes(options.adapterMode)) {
|
|
@@ -206,7 +235,12 @@ export async function loadModel(source, options = {}) {
|
|
|
206
235
|
throw abortError(options.signal);
|
|
207
236
|
if (normalized.kind === "hub" && !isNode())
|
|
208
237
|
requestPersistentStorage();
|
|
209
|
-
|
|
238
|
+
// `auto` on a GGUF file: the engine keeps the file's own format.
|
|
239
|
+
const { quant, note: quantNote } = requested !== "auto"
|
|
240
|
+
? { quant: requested, note: undefined }
|
|
241
|
+
: gguf
|
|
242
|
+
? { quant: "auto", note: undefined }
|
|
243
|
+
: await resolveAutoQuant(normalized, options);
|
|
210
244
|
const shared = options.engine;
|
|
211
245
|
if (shared !== undefined && !(shared instanceof EngineHandle)) {
|
|
212
246
|
throw new WebslmError("INVALID_ARGUMENT", "`engine` must come from createEngine()");
|
package/dist/protocol.d.ts
CHANGED
|
@@ -15,13 +15,17 @@ export type WireSource = {
|
|
|
15
15
|
readonly revision?: string;
|
|
16
16
|
readonly hubUrl?: string;
|
|
17
17
|
readonly token?: string;
|
|
18
|
+
/** A GGUF file of the repository. */
|
|
19
|
+
readonly file?: string;
|
|
18
20
|
} | {
|
|
19
21
|
readonly kind: "files";
|
|
20
22
|
readonly files: Readonly<Record<string, FileData>>;
|
|
23
|
+
readonly file?: string;
|
|
21
24
|
}
|
|
22
25
|
/** Reads are forwarded to the page with `read` messages. */
|
|
23
26
|
| {
|
|
24
27
|
readonly kind: "fetch";
|
|
28
|
+
readonly file?: string;
|
|
25
29
|
};
|
|
26
30
|
export interface WireLoadOptions {
|
|
27
31
|
readonly quant: string;
|
package/dist/simple.d.ts
CHANGED
|
@@ -265,8 +265,8 @@ export declare function probeTemplateTraits(model: Pick<Model, "info" | "renderC
|
|
|
265
265
|
* offline cache).
|
|
266
266
|
*
|
|
267
267
|
* The first load downloads the checkpoint from the Hugging Face Hub into the
|
|
268
|
-
* cache (OPFS in browsers,
|
|
269
|
-
* from there without network.
|
|
268
|
+
* cache (OPFS in browsers, the command-line tool's cache directory in Node);
|
|
269
|
+
* later loads read it from there without network.
|
|
270
270
|
*
|
|
271
271
|
* ```ts
|
|
272
272
|
* import { load } from "webslm";
|
package/dist/simple.js
CHANGED
|
@@ -493,8 +493,8 @@ class ChatImpl {
|
|
|
493
493
|
* offline cache).
|
|
494
494
|
*
|
|
495
495
|
* The first load downloads the checkpoint from the Hugging Face Hub into the
|
|
496
|
-
* cache (OPFS in browsers,
|
|
497
|
-
* from there without network.
|
|
496
|
+
* cache (OPFS in browsers, the command-line tool's cache directory in Node);
|
|
497
|
+
* later loads read it from there without network.
|
|
498
498
|
*
|
|
499
499
|
* ```ts
|
|
500
500
|
* import { load } from "webslm";
|
package/dist/types.d.ts
CHANGED
|
@@ -52,21 +52,33 @@ export type FileData = Blob | ArrayBuffer | Uint8Array;
|
|
|
52
52
|
* optional files such as `generation_config.json` are probed this way.
|
|
53
53
|
*/
|
|
54
54
|
export type FetchFile = (path: string, range?: readonly [number, number]) => Promise<ArrayBuffer | Uint8Array | null | undefined>;
|
|
55
|
-
/**
|
|
55
|
+
/**
|
|
56
|
+
* Where a checkpoint comes from. A plain string is a Hugging Face repository id.
|
|
57
|
+
*
|
|
58
|
+
* `file` names a GGUF file of the source to load instead of safetensors
|
|
59
|
+
* weights (e.g. `"SmolLM2-135M-Instruct-Q8_0.gguf"`): its metadata gives
|
|
60
|
+
* the configuration, the tokenizer (unless a `tokenizer.json` sits next to
|
|
61
|
+
* it) and the chat template. A hub repository or a `files` source holding
|
|
62
|
+
* GGUF files and no safetensors loads its preferred GGUF file (Q8_0, else
|
|
63
|
+
* Q4_K_M, Q4_0...) without it; a `fetch` source needs it.
|
|
64
|
+
*/
|
|
56
65
|
export type ModelSource =
|
|
57
66
|
/** A Hugging Face repository, downloaded once into the local cache. */
|
|
58
67
|
{
|
|
59
68
|
readonly hub: string;
|
|
60
69
|
readonly revision?: string;
|
|
61
70
|
readonly hubUrl?: string;
|
|
71
|
+
readonly file?: string;
|
|
62
72
|
}
|
|
63
|
-
/** Files by name: `"config.json"`, `"tokenizer.json"`, `"model.safetensors"`... */
|
|
73
|
+
/** Files by name: `"config.json"`, `"tokenizer.json"`, `"model.safetensors"`, `"model.gguf"`... */
|
|
64
74
|
| {
|
|
65
75
|
readonly files: Readonly<Record<string, FileData>>;
|
|
76
|
+
readonly file?: string;
|
|
66
77
|
}
|
|
67
78
|
/** A custom store. */
|
|
68
79
|
| {
|
|
69
80
|
readonly fetch: FetchFile;
|
|
81
|
+
readonly file?: string;
|
|
70
82
|
};
|
|
71
83
|
/**
|
|
72
84
|
* A PEFT LoRA adapter: a Hugging Face repository id (a string or
|
|
@@ -192,8 +204,10 @@ export interface LoadModelOptions {
|
|
|
192
204
|
*/
|
|
193
205
|
readonly engine?: EngineHandle;
|
|
194
206
|
/**
|
|
195
|
-
* Where the cache lives in Node (default `WEBSLM_CACHE_DIR
|
|
196
|
-
*
|
|
207
|
+
* Where the cache lives in Node (default `WEBSLM_CACHE_DIR`, else the
|
|
208
|
+
* command-line tool's cache directory: `~/Library/Caches/webslm` on macOS,
|
|
209
|
+
* `%LOCALAPPDATA%\webslm\cache` on Windows, `$XDG_CACHE_HOME/webslm` or
|
|
210
|
+
* `~/.cache/webslm` on Linux). Ignored in browsers, which use OPFS.
|
|
197
211
|
*/
|
|
198
212
|
readonly cacheDir?: string;
|
|
199
213
|
/**
|
package/native-manifest.json
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
2
|
+
"version": "0.5.0",
|
|
3
3
|
"assets": {
|
|
4
4
|
"darwin-arm64": {
|
|
5
|
-
"file": "webslm-node-0.
|
|
6
|
-
"size":
|
|
7
|
-
"sha256": "
|
|
8
|
-
"nodeSha256": "
|
|
5
|
+
"file": "webslm-node-0.5.0-darwin-arm64.node.gz",
|
|
6
|
+
"size": 4661767,
|
|
7
|
+
"sha256": "9cfcbd6e93f0e65a504ab5208d028a373de6bfba4b424f2a42484f9d44b2aba6",
|
|
8
|
+
"nodeSha256": "e9c942c1a20be8db41ae24264d8ce55c5cc32fa943f6199328ec402e87ef139d"
|
|
9
9
|
},
|
|
10
10
|
"darwin-x64": {
|
|
11
|
-
"file": "webslm-node-0.
|
|
12
|
-
"size":
|
|
13
|
-
"sha256": "
|
|
14
|
-
"nodeSha256": "
|
|
11
|
+
"file": "webslm-node-0.5.0-darwin-x64.node.gz",
|
|
12
|
+
"size": 4934785,
|
|
13
|
+
"sha256": "461f6b93b95a07548eee2034c8db8cd2afc08c4f00b0726ad7cad840419294fa",
|
|
14
|
+
"nodeSha256": "aebea474ee71dd98827bbc5ca0b91f7dc30e25039f708fa10d8c1c7eff020190"
|
|
15
15
|
},
|
|
16
16
|
"linux-x64-gnu": {
|
|
17
|
-
"file": "webslm-node-0.
|
|
18
|
-
"size":
|
|
19
|
-
"sha256": "
|
|
20
|
-
"nodeSha256": "
|
|
17
|
+
"file": "webslm-node-0.5.0-linux-x64-gnu.node.gz",
|
|
18
|
+
"size": 4956357,
|
|
19
|
+
"sha256": "c124223f558869a8d1c79a03c5b05de9e6f01ab2edb5805717e91dc0d9ee2a33",
|
|
20
|
+
"nodeSha256": "b1c284b96462edb134077334f4d955b00f580ec7955d12c7df963f6789230bb1"
|
|
21
21
|
},
|
|
22
22
|
"linux-arm64-gnu": {
|
|
23
|
-
"file": "webslm-node-0.
|
|
24
|
-
"size":
|
|
25
|
-
"sha256": "
|
|
26
|
-
"nodeSha256": "
|
|
23
|
+
"file": "webslm-node-0.5.0-linux-arm64-gnu.node.gz",
|
|
24
|
+
"size": 4662654,
|
|
25
|
+
"sha256": "7d522027d215352920ad106c766247eddf6eeb50eec8d6bd087d5432cbab251b",
|
|
26
|
+
"nodeSha256": "3f752b007f4093338c0d698d9624db936c2b4afc5e0bc02d5e52e987c6a5e3e7"
|
|
27
27
|
},
|
|
28
28
|
"linux-x64-musl": {
|
|
29
|
-
"file": "webslm-node-0.
|
|
30
|
-
"size":
|
|
31
|
-
"sha256": "
|
|
32
|
-
"nodeSha256": "
|
|
29
|
+
"file": "webslm-node-0.5.0-linux-x64-musl.node.gz",
|
|
30
|
+
"size": 5333007,
|
|
31
|
+
"sha256": "64e8f7d82eb9b2d34046fa7d712d9b5316eea23b0da33b488be4352fcf8836c1",
|
|
32
|
+
"nodeSha256": "f46def8367a6a33ae72f4d6abde7edabe8a5a82bad049dabfaed467f5f629e05"
|
|
33
33
|
},
|
|
34
34
|
"linux-arm64-musl": {
|
|
35
|
-
"file": "webslm-node-0.
|
|
36
|
-
"size":
|
|
37
|
-
"sha256": "
|
|
38
|
-
"nodeSha256": "
|
|
35
|
+
"file": "webslm-node-0.5.0-linux-arm64-musl.node.gz",
|
|
36
|
+
"size": 5145035,
|
|
37
|
+
"sha256": "b2c712242f50e6a21347237a07a91e342edde0abe357fd57389399d907d32a45",
|
|
38
|
+
"nodeSha256": "561c9368986c7182e36148aadb44fa20d385828c4c106d95774a8ed188a3739b"
|
|
39
39
|
},
|
|
40
40
|
"win32-x64-msvc": {
|
|
41
|
-
"file": "webslm-node-0.
|
|
42
|
-
"size":
|
|
43
|
-
"sha256": "
|
|
44
|
-
"nodeSha256": "
|
|
41
|
+
"file": "webslm-node-0.5.0-win32-x64-msvc.node.gz",
|
|
42
|
+
"size": 5400333,
|
|
43
|
+
"sha256": "28476b37c7d7828dd539fdfc711bbe04fb7fde8a0fa1e732496df62fbce438cd",
|
|
44
|
+
"nodeSha256": "7d353430123a74894748cd8189a9920a5537d9beec36fe625d56e0aaf10910db"
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webslm",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Run small language models in the browser and in Node, straight from their original Hugging Face checkpoints: a Rust engine compiled to WebAssembly, in a worker, with an offline cache.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Maxime Golfier",
|
|
@@ -112,6 +112,12 @@ export class WasmModel {
|
|
|
112
112
|
* weights: a valid stored file serves them instead of converting the
|
|
113
113
|
* checkpoint, else they are written to it as they are converted;
|
|
114
114
|
* `info().weightCache` says which (see [`WeightCacheOutcome`]).
|
|
115
|
+
*
|
|
116
|
+
* `ggufFile` loads that GGUF file of the source (a source listing
|
|
117
|
+
* GGUF files and no safetensors loads its preferred one). Without
|
|
118
|
+
* `format`, a pre-quantized checkpoint (a `Q8_0` GGUF file, a
|
|
119
|
+
* `webslm export` checkpoint) loads in its own format, its blocks
|
|
120
|
+
* unchanged; weights already in the load format skip `weightCache`.
|
|
115
121
|
*/
|
|
116
122
|
static load(source: JsSource, options_json: string, lora?: JsSource | null, weight_cache?: JsWeightCache | null): Promise<WasmModel>;
|
|
117
123
|
/**
|
|
@@ -263,6 +263,12 @@ export class WasmModel {
|
|
|
263
263
|
* weights: a valid stored file serves them instead of converting the
|
|
264
264
|
* checkpoint, else they are written to it as they are converted;
|
|
265
265
|
* `info().weightCache` says which (see [`WeightCacheOutcome`]).
|
|
266
|
+
*
|
|
267
|
+
* `ggufFile` loads that GGUF file of the source (a source listing
|
|
268
|
+
* GGUF files and no safetensors loads its preferred one). Without
|
|
269
|
+
* `format`, a pre-quantized checkpoint (a `Q8_0` GGUF file, a
|
|
270
|
+
* `webslm export` checkpoint) loads in its own format, its blocks
|
|
271
|
+
* unchanged; weights already in the load format skip `weightCache`.
|
|
266
272
|
* @param {JsSource} source
|
|
267
273
|
* @param {string} options_json
|
|
268
274
|
* @param {JsSource | null} [lora]
|
|
@@ -1424,32 +1430,32 @@ function __wbg_get_imports() {
|
|
|
1424
1430
|
arg0.writeBuffer(arg1, arg2, getArrayU8FromWasm0(arg3, arg4), arg5, arg6);
|
|
1425
1431
|
}, arguments); },
|
|
1426
1432
|
__wbindgen_generic_0000000000000001: function(arg0, arg1) {
|
|
1427
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
1433
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 315, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
1428
1434
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_8cf186fa7724d16d___convert__closures_____invoke___wasm_bindgen_8cf186fa7724d16d___JsValue__core_608f92abc48d28da___result__Result_____wasm_bindgen_8cf186fa7724d16d___JsError___true_);
|
|
1429
1435
|
return ret;
|
|
1430
1436
|
},
|
|
1431
1437
|
__wbindgen_generic_0000000000000002: function(arg0, arg1) {
|
|
1432
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDevice")], shim_idx:
|
|
1438
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDevice")], shim_idx: 248, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
1433
1439
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_8cf186fa7724d16d___convert__closures_____invoke___wasm_bindgen_8cf186fa7724d16d___sys__JsNullable_wgpu_54917290532eaf6b___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_8cf186fa7724d16d___JsError___true_);
|
|
1434
1440
|
return ret;
|
|
1435
1441
|
},
|
|
1436
1442
|
__wbindgen_generic_0000000000000003: function(arg0, arg1) {
|
|
1437
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDeviceLostInfo")], shim_idx:
|
|
1443
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDeviceLostInfo")], shim_idx: 252, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1438
1444
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_8cf186fa7724d16d___convert__closures_____invoke___wgpu_54917290532eaf6b___backend__webgpu__webgpu_sys__gen_GpuDeviceLostInfo__GpuDeviceLostInfo______true_);
|
|
1439
1445
|
return ret;
|
|
1440
1446
|
},
|
|
1441
1447
|
__wbindgen_generic_0000000000000004: function(arg0, arg1) {
|
|
1442
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUUncapturedErrorEvent")], shim_idx:
|
|
1448
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUUncapturedErrorEvent")], shim_idx: 252, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1443
1449
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_8cf186fa7724d16d___convert__closures_____invoke___wgpu_54917290532eaf6b___backend__webgpu__webgpu_sys__gen_GpuDeviceLostInfo__GpuDeviceLostInfo______true__37);
|
|
1444
1450
|
return ret;
|
|
1445
1451
|
},
|
|
1446
1452
|
__wbindgen_generic_0000000000000005: function(arg0, arg1) {
|
|
1447
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("any")], shim_idx:
|
|
1453
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("any")], shim_idx: 248, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
1448
1454
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_8cf186fa7724d16d___convert__closures_____invoke___wasm_bindgen_8cf186fa7724d16d___sys__JsNullable_wgpu_54917290532eaf6b___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_8cf186fa7724d16d___JsError___true__38);
|
|
1449
1455
|
return ret;
|
|
1450
1456
|
},
|
|
1451
1457
|
__wbindgen_generic_0000000000000006: function(arg0, arg1) {
|
|
1452
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("undefined")], shim_idx:
|
|
1458
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("undefined")], shim_idx: 248, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
1453
1459
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_8cf186fa7724d16d___convert__closures_____invoke___wasm_bindgen_8cf186fa7724d16d___sys__JsNullable_wgpu_54917290532eaf6b___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_8cf186fa7724d16d___JsError___true__39);
|
|
1454
1460
|
return ret;
|
|
1455
1461
|
},
|
|
Binary file
|
|
@@ -112,6 +112,12 @@ export class WasmModel {
|
|
|
112
112
|
* weights: a valid stored file serves them instead of converting the
|
|
113
113
|
* checkpoint, else they are written to it as they are converted;
|
|
114
114
|
* `info().weightCache` says which (see [`WeightCacheOutcome`]).
|
|
115
|
+
*
|
|
116
|
+
* `ggufFile` loads that GGUF file of the source (a source listing
|
|
117
|
+
* GGUF files and no safetensors loads its preferred one). Without
|
|
118
|
+
* `format`, a pre-quantized checkpoint (a `Q8_0` GGUF file, a
|
|
119
|
+
* `webslm export` checkpoint) loads in its own format, its blocks
|
|
120
|
+
* unchanged; weights already in the load format skip `weightCache`.
|
|
115
121
|
*/
|
|
116
122
|
static load(source: JsSource, options_json: string, lora?: JsSource | null, weight_cache?: JsWeightCache | null): Promise<WasmModel>;
|
|
117
123
|
/**
|
package/wasm/simd/webslm_wasm.js
CHANGED
|
@@ -263,6 +263,12 @@ export class WasmModel {
|
|
|
263
263
|
* weights: a valid stored file serves them instead of converting the
|
|
264
264
|
* checkpoint, else they are written to it as they are converted;
|
|
265
265
|
* `info().weightCache` says which (see [`WeightCacheOutcome`]).
|
|
266
|
+
*
|
|
267
|
+
* `ggufFile` loads that GGUF file of the source (a source listing
|
|
268
|
+
* GGUF files and no safetensors loads its preferred one). Without
|
|
269
|
+
* `format`, a pre-quantized checkpoint (a `Q8_0` GGUF file, a
|
|
270
|
+
* `webslm export` checkpoint) loads in its own format, its blocks
|
|
271
|
+
* unchanged; weights already in the load format skip `weightCache`.
|
|
266
272
|
* @param {JsSource} source
|
|
267
273
|
* @param {string} options_json
|
|
268
274
|
* @param {JsSource | null} [lora]
|
|
@@ -1424,32 +1430,32 @@ function __wbg_get_imports() {
|
|
|
1424
1430
|
arg0.writeBuffer(arg1, arg2, getArrayU8FromWasm0(arg3, arg4), arg5, arg6);
|
|
1425
1431
|
}, arguments); },
|
|
1426
1432
|
__wbindgen_generic_0000000000000001: function(arg0, arg1) {
|
|
1427
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
1433
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 306, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
1428
1434
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_8cf186fa7724d16d___convert__closures_____invoke___wasm_bindgen_8cf186fa7724d16d___JsValue__core_608f92abc48d28da___result__Result_____wasm_bindgen_8cf186fa7724d16d___JsError___true_);
|
|
1429
1435
|
return ret;
|
|
1430
1436
|
},
|
|
1431
1437
|
__wbindgen_generic_0000000000000002: function(arg0, arg1) {
|
|
1432
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDevice")], shim_idx:
|
|
1438
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDevice")], shim_idx: 239, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
1433
1439
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_8cf186fa7724d16d___convert__closures_____invoke___wasm_bindgen_8cf186fa7724d16d___sys__JsNullable_wgpu_54917290532eaf6b___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_8cf186fa7724d16d___JsError___true_);
|
|
1434
1440
|
return ret;
|
|
1435
1441
|
},
|
|
1436
1442
|
__wbindgen_generic_0000000000000003: function(arg0, arg1) {
|
|
1437
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDeviceLostInfo")], shim_idx:
|
|
1443
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDeviceLostInfo")], shim_idx: 243, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1438
1444
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_8cf186fa7724d16d___convert__closures_____invoke___wgpu_54917290532eaf6b___backend__webgpu__webgpu_sys__gen_GpuDeviceLostInfo__GpuDeviceLostInfo______true_);
|
|
1439
1445
|
return ret;
|
|
1440
1446
|
},
|
|
1441
1447
|
__wbindgen_generic_0000000000000004: function(arg0, arg1) {
|
|
1442
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUUncapturedErrorEvent")], shim_idx:
|
|
1448
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUUncapturedErrorEvent")], shim_idx: 243, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1443
1449
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_8cf186fa7724d16d___convert__closures_____invoke___wgpu_54917290532eaf6b___backend__webgpu__webgpu_sys__gen_GpuDeviceLostInfo__GpuDeviceLostInfo______true__37);
|
|
1444
1450
|
return ret;
|
|
1445
1451
|
},
|
|
1446
1452
|
__wbindgen_generic_0000000000000005: function(arg0, arg1) {
|
|
1447
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("any")], shim_idx:
|
|
1453
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("any")], shim_idx: 239, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
1448
1454
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_8cf186fa7724d16d___convert__closures_____invoke___wasm_bindgen_8cf186fa7724d16d___sys__JsNullable_wgpu_54917290532eaf6b___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_8cf186fa7724d16d___JsError___true__38);
|
|
1449
1455
|
return ret;
|
|
1450
1456
|
},
|
|
1451
1457
|
__wbindgen_generic_0000000000000006: function(arg0, arg1) {
|
|
1452
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("undefined")], shim_idx:
|
|
1458
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("undefined")], shim_idx: 239, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
1453
1459
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_8cf186fa7724d16d___convert__closures_____invoke___wasm_bindgen_8cf186fa7724d16d___sys__JsNullable_wgpu_54917290532eaf6b___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_608f92abc48d28da___result__Result_____wasm_bindgen_8cf186fa7724d16d___JsError___true__39);
|
|
1454
1460
|
return ret;
|
|
1455
1461
|
},
|