webslm 0.7.0 → 0.10.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 +116 -2
- package/dist/ai-sdk/embedding-model.d.ts +52 -0
- package/dist/ai-sdk/embedding-model.js +112 -0
- package/dist/ai-sdk/image-model.d.ts +53 -0
- package/dist/ai-sdk/image-model.js +148 -0
- package/dist/ai-sdk/index.d.ts +54 -0
- package/dist/ai-sdk/index.js +85 -11
- package/dist/ai-sdk/transcription-model.d.ts +48 -0
- package/dist/ai-sdk/transcription-model.js +115 -0
- package/dist/audio.d.ts +33 -0
- package/dist/audio.js +87 -0
- package/dist/client.d.ts +6 -0
- package/dist/client.js +8 -1
- package/dist/download.js +2 -2
- package/dist/engine.js +233 -0
- package/dist/errors.d.ts +5 -0
- package/dist/errors.js +1 -0
- package/dist/hub.d.ts +47 -3
- package/dist/hub.js +97 -8
- package/dist/image.d.ts +201 -0
- package/dist/image.js +353 -0
- package/dist/index.d.ts +6 -3
- package/dist/index.js +5 -2
- package/dist/models.d.ts +37 -1
- package/dist/models.js +99 -6
- package/dist/native.d.ts +34 -0
- package/dist/protocol.d.ts +106 -2
- package/dist/simple.d.ts +4 -1
- package/dist/simple.js +9 -2
- package/dist/types.d.ts +107 -1
- package/dist/wasm.d.ts +4 -0
- package/native-manifest.json +29 -29
- package/package.json +1 -1
- package/wasm/relaxed/webslm_wasm.d.ts +97 -6
- package/wasm/relaxed/webslm_wasm.js +223 -18
- package/wasm/relaxed/webslm_wasm_bg.wasm +0 -0
- package/wasm/relaxed/webslm_wasm_bg.wasm.d.ts +13 -3
- package/wasm/simd/webslm_wasm.d.ts +97 -6
- package/wasm/simd/webslm_wasm.js +223 -18
- package/wasm/simd/webslm_wasm_bg.wasm +0 -0
- package/wasm/simd/webslm_wasm_bg.wasm.d.ts +13 -3
- package/wasm/threads/webslm_wasm.d.ts +98 -7
- package/wasm/threads/webslm_wasm.js +228 -23
- package/wasm/threads/webslm_wasm_bg.wasm +0 -0
- package/wasm/threads/webslm_wasm_bg.wasm.d.ts +14 -4
|
@@ -49,9 +49,41 @@ export class Sha256Hasher {
|
|
|
49
49
|
update(bytes: Uint8Array): void;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
/**
|
|
53
|
+
* A loaded text-to-image pipeline.
|
|
54
|
+
*/
|
|
55
|
+
export class WasmImageModel {
|
|
56
|
+
private constructor();
|
|
57
|
+
free(): void;
|
|
58
|
+
[Symbol.dispose](): void;
|
|
59
|
+
/**
|
|
60
|
+
* Generates an image of `prompt`. `options_json`: `{ width?, height?,
|
|
61
|
+
* steps?, guidance?, seed?, negativePrompt? }` (see `ImageOptionsJs`).
|
|
62
|
+
* `on_progress(phase, step, steps)` is called before encoding the
|
|
63
|
+
* prompt, before each denoising step and before decoding; returning
|
|
64
|
+
* `false` stops the generation (it rejects with `"ABORTED"`).
|
|
65
|
+
* Resolves to `{ width, height, seed, rgba: Uint8Array }` (row-major
|
|
66
|
+
* 8-bit RGBA).
|
|
67
|
+
*/
|
|
68
|
+
generate(prompt: string, options_json: string, on_progress?: Function | null): Promise<any>;
|
|
69
|
+
/**
|
|
70
|
+
* Describes the pipeline (see [`ImageModelInfo`]).
|
|
71
|
+
*/
|
|
72
|
+
info(): any;
|
|
73
|
+
/**
|
|
74
|
+
* Loads a pipeline from `source`. `options_json`:
|
|
75
|
+
* `{ format?: "f16" | "f32" | "bf16" | "q8" | ..., device?: "cpu" |
|
|
76
|
+
* "webgpu" | "auto" }` (defaults: f16 weights, `auto`). `decoder`,
|
|
77
|
+
* when given, serves a standalone autoencoder (`config.json` and
|
|
78
|
+
* `diffusion_pytorch_model.safetensors`, e.g. `madebyollin/taesd`)
|
|
79
|
+
* that replaces the pipeline's decoder.
|
|
80
|
+
*/
|
|
81
|
+
static load(source: JsSource, options_json: string, decoder?: JsSource | null): Promise<WasmImageModel>;
|
|
82
|
+
}
|
|
83
|
+
|
|
52
84
|
/**
|
|
53
85
|
* A loaded checkpoint, with a default session used by `chat` and
|
|
54
|
-
* `generate`.
|
|
86
|
+
* `generate` (language models), or an encoder answering `embed`.
|
|
55
87
|
*/
|
|
56
88
|
export class WasmModel {
|
|
57
89
|
private constructor();
|
|
@@ -84,6 +116,17 @@ export class WasmModel {
|
|
|
84
116
|
* Decodes token ids into text.
|
|
85
117
|
*/
|
|
86
118
|
detokenize(ids: Uint32Array, skip_special_tokens: boolean): string;
|
|
119
|
+
/**
|
|
120
|
+
* Embeds texts with an encoder. `texts_json` is a JSON array of
|
|
121
|
+
* strings; `options_json`: `{ pooling?: "cls" | "mean" | "max" |
|
|
122
|
+
* "mean_sqrt_len_tokens" | "weightedmean" | "lasttoken", normalize?:
|
|
123
|
+
* boolean }` (defaults: the model's sentence-transformers settings).
|
|
124
|
+
* Resolves to `{ data: Float32Array, dimensions: number, tokens:
|
|
125
|
+
* number[] }`: the vectors one after the other, and the number of
|
|
126
|
+
* tokens read from each text (texts longer than the model's limit are
|
|
127
|
+
* cut). Rejects with `UNSUPPORTED_TASK` on a language model.
|
|
128
|
+
*/
|
|
129
|
+
embed(texts_json: string, options_json: string): Promise<any>;
|
|
87
130
|
/**
|
|
88
131
|
* Completes raw text in the default session; see
|
|
89
132
|
* [`WasmSession::generate`].
|
|
@@ -126,6 +169,9 @@ export class WasmModel {
|
|
|
126
169
|
* `format`, a pre-quantized checkpoint (a `Q8_0` GGUF file, a
|
|
127
170
|
* `webslm export` checkpoint) loads in its own format, its blocks
|
|
128
171
|
* unchanged; weights already in the load format skip `weightCache`.
|
|
172
|
+
*
|
|
173
|
+
* An encoder loads in f32 unless `format` says otherwise, and takes
|
|
174
|
+
* no `lora`.
|
|
129
175
|
*/
|
|
130
176
|
static load(source: JsSource, options_json: string, lora?: JsSource | null, weight_cache?: JsWeightCache | null): Promise<WasmModel>;
|
|
131
177
|
/**
|
|
@@ -142,13 +188,36 @@ export class WasmModel {
|
|
|
142
188
|
*/
|
|
143
189
|
renderChat(messages_json: string, kwargs_json: string): string;
|
|
144
190
|
/**
|
|
145
|
-
* Clears the default session.
|
|
191
|
+
* Clears the default session (nothing to clear for an encoder).
|
|
146
192
|
*/
|
|
147
193
|
reset(): void;
|
|
148
194
|
/**
|
|
149
|
-
* Encodes text into token ids
|
|
195
|
+
* Encodes text into token ids (an encoder's tokenizer cuts texts at
|
|
196
|
+
* its limit, as `embed` does).
|
|
150
197
|
*/
|
|
151
198
|
tokenize(text: string, add_special_tokens: boolean): Uint32Array;
|
|
199
|
+
/**
|
|
200
|
+
* Transcribes speech with a speech recognition model (Whisper).
|
|
201
|
+
* `audio` is mono PCM (`Float32Array`, at `sampleRate`, 16 kHz by
|
|
202
|
+
* default) or the bytes of a WAV file (`Uint8Array`; browsers decode
|
|
203
|
+
* other formats with `AudioContext` first). `options_json`:
|
|
204
|
+
* `{ language?: string, task?: "transcribe" | "translate",
|
|
205
|
+
* maxNewTokens?: number, sampleRate?: number }` (no language: detected).
|
|
206
|
+
* `on_text(text)` receives the text as it is generated and stops the
|
|
207
|
+
* transcription by returning `false` (or a promise resolving to
|
|
208
|
+
* `false`). Resolves to `{ text, language,
|
|
209
|
+
* duration, segments: [{ id, start, end, text, tokens }], tokens,
|
|
210
|
+
* stopped }`. Rejects with `UNSUPPORTED_TASK` on other models.
|
|
211
|
+
*/
|
|
212
|
+
transcribe(audio: any, options_json: string, on_text?: Function | null): Promise<any>;
|
|
213
|
+
/**
|
|
214
|
+
* Whether the model is an encoder (it answers `embed`, not `chat`).
|
|
215
|
+
*/
|
|
216
|
+
readonly isEncoder: boolean;
|
|
217
|
+
/**
|
|
218
|
+
* Whether the model recognizes speech (it answers `transcribe`).
|
|
219
|
+
*/
|
|
220
|
+
readonly isSpeech: boolean;
|
|
152
221
|
}
|
|
153
222
|
|
|
154
223
|
/**
|
|
@@ -279,12 +348,24 @@ export function buildInfo(): any;
|
|
|
279
348
|
*/
|
|
280
349
|
export function parseSafetensorsHeader(bytes: Uint8Array): any;
|
|
281
350
|
|
|
351
|
+
/**
|
|
352
|
+
* `model_type` values of the encoders this build embeds with (models
|
|
353
|
+
* whose `WasmModel` answers `embed`).
|
|
354
|
+
*/
|
|
355
|
+
export function supportedEncoderTypes(): string[];
|
|
356
|
+
|
|
282
357
|
/**
|
|
283
358
|
* `model_type` values (from `config.json`) of the architectures this build
|
|
284
359
|
* can run.
|
|
285
360
|
*/
|
|
286
361
|
export function supportedModelTypes(): string[];
|
|
287
362
|
|
|
363
|
+
/**
|
|
364
|
+
* `model_type` values of the speech recognition models this build runs
|
|
365
|
+
* (models whose `WasmModel` answers `transcribe`).
|
|
366
|
+
*/
|
|
367
|
+
export function supportedSpeechTypes(): string[];
|
|
368
|
+
|
|
288
369
|
/**
|
|
289
370
|
* Version of the Rust engine, as declared in `Cargo.toml`.
|
|
290
371
|
*/
|
|
@@ -297,6 +378,7 @@ export interface InitOutput {
|
|
|
297
378
|
readonly __wbg_jssource_free: (a: number, b: number) => void;
|
|
298
379
|
readonly __wbg_jsweightcache_free: (a: number, b: number) => void;
|
|
299
380
|
readonly __wbg_sha256hasher_free: (a: number, b: number) => void;
|
|
381
|
+
readonly __wbg_wasmimagemodel_free: (a: number, b: number) => void;
|
|
300
382
|
readonly __wbg_wasmmodel_free: (a: number, b: number) => void;
|
|
301
383
|
readonly __wbg_wasmsession_free: (a: number, b: number) => void;
|
|
302
384
|
readonly buildInfo: () => [number, number, number];
|
|
@@ -306,20 +388,29 @@ export interface InitOutput {
|
|
|
306
388
|
readonly sha256hasher_finish: (a: number) => [number, number];
|
|
307
389
|
readonly sha256hasher_new: () => number;
|
|
308
390
|
readonly sha256hasher_update: (a: number, b: number, c: number) => void;
|
|
391
|
+
readonly supportedEncoderTypes: () => [number, number];
|
|
309
392
|
readonly supportedModelTypes: () => [number, number];
|
|
393
|
+
readonly supportedSpeechTypes: () => [number, number];
|
|
310
394
|
readonly version: () => [number, number];
|
|
395
|
+
readonly wasmimagemodel_generate: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
|
|
396
|
+
readonly wasmimagemodel_info: (a: number) => [number, number, number];
|
|
397
|
+
readonly wasmimagemodel_load: (a: number, b: number, c: number, d: number) => any;
|
|
311
398
|
readonly wasmmodel_applyAdapter: (a: number, b: number, c: number, d: number) => any;
|
|
312
399
|
readonly wasmmodel_chat: (a: number, b: number, c: number, d: number, e: number, f: any, g: number) => any;
|
|
313
400
|
readonly wasmmodel_chatWithMedia: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: any, k: number) => any;
|
|
314
401
|
readonly wasmmodel_createSession: (a: number) => [number, number, number];
|
|
315
402
|
readonly wasmmodel_detokenize: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
403
|
+
readonly wasmmodel_embed: (a: number, b: number, c: number, d: number, e: number) => any;
|
|
316
404
|
readonly wasmmodel_generate: (a: number, b: number, c: number, d: number, e: number, f: any, g: number) => any;
|
|
317
405
|
readonly wasmmodel_info: (a: number) => [number, number, number];
|
|
406
|
+
readonly wasmmodel_isEncoder: (a: number) => number;
|
|
407
|
+
readonly wasmmodel_isSpeech: (a: number) => number;
|
|
318
408
|
readonly wasmmodel_load: (a: number, b: number, c: number, d: number, e: number) => any;
|
|
319
409
|
readonly wasmmodel_removeAdapter: (a: number) => any;
|
|
320
410
|
readonly wasmmodel_renderChat: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
321
411
|
readonly wasmmodel_reset: (a: number) => [number, number];
|
|
322
412
|
readonly wasmmodel_tokenize: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
413
|
+
readonly wasmmodel_transcribe: (a: number, b: any, c: number, d: number, e: number) => any;
|
|
323
414
|
readonly wasmsession_capacity: (a: number) => [number, number, number];
|
|
324
415
|
readonly wasmsession_chat: (a: number, b: number, c: number, d: number, e: number, f: any, g: number) => any;
|
|
325
416
|
readonly wasmsession_chatWithMedia: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: any, k: number) => any;
|
|
@@ -337,10 +428,10 @@ export interface InitOutput {
|
|
|
337
428
|
readonly wasm_bindgen_8cf186fa7724d16d___convert__closures_____invoke___js_sys_56365fc49d784db6___Function_fn_wasm_bindgen_8cf186fa7724d16d___JsValue_____wasm_bindgen_8cf186fa7724d16d___sys__Undefined___js_sys_56365fc49d784db6___Function_fn_wasm_bindgen_8cf186fa7724d16d___JsValue_____wasm_bindgen_8cf186fa7724d16d___sys__Undefined_______true_: (a: number, b: number, c: any, d: any) => void;
|
|
338
429
|
readonly wasm_bindgen_8cf186fa7724d16d___convert__closures_____invoke___wasm_bindgen_8cf186fa7724d16d___JsValue__core_608f92abc48d28da___result__Result_____wasm_bindgen_8cf186fa7724d16d___JsError___true_: (a: number, b: number, c: any) => [number, number];
|
|
339
430
|
readonly 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_: (a: number, b: number, c: any) => [number, number];
|
|
340
|
-
readonly
|
|
341
|
-
readonly
|
|
431
|
+
readonly 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__49: (a: number, b: number, c: any) => [number, number];
|
|
432
|
+
readonly 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__50: (a: number, b: number, c: any) => [number, number];
|
|
342
433
|
readonly wasm_bindgen_8cf186fa7724d16d___convert__closures_____invoke___wgpu_54917290532eaf6b___backend__webgpu__webgpu_sys__gen_GpuDeviceLostInfo__GpuDeviceLostInfo______true_: (a: number, b: number, c: any) => void;
|
|
343
|
-
readonly
|
|
434
|
+
readonly wasm_bindgen_8cf186fa7724d16d___convert__closures_____invoke___wgpu_54917290532eaf6b___backend__webgpu__webgpu_sys__gen_GpuDeviceLostInfo__GpuDeviceLostInfo______true__48: (a: number, b: number, c: any) => void;
|
|
344
435
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
345
436
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
346
437
|
readonly __wbindgen_exn_store: (a: number) => void;
|
|
@@ -117,9 +117,89 @@ export class Sha256Hasher {
|
|
|
117
117
|
}
|
|
118
118
|
if (Symbol.dispose) Sha256Hasher.prototype[Symbol.dispose] = Sha256Hasher.prototype.free;
|
|
119
119
|
|
|
120
|
+
/**
|
|
121
|
+
* A loaded text-to-image pipeline.
|
|
122
|
+
*/
|
|
123
|
+
export class WasmImageModel {
|
|
124
|
+
static __wrap(ptr) {
|
|
125
|
+
const obj = Object.create(WasmImageModel.prototype);
|
|
126
|
+
obj.__wbg_ptr = ptr;
|
|
127
|
+
WasmImageModelFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
128
|
+
return obj;
|
|
129
|
+
}
|
|
130
|
+
__destroy_into_raw() {
|
|
131
|
+
const ptr = this.__wbg_ptr;
|
|
132
|
+
this.__wbg_ptr = 0;
|
|
133
|
+
WasmImageModelFinalization.unregister(this);
|
|
134
|
+
return ptr;
|
|
135
|
+
}
|
|
136
|
+
free() {
|
|
137
|
+
const ptr = this.__destroy_into_raw();
|
|
138
|
+
wasm.__wbg_wasmimagemodel_free(ptr, 0);
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Generates an image of `prompt`. `options_json`: `{ width?, height?,
|
|
142
|
+
* steps?, guidance?, seed?, negativePrompt? }` (see `ImageOptionsJs`).
|
|
143
|
+
* `on_progress(phase, step, steps)` is called before encoding the
|
|
144
|
+
* prompt, before each denoising step and before decoding; returning
|
|
145
|
+
* `false` stops the generation (it rejects with `"ABORTED"`).
|
|
146
|
+
* Resolves to `{ width, height, seed, rgba: Uint8Array }` (row-major
|
|
147
|
+
* 8-bit RGBA).
|
|
148
|
+
* @param {string} prompt
|
|
149
|
+
* @param {string} options_json
|
|
150
|
+
* @param {Function | null} [on_progress]
|
|
151
|
+
* @returns {Promise<any>}
|
|
152
|
+
*/
|
|
153
|
+
generate(prompt, options_json, on_progress) {
|
|
154
|
+
const ptr0 = passStringToWasm0(prompt, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
155
|
+
const len0 = WASM_VECTOR_LEN;
|
|
156
|
+
const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
157
|
+
const len1 = WASM_VECTOR_LEN;
|
|
158
|
+
const ret = wasm.wasmimagemodel_generate(this.__wbg_ptr, ptr0, len0, ptr1, len1, isLikeNone(on_progress) ? 0 : addToExternrefTable0(on_progress));
|
|
159
|
+
return ret;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Describes the pipeline (see [`ImageModelInfo`]).
|
|
163
|
+
* @returns {any}
|
|
164
|
+
*/
|
|
165
|
+
info() {
|
|
166
|
+
const ret = wasm.wasmimagemodel_info(this.__wbg_ptr);
|
|
167
|
+
if (ret[2]) {
|
|
168
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
169
|
+
}
|
|
170
|
+
return takeFromExternrefTable0(ret[0]);
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Loads a pipeline from `source`. `options_json`:
|
|
174
|
+
* `{ format?: "f16" | "f32" | "bf16" | "q8" | ..., device?: "cpu" |
|
|
175
|
+
* "webgpu" | "auto" }` (defaults: f16 weights, `auto`). `decoder`,
|
|
176
|
+
* when given, serves a standalone autoencoder (`config.json` and
|
|
177
|
+
* `diffusion_pytorch_model.safetensors`, e.g. `madebyollin/taesd`)
|
|
178
|
+
* that replaces the pipeline's decoder.
|
|
179
|
+
* @param {JsSource} source
|
|
180
|
+
* @param {string} options_json
|
|
181
|
+
* @param {JsSource | null} [decoder]
|
|
182
|
+
* @returns {Promise<WasmImageModel>}
|
|
183
|
+
*/
|
|
184
|
+
static load(source, options_json, decoder) {
|
|
185
|
+
_assertClass(source, JsSource);
|
|
186
|
+
var ptr0 = source.__destroy_into_raw();
|
|
187
|
+
const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
188
|
+
const len1 = WASM_VECTOR_LEN;
|
|
189
|
+
let ptr2 = 0;
|
|
190
|
+
if (!isLikeNone(decoder)) {
|
|
191
|
+
_assertClass(decoder, JsSource);
|
|
192
|
+
ptr2 = decoder.__destroy_into_raw();
|
|
193
|
+
}
|
|
194
|
+
const ret = wasm.wasmimagemodel_load(ptr0, ptr1, len1, ptr2);
|
|
195
|
+
return ret;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
if (Symbol.dispose) WasmImageModel.prototype[Symbol.dispose] = WasmImageModel.prototype.free;
|
|
199
|
+
|
|
120
200
|
/**
|
|
121
201
|
* A loaded checkpoint, with a default session used by `chat` and
|
|
122
|
-
* `generate`.
|
|
202
|
+
* `generate` (language models), or an encoder answering `embed`.
|
|
123
203
|
*/
|
|
124
204
|
export class WasmModel {
|
|
125
205
|
static __wrap(ptr) {
|
|
@@ -234,6 +314,27 @@ export class WasmModel {
|
|
|
234
314
|
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
235
315
|
}
|
|
236
316
|
}
|
|
317
|
+
/**
|
|
318
|
+
* Embeds texts with an encoder. `texts_json` is a JSON array of
|
|
319
|
+
* strings; `options_json`: `{ pooling?: "cls" | "mean" | "max" |
|
|
320
|
+
* "mean_sqrt_len_tokens" | "weightedmean" | "lasttoken", normalize?:
|
|
321
|
+
* boolean }` (defaults: the model's sentence-transformers settings).
|
|
322
|
+
* Resolves to `{ data: Float32Array, dimensions: number, tokens:
|
|
323
|
+
* number[] }`: the vectors one after the other, and the number of
|
|
324
|
+
* tokens read from each text (texts longer than the model's limit are
|
|
325
|
+
* cut). Rejects with `UNSUPPORTED_TASK` on a language model.
|
|
326
|
+
* @param {string} texts_json
|
|
327
|
+
* @param {string} options_json
|
|
328
|
+
* @returns {Promise<any>}
|
|
329
|
+
*/
|
|
330
|
+
embed(texts_json, options_json) {
|
|
331
|
+
const ptr0 = passStringToWasm0(texts_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
332
|
+
const len0 = WASM_VECTOR_LEN;
|
|
333
|
+
const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
334
|
+
const len1 = WASM_VECTOR_LEN;
|
|
335
|
+
const ret = wasm.wasmmodel_embed(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
336
|
+
return ret;
|
|
337
|
+
}
|
|
237
338
|
/**
|
|
238
339
|
* Completes raw text in the default session; see
|
|
239
340
|
* [`WasmSession::generate`].
|
|
@@ -262,6 +363,22 @@ export class WasmModel {
|
|
|
262
363
|
}
|
|
263
364
|
return takeFromExternrefTable0(ret[0]);
|
|
264
365
|
}
|
|
366
|
+
/**
|
|
367
|
+
* Whether the model is an encoder (it answers `embed`, not `chat`).
|
|
368
|
+
* @returns {boolean}
|
|
369
|
+
*/
|
|
370
|
+
get isEncoder() {
|
|
371
|
+
const ret = wasm.wasmmodel_isEncoder(this.__wbg_ptr);
|
|
372
|
+
return ret !== 0;
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Whether the model recognizes speech (it answers `transcribe`).
|
|
376
|
+
* @returns {boolean}
|
|
377
|
+
*/
|
|
378
|
+
get isSpeech() {
|
|
379
|
+
const ret = wasm.wasmmodel_isSpeech(this.__wbg_ptr);
|
|
380
|
+
return ret !== 0;
|
|
381
|
+
}
|
|
265
382
|
/**
|
|
266
383
|
* Loads a checkpoint from `source`. `options_json` is a JSON object:
|
|
267
384
|
* `{ format?: "q8" | "q4" | "q4_0" | "f32" | "f16" | "bf16",
|
|
@@ -295,6 +412,9 @@ export class WasmModel {
|
|
|
295
412
|
* `format`, a pre-quantized checkpoint (a `Q8_0` GGUF file, a
|
|
296
413
|
* `webslm export` checkpoint) loads in its own format, its blocks
|
|
297
414
|
* unchanged; weights already in the load format skip `weightCache`.
|
|
415
|
+
*
|
|
416
|
+
* An encoder loads in f32 unless `format` says otherwise, and takes
|
|
417
|
+
* no `lora`.
|
|
298
418
|
* @param {JsSource} source
|
|
299
419
|
* @param {string} options_json
|
|
300
420
|
* @param {JsSource | null} [lora]
|
|
@@ -361,7 +481,7 @@ export class WasmModel {
|
|
|
361
481
|
}
|
|
362
482
|
}
|
|
363
483
|
/**
|
|
364
|
-
* Clears the default session.
|
|
484
|
+
* Clears the default session (nothing to clear for an encoder).
|
|
365
485
|
*/
|
|
366
486
|
reset() {
|
|
367
487
|
const ret = wasm.wasmmodel_reset(this.__wbg_ptr);
|
|
@@ -370,7 +490,8 @@ export class WasmModel {
|
|
|
370
490
|
}
|
|
371
491
|
}
|
|
372
492
|
/**
|
|
373
|
-
* Encodes text into token ids
|
|
493
|
+
* Encodes text into token ids (an encoder's tokenizer cuts texts at
|
|
494
|
+
* its limit, as `embed` does).
|
|
374
495
|
* @param {string} text
|
|
375
496
|
* @param {boolean} add_special_tokens
|
|
376
497
|
* @returns {Uint32Array}
|
|
@@ -386,6 +507,29 @@ export class WasmModel {
|
|
|
386
507
|
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
387
508
|
return v2;
|
|
388
509
|
}
|
|
510
|
+
/**
|
|
511
|
+
* Transcribes speech with a speech recognition model (Whisper).
|
|
512
|
+
* `audio` is mono PCM (`Float32Array`, at `sampleRate`, 16 kHz by
|
|
513
|
+
* default) or the bytes of a WAV file (`Uint8Array`; browsers decode
|
|
514
|
+
* other formats with `AudioContext` first). `options_json`:
|
|
515
|
+
* `{ language?: string, task?: "transcribe" | "translate",
|
|
516
|
+
* maxNewTokens?: number, sampleRate?: number }` (no language: detected).
|
|
517
|
+
* `on_text(text)` receives the text as it is generated and stops the
|
|
518
|
+
* transcription by returning `false` (or a promise resolving to
|
|
519
|
+
* `false`). Resolves to `{ text, language,
|
|
520
|
+
* duration, segments: [{ id, start, end, text, tokens }], tokens,
|
|
521
|
+
* stopped }`. Rejects with `UNSUPPORTED_TASK` on other models.
|
|
522
|
+
* @param {any} audio
|
|
523
|
+
* @param {string} options_json
|
|
524
|
+
* @param {Function | null} [on_text]
|
|
525
|
+
* @returns {Promise<any>}
|
|
526
|
+
*/
|
|
527
|
+
transcribe(audio, options_json, on_text) {
|
|
528
|
+
const ptr0 = passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
529
|
+
const len0 = WASM_VECTOR_LEN;
|
|
530
|
+
const ret = wasm.wasmmodel_transcribe(this.__wbg_ptr, audio, ptr0, len0, isLikeNone(on_text) ? 0 : addToExternrefTable0(on_text));
|
|
531
|
+
return ret;
|
|
532
|
+
}
|
|
389
533
|
}
|
|
390
534
|
if (Symbol.dispose) WasmModel.prototype[Symbol.dispose] = WasmModel.prototype.free;
|
|
391
535
|
|
|
@@ -669,6 +813,18 @@ export function parseSafetensorsHeader(bytes) {
|
|
|
669
813
|
return takeFromExternrefTable0(ret[0]);
|
|
670
814
|
}
|
|
671
815
|
|
|
816
|
+
/**
|
|
817
|
+
* `model_type` values of the encoders this build embeds with (models
|
|
818
|
+
* whose `WasmModel` answers `embed`).
|
|
819
|
+
* @returns {string[]}
|
|
820
|
+
*/
|
|
821
|
+
export function supportedEncoderTypes() {
|
|
822
|
+
const ret = wasm.supportedEncoderTypes();
|
|
823
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]);
|
|
824
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
825
|
+
return v1;
|
|
826
|
+
}
|
|
827
|
+
|
|
672
828
|
/**
|
|
673
829
|
* `model_type` values (from `config.json`) of the architectures this build
|
|
674
830
|
* can run.
|
|
@@ -681,6 +837,18 @@ export function supportedModelTypes() {
|
|
|
681
837
|
return v1;
|
|
682
838
|
}
|
|
683
839
|
|
|
840
|
+
/**
|
|
841
|
+
* `model_type` values of the speech recognition models this build runs
|
|
842
|
+
* (models whose `WasmModel` answers `transcribe`).
|
|
843
|
+
* @returns {string[]}
|
|
844
|
+
*/
|
|
845
|
+
export function supportedSpeechTypes() {
|
|
846
|
+
const ret = wasm.supportedSpeechTypes();
|
|
847
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]);
|
|
848
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
849
|
+
return v1;
|
|
850
|
+
}
|
|
851
|
+
|
|
684
852
|
/**
|
|
685
853
|
* Version of the Rust engine, as declared in `Cargo.toml`.
|
|
686
854
|
* @returns {string}
|
|
@@ -719,6 +887,11 @@ function __wbg_get_imports() {
|
|
|
719
887
|
const ret = arg0.WorkerGlobalScope;
|
|
720
888
|
return ret;
|
|
721
889
|
},
|
|
890
|
+
__wbg___wbindgen_boolean_get_7a12af2b3f899c5a: function(arg0) {
|
|
891
|
+
const v = arg0;
|
|
892
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
893
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
894
|
+
},
|
|
722
895
|
__wbg___wbindgen_debug_string_0e68cf47c9cbd9b0: function(arg0, arg1) {
|
|
723
896
|
const ret = debugString(arg1);
|
|
724
897
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
@@ -895,6 +1068,16 @@ function __wbg_get_imports() {
|
|
|
895
1068
|
const ret = result;
|
|
896
1069
|
return ret;
|
|
897
1070
|
},
|
|
1071
|
+
__wbg_instanceof_Float32Array_31e80d3e88752523: function(arg0) {
|
|
1072
|
+
let result;
|
|
1073
|
+
try {
|
|
1074
|
+
result = arg0 instanceof Float32Array;
|
|
1075
|
+
} catch (_) {
|
|
1076
|
+
result = false;
|
|
1077
|
+
}
|
|
1078
|
+
const ret = result;
|
|
1079
|
+
return ret;
|
|
1080
|
+
},
|
|
898
1081
|
__wbg_instanceof_GpuOutOfMemoryError_829d8185d83170f0: function(arg0) {
|
|
899
1082
|
let result;
|
|
900
1083
|
try {
|
|
@@ -958,6 +1141,10 @@ function __wbg_get_imports() {
|
|
|
958
1141
|
const ret = arg0.length;
|
|
959
1142
|
return ret;
|
|
960
1143
|
},
|
|
1144
|
+
__wbg_length_8768c6f6941913e3: function(arg0) {
|
|
1145
|
+
const ret = arg0.length;
|
|
1146
|
+
return ret;
|
|
1147
|
+
},
|
|
961
1148
|
__wbg_limits_f4203404018656d1: function(arg0) {
|
|
962
1149
|
const ret = arg0.limits;
|
|
963
1150
|
return ret;
|
|
@@ -1148,6 +1335,10 @@ function __wbg_get_imports() {
|
|
|
1148
1335
|
const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
|
|
1149
1336
|
return ret;
|
|
1150
1337
|
},
|
|
1338
|
+
__wbg_new_from_slice_a500ec81601be48f: function(arg0, arg1) {
|
|
1339
|
+
const ret = new Uint32Array(getArrayU32FromWasm0(arg0, arg1));
|
|
1340
|
+
return ret;
|
|
1341
|
+
},
|
|
1151
1342
|
__wbg_new_typed_6f8b0d724fe26c07: function(arg0, arg1) {
|
|
1152
1343
|
try {
|
|
1153
1344
|
var state0 = {a: arg0, b: arg1};
|
|
@@ -1182,6 +1373,9 @@ function __wbg_get_imports() {
|
|
|
1182
1373
|
const ret = arg0.popErrorScope();
|
|
1183
1374
|
return ret;
|
|
1184
1375
|
},
|
|
1376
|
+
__wbg_prototypesetcall_804a1eb1b047ccb9: function(arg0, arg1, arg2) {
|
|
1377
|
+
Float32Array.prototype.set.call(getArrayF32FromWasm0(arg0, arg1), arg2);
|
|
1378
|
+
},
|
|
1185
1379
|
__wbg_prototypesetcall_ae9f5e7459250748: function(arg0, arg1, arg2) {
|
|
1186
1380
|
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
1187
1381
|
},
|
|
@@ -1211,6 +1405,10 @@ function __wbg_get_imports() {
|
|
|
1211
1405
|
const ret = arg0.reason;
|
|
1212
1406
|
return (__wbindgen_enum_GpuDeviceLostReason.indexOf(ret) + 1 || 3) - 1;
|
|
1213
1407
|
},
|
|
1408
|
+
__wbg_reject_bea6d825081bd4d7: function(arg0) {
|
|
1409
|
+
const ret = Promise.reject(arg0);
|
|
1410
|
+
return ret;
|
|
1411
|
+
},
|
|
1214
1412
|
__wbg_requestAdapter_2cb1006baf7abd60: function(arg0) {
|
|
1215
1413
|
const ret = arg0.requestAdapter();
|
|
1216
1414
|
return ret;
|
|
@@ -1476,6 +1674,10 @@ function __wbg_get_imports() {
|
|
|
1476
1674
|
const ret = arg0.valueOf();
|
|
1477
1675
|
return ret;
|
|
1478
1676
|
},
|
|
1677
|
+
__wbg_wasmimagemodel_new: function(arg0) {
|
|
1678
|
+
const ret = WasmImageModel.__wrap(arg0);
|
|
1679
|
+
return ret;
|
|
1680
|
+
},
|
|
1479
1681
|
__wbg_wasmmodel_new: function(arg0) {
|
|
1480
1682
|
const ret = WasmModel.__wrap(arg0);
|
|
1481
1683
|
return ret;
|
|
@@ -1484,33 +1686,33 @@ function __wbg_get_imports() {
|
|
|
1484
1686
|
arg0.writeBuffer(arg1, arg2, getArrayU8FromWasm0(arg3, arg4), arg5, arg6);
|
|
1485
1687
|
}, arguments); },
|
|
1486
1688
|
__wbindgen_generic_0000000000000001: function(arg0, arg1) {
|
|
1487
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
1689
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 368, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
1488
1690
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_8cf186fa7724d16d___convert__closures_____invoke___wasm_bindgen_8cf186fa7724d16d___JsValue__core_608f92abc48d28da___result__Result_____wasm_bindgen_8cf186fa7724d16d___JsError___true_);
|
|
1489
1691
|
return ret;
|
|
1490
1692
|
},
|
|
1491
1693
|
__wbindgen_generic_0000000000000002: function(arg0, arg1) {
|
|
1492
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDevice")], shim_idx:
|
|
1694
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDevice")], shim_idx: 296, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
1493
1695
|
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_);
|
|
1494
1696
|
return ret;
|
|
1495
1697
|
},
|
|
1496
1698
|
__wbindgen_generic_0000000000000003: function(arg0, arg1) {
|
|
1497
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDeviceLostInfo")], shim_idx:
|
|
1699
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDeviceLostInfo")], shim_idx: 300, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1498
1700
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_8cf186fa7724d16d___convert__closures_____invoke___wgpu_54917290532eaf6b___backend__webgpu__webgpu_sys__gen_GpuDeviceLostInfo__GpuDeviceLostInfo______true_);
|
|
1499
1701
|
return ret;
|
|
1500
1702
|
},
|
|
1501
1703
|
__wbindgen_generic_0000000000000004: function(arg0, arg1) {
|
|
1502
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUUncapturedErrorEvent")], shim_idx:
|
|
1503
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
1704
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUUncapturedErrorEvent")], shim_idx: 300, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1705
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_8cf186fa7724d16d___convert__closures_____invoke___wgpu_54917290532eaf6b___backend__webgpu__webgpu_sys__gen_GpuDeviceLostInfo__GpuDeviceLostInfo______true__48);
|
|
1504
1706
|
return ret;
|
|
1505
1707
|
},
|
|
1506
1708
|
__wbindgen_generic_0000000000000005: function(arg0, arg1) {
|
|
1507
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("any")], shim_idx:
|
|
1508
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
1709
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("any")], shim_idx: 296, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
1710
|
+
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__49);
|
|
1509
1711
|
return ret;
|
|
1510
1712
|
},
|
|
1511
1713
|
__wbindgen_generic_0000000000000006: function(arg0, arg1) {
|
|
1512
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("undefined")], shim_idx:
|
|
1513
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
1714
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("undefined")], shim_idx: 296, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
1715
|
+
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__50);
|
|
1514
1716
|
return ret;
|
|
1515
1717
|
},
|
|
1516
1718
|
__wbindgen_generic_0000000000000007: function(arg0) {
|
|
@@ -1553,8 +1755,8 @@ function wasm_bindgen_8cf186fa7724d16d___convert__closures_____invoke___wgpu_549
|
|
|
1553
1755
|
wasm.wasm_bindgen_8cf186fa7724d16d___convert__closures_____invoke___wgpu_54917290532eaf6b___backend__webgpu__webgpu_sys__gen_GpuDeviceLostInfo__GpuDeviceLostInfo______true_(arg0, arg1, arg2);
|
|
1554
1756
|
}
|
|
1555
1757
|
|
|
1556
|
-
function
|
|
1557
|
-
wasm.
|
|
1758
|
+
function wasm_bindgen_8cf186fa7724d16d___convert__closures_____invoke___wgpu_54917290532eaf6b___backend__webgpu__webgpu_sys__gen_GpuDeviceLostInfo__GpuDeviceLostInfo______true__48(arg0, arg1, arg2) {
|
|
1759
|
+
wasm.wasm_bindgen_8cf186fa7724d16d___convert__closures_____invoke___wgpu_54917290532eaf6b___backend__webgpu__webgpu_sys__gen_GpuDeviceLostInfo__GpuDeviceLostInfo______true__48(arg0, arg1, arg2);
|
|
1558
1760
|
}
|
|
1559
1761
|
|
|
1560
1762
|
function wasm_bindgen_8cf186fa7724d16d___convert__closures_____invoke___wasm_bindgen_8cf186fa7724d16d___JsValue__core_608f92abc48d28da___result__Result_____wasm_bindgen_8cf186fa7724d16d___JsError___true_(arg0, arg1, arg2) {
|
|
@@ -1571,15 +1773,15 @@ function wasm_bindgen_8cf186fa7724d16d___convert__closures_____invoke___wasm_bin
|
|
|
1571
1773
|
}
|
|
1572
1774
|
}
|
|
1573
1775
|
|
|
1574
|
-
function
|
|
1575
|
-
const ret = wasm.
|
|
1776
|
+
function 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__49(arg0, arg1, arg2) {
|
|
1777
|
+
const ret = wasm.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__49(arg0, arg1, arg2);
|
|
1576
1778
|
if (ret[1]) {
|
|
1577
1779
|
throw takeFromExternrefTable0(ret[0]);
|
|
1578
1780
|
}
|
|
1579
1781
|
}
|
|
1580
1782
|
|
|
1581
|
-
function
|
|
1582
|
-
const ret = wasm.
|
|
1783
|
+
function 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__50(arg0, arg1, arg2) {
|
|
1784
|
+
const ret = wasm.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__50(arg0, arg1, arg2);
|
|
1583
1785
|
if (ret[1]) {
|
|
1584
1786
|
throw takeFromExternrefTable0(ret[0]);
|
|
1585
1787
|
}
|
|
@@ -1627,6 +1829,9 @@ const JsWeightCacheFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
1627
1829
|
const Sha256HasherFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1628
1830
|
? { register: () => {}, unregister: () => {} }
|
|
1629
1831
|
: new FinalizationRegistry(ptr => wasm.__wbg_sha256hasher_free(ptr, 1));
|
|
1832
|
+
const WasmImageModelFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1833
|
+
? { register: () => {}, unregister: () => {} }
|
|
1834
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmimagemodel_free(ptr, 1));
|
|
1630
1835
|
const WasmModelFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1631
1836
|
? { register: () => {}, unregister: () => {} }
|
|
1632
1837
|
: new FinalizationRegistry(ptr => wasm.__wbg_wasmmodel_free(ptr, 1));
|
|
Binary file
|
|
@@ -4,6 +4,7 @@ export const memory: WebAssembly.Memory;
|
|
|
4
4
|
export const __wbg_jssource_free: (a: number, b: number) => void;
|
|
5
5
|
export const __wbg_jsweightcache_free: (a: number, b: number) => void;
|
|
6
6
|
export const __wbg_sha256hasher_free: (a: number, b: number) => void;
|
|
7
|
+
export const __wbg_wasmimagemodel_free: (a: number, b: number) => void;
|
|
7
8
|
export const __wbg_wasmmodel_free: (a: number, b: number) => void;
|
|
8
9
|
export const __wbg_wasmsession_free: (a: number, b: number) => void;
|
|
9
10
|
export const buildInfo: () => [number, number, number];
|
|
@@ -13,20 +14,29 @@ export const parseSafetensorsHeader: (a: number, b: number) => [number, number,
|
|
|
13
14
|
export const sha256hasher_finish: (a: number) => [number, number];
|
|
14
15
|
export const sha256hasher_new: () => number;
|
|
15
16
|
export const sha256hasher_update: (a: number, b: number, c: number) => void;
|
|
17
|
+
export const supportedEncoderTypes: () => [number, number];
|
|
16
18
|
export const supportedModelTypes: () => [number, number];
|
|
19
|
+
export const supportedSpeechTypes: () => [number, number];
|
|
17
20
|
export const version: () => [number, number];
|
|
21
|
+
export const wasmimagemodel_generate: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
|
|
22
|
+
export const wasmimagemodel_info: (a: number) => [number, number, number];
|
|
23
|
+
export const wasmimagemodel_load: (a: number, b: number, c: number, d: number) => any;
|
|
18
24
|
export const wasmmodel_applyAdapter: (a: number, b: number, c: number, d: number) => any;
|
|
19
25
|
export const wasmmodel_chat: (a: number, b: number, c: number, d: number, e: number, f: any, g: number) => any;
|
|
20
26
|
export const wasmmodel_chatWithMedia: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: any, k: number) => any;
|
|
21
27
|
export const wasmmodel_createSession: (a: number) => [number, number, number];
|
|
22
28
|
export const wasmmodel_detokenize: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
29
|
+
export const wasmmodel_embed: (a: number, b: number, c: number, d: number, e: number) => any;
|
|
23
30
|
export const wasmmodel_generate: (a: number, b: number, c: number, d: number, e: number, f: any, g: number) => any;
|
|
24
31
|
export const wasmmodel_info: (a: number) => [number, number, number];
|
|
32
|
+
export const wasmmodel_isEncoder: (a: number) => number;
|
|
33
|
+
export const wasmmodel_isSpeech: (a: number) => number;
|
|
25
34
|
export const wasmmodel_load: (a: number, b: number, c: number, d: number, e: number) => any;
|
|
26
35
|
export const wasmmodel_removeAdapter: (a: number) => any;
|
|
27
36
|
export const wasmmodel_renderChat: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
28
37
|
export const wasmmodel_reset: (a: number) => [number, number];
|
|
29
38
|
export const wasmmodel_tokenize: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
39
|
+
export const wasmmodel_transcribe: (a: number, b: any, c: number, d: number, e: number) => any;
|
|
30
40
|
export const wasmsession_capacity: (a: number) => [number, number, number];
|
|
31
41
|
export const wasmsession_chat: (a: number, b: number, c: number, d: number, e: number, f: any, g: number) => any;
|
|
32
42
|
export const wasmsession_chatWithMedia: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: any, k: number) => any;
|
|
@@ -44,10 +54,10 @@ export const wasmsession_truncate: (a: number, b: number) => [number, number];
|
|
|
44
54
|
export const wasm_bindgen_8cf186fa7724d16d___convert__closures_____invoke___js_sys_56365fc49d784db6___Function_fn_wasm_bindgen_8cf186fa7724d16d___JsValue_____wasm_bindgen_8cf186fa7724d16d___sys__Undefined___js_sys_56365fc49d784db6___Function_fn_wasm_bindgen_8cf186fa7724d16d___JsValue_____wasm_bindgen_8cf186fa7724d16d___sys__Undefined_______true_: (a: number, b: number, c: any, d: any) => void;
|
|
45
55
|
export const wasm_bindgen_8cf186fa7724d16d___convert__closures_____invoke___wasm_bindgen_8cf186fa7724d16d___JsValue__core_608f92abc48d28da___result__Result_____wasm_bindgen_8cf186fa7724d16d___JsError___true_: (a: number, b: number, c: any) => [number, number];
|
|
46
56
|
export const 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_: (a: number, b: number, c: any) => [number, number];
|
|
47
|
-
export const
|
|
48
|
-
export const
|
|
57
|
+
export const 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__49: (a: number, b: number, c: any) => [number, number];
|
|
58
|
+
export const 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__50: (a: number, b: number, c: any) => [number, number];
|
|
49
59
|
export const wasm_bindgen_8cf186fa7724d16d___convert__closures_____invoke___wgpu_54917290532eaf6b___backend__webgpu__webgpu_sys__gen_GpuDeviceLostInfo__GpuDeviceLostInfo______true_: (a: number, b: number, c: any) => void;
|
|
50
|
-
export const
|
|
60
|
+
export const wasm_bindgen_8cf186fa7724d16d___convert__closures_____invoke___wgpu_54917290532eaf6b___backend__webgpu__webgpu_sys__gen_GpuDeviceLostInfo__GpuDeviceLostInfo______true__48: (a: number, b: number, c: any) => void;
|
|
51
61
|
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
52
62
|
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
53
63
|
export const __wbindgen_exn_store: (a: number) => void;
|