webslm 0.9.0 → 0.11.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.
@@ -373,6 +373,14 @@ export class WasmModel {
373
373
  const ret = wasm.wasmmodel_isEncoder(this.__wbg_ptr);
374
374
  return ret !== 0;
375
375
  }
376
+ /**
377
+ * Whether the model recognizes speech (it answers `transcribe`).
378
+ * @returns {boolean}
379
+ */
380
+ get isSpeech() {
381
+ const ret = wasm.wasmmodel_isSpeech(this.__wbg_ptr);
382
+ return ret !== 0;
383
+ }
376
384
  /**
377
385
  * Loads a checkpoint from `source`. `options_json` is a JSON object:
378
386
  * `{ format?: "q8" | "q4" | "q4_0" | "f32" | "f16" | "bf16",
@@ -501,6 +509,29 @@ export class WasmModel {
501
509
  wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
502
510
  return v2;
503
511
  }
512
+ /**
513
+ * Transcribes speech with a speech recognition model (Whisper).
514
+ * `audio` is mono PCM (`Float32Array`, at `sampleRate`, 16 kHz by
515
+ * default) or the bytes of a WAV file (`Uint8Array`; browsers decode
516
+ * other formats with `AudioContext` first). `options_json`:
517
+ * `{ language?: string, task?: "transcribe" | "translate",
518
+ * maxNewTokens?: number, sampleRate?: number }` (no language: detected).
519
+ * `on_text(text)` receives the text as it is generated and stops the
520
+ * transcription by returning `false` (or a promise resolving to
521
+ * `false`). Resolves to `{ text, language,
522
+ * duration, segments: [{ id, start, end, text, tokens }], tokens,
523
+ * stopped }`. Rejects with `UNSUPPORTED_TASK` on other models.
524
+ * @param {any} audio
525
+ * @param {string} options_json
526
+ * @param {Function | null} [on_text]
527
+ * @returns {Promise<any>}
528
+ */
529
+ transcribe(audio, options_json, on_text) {
530
+ const ptr0 = passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
531
+ const len0 = WASM_VECTOR_LEN;
532
+ const ret = wasm.wasmmodel_transcribe(this.__wbg_ptr, audio, ptr0, len0, isLikeNone(on_text) ? 0 : addToExternrefTable0(on_text));
533
+ return ret;
534
+ }
504
535
  }
505
536
  if (Symbol.dispose) WasmModel.prototype[Symbol.dispose] = WasmModel.prototype.free;
506
537
 
@@ -749,6 +780,135 @@ export class WasmSession {
749
780
  }
750
781
  if (Symbol.dispose) WasmSession.prototype[Symbol.dispose] = WasmSession.prototype.free;
751
782
 
783
+ /**
784
+ * A model being trained.
785
+ */
786
+ export class WasmTrainer {
787
+ static __wrap(ptr) {
788
+ const obj = Object.create(WasmTrainer.prototype);
789
+ obj.__wbg_ptr = ptr;
790
+ WasmTrainerFinalization.register(obj, obj.__wbg_ptr, obj);
791
+ return obj;
792
+ }
793
+ __destroy_into_raw() {
794
+ const ptr = this.__wbg_ptr;
795
+ this.__wbg_ptr = 0;
796
+ WasmTrainerFinalization.unregister(this);
797
+ return ptr;
798
+ }
799
+ free() {
800
+ const ptr = this.__destroy_into_raw();
801
+ wasm.__wbg_wasmtrainer_free(ptr, 0);
802
+ }
803
+ /**
804
+ * Adds a sequence to group `group`: `teacher` is `"none"`, `"base"`,
805
+ * `"topk"` (`k` ids and probabilities per prediction) or `"logits"`.
806
+ * @param {number} group
807
+ * @param {Uint32Array} ids
808
+ * @param {Float32Array | null | undefined} weights
809
+ * @param {string} teacher
810
+ * @param {number} k
811
+ * @param {Uint32Array | null} [teacher_ids]
812
+ * @param {Float32Array | null} [teacher_values]
813
+ */
814
+ addExample(group, ids, weights, teacher, k, teacher_ids, teacher_values) {
815
+ const ptr0 = passArray32ToWasm0(ids, wasm.__wbindgen_malloc);
816
+ const len0 = WASM_VECTOR_LEN;
817
+ var ptr1 = isLikeNone(weights) ? 0 : passArrayF32ToWasm0(weights, wasm.__wbindgen_malloc);
818
+ var len1 = WASM_VECTOR_LEN;
819
+ const ptr2 = passStringToWasm0(teacher, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
820
+ const len2 = WASM_VECTOR_LEN;
821
+ var ptr3 = isLikeNone(teacher_ids) ? 0 : passArray32ToWasm0(teacher_ids, wasm.__wbindgen_malloc);
822
+ var len3 = WASM_VECTOR_LEN;
823
+ var ptr4 = isLikeNone(teacher_values) ? 0 : passArrayF32ToWasm0(teacher_values, wasm.__wbindgen_malloc);
824
+ var len4 = WASM_VECTOR_LEN;
825
+ const ret = wasm.wasmtrainer_addExample(this.__wbg_ptr, group, ptr0, len0, ptr1, len1, ptr2, len2, k, ptr3, len3, ptr4, len4);
826
+ if (ret[1]) {
827
+ throw takeFromExternrefTable0(ret[0]);
828
+ }
829
+ }
830
+ /**
831
+ * Adds a data group (`TrainGroupJs`: `{ batchSize?, weight?, ce?,
832
+ * kl?, reduction?, sampling?, sampleWeights? }`); returns its index.
833
+ * Groups take effect at [`WasmTrainer::commit`].
834
+ * @param {string} group_json
835
+ * @returns {number}
836
+ */
837
+ addGroup(group_json) {
838
+ const ptr0 = passStringToWasm0(group_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
839
+ const len0 = WASM_VECTOR_LEN;
840
+ const ret = wasm.wasmtrainer_addGroup(this.__wbg_ptr, ptr0, len0);
841
+ if (ret[2]) {
842
+ throw takeFromExternrefTable0(ret[1]);
843
+ }
844
+ return ret[0] >>> 0;
845
+ }
846
+ /**
847
+ * Sets the groups added so far as the data steps draw from (replacing
848
+ * earlier ones).
849
+ */
850
+ commit() {
851
+ const ret = wasm.wasmtrainer_commit(this.__wbg_ptr);
852
+ if (ret[1]) {
853
+ throw takeFromExternrefTable0(ret[0]);
854
+ }
855
+ }
856
+ /**
857
+ * The trained delta as files, `{ [name]: Uint8Array }`: `format`
858
+ * `"peft"` (default: `adapter_config.json` and
859
+ * `adapter_model.safetensors`) or `"dense"` (`delta.safetensors`).
860
+ * `base_model` fills `base_model_name_or_path`.
861
+ * @param {string | null} [format]
862
+ * @param {string | null} [base_model]
863
+ * @returns {Promise<any>}
864
+ */
865
+ files(format, base_model) {
866
+ var ptr0 = isLikeNone(format) ? 0 : passStringToWasm0(format, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
867
+ var len0 = WASM_VECTOR_LEN;
868
+ var ptr1 = isLikeNone(base_model) ? 0 : passStringToWasm0(base_model, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
869
+ var len1 = WASM_VECTOR_LEN;
870
+ const ret = wasm.wasmtrainer_files(this.__wbg_ptr, ptr0, len0, ptr1, len1);
871
+ return ret;
872
+ }
873
+ /**
874
+ * Describes the trainer (see `TrainerInfo`).
875
+ * @returns {any}
876
+ */
877
+ info() {
878
+ const ret = wasm.wasmtrainer_info(this.__wbg_ptr);
879
+ if (ret[2]) {
880
+ throw takeFromExternrefTable0(ret[1]);
881
+ }
882
+ return takeFromExternrefTable0(ret[0]);
883
+ }
884
+ /**
885
+ * Loads the model of `source` for training. `options_json`: see
886
+ * `TrainOptionsJs` (`{ steps, method?, rank?, alpha?, targets?,
887
+ * layers?, lr?, ..., device? }`).
888
+ * @param {JsSource} source
889
+ * @param {string} options_json
890
+ * @returns {Promise<WasmTrainer>}
891
+ */
892
+ static load(source, options_json) {
893
+ _assertClass(source, JsSource);
894
+ var ptr0 = source.__destroy_into_raw();
895
+ const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
896
+ const len1 = WASM_VECTOR_LEN;
897
+ const ret = wasm.wasmtrainer_load(ptr0, ptr1, len1);
898
+ return ret;
899
+ }
900
+ /**
901
+ * Runs one optimizer step; resolves to `{ step, lr, loss,
902
+ * groupLosses, tokens, clamped, timeMs }`.
903
+ * @returns {Promise<any>}
904
+ */
905
+ step() {
906
+ const ret = wasm.wasmtrainer_step(this.__wbg_ptr);
907
+ return ret;
908
+ }
909
+ }
910
+ if (Symbol.dispose) WasmTrainer.prototype[Symbol.dispose] = WasmTrainer.prototype.free;
911
+
752
912
  /**
753
913
  * How this module was built: `{ flavour, kernels, threads }`. `flavour`
754
914
  * is `"simd"`, `"relaxed"` (SIMD128 and relaxed SIMD) or `"threads"`
@@ -829,6 +989,18 @@ export function supportedModelTypes() {
829
989
  return v1;
830
990
  }
831
991
 
992
+ /**
993
+ * `model_type` values of the speech recognition models this build runs
994
+ * (models whose `WasmModel` answers `transcribe`).
995
+ * @returns {string[]}
996
+ */
997
+ export function supportedSpeechTypes() {
998
+ const ret = wasm.supportedSpeechTypes();
999
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]);
1000
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1001
+ return v1;
1002
+ }
1003
+
832
1004
  /**
833
1005
  * Version of the Rust engine, as declared in `Cargo.toml`.
834
1006
  * @returns {string}
@@ -1115,6 +1287,16 @@ function __wbg_get_imports(memory) {
1115
1287
  const ret = result;
1116
1288
  return ret;
1117
1289
  },
1290
+ __wbg_instanceof_Float32Array_31e80d3e88752523: function(arg0) {
1291
+ let result;
1292
+ try {
1293
+ result = arg0 instanceof Float32Array;
1294
+ } catch (_) {
1295
+ result = false;
1296
+ }
1297
+ const ret = result;
1298
+ return ret;
1299
+ },
1118
1300
  __wbg_instanceof_GpuOutOfMemoryError_829d8185d83170f0: function(arg0) {
1119
1301
  let result;
1120
1302
  try {
@@ -1188,6 +1370,10 @@ function __wbg_get_imports(memory) {
1188
1370
  const ret = arg0.length;
1189
1371
  return ret;
1190
1372
  },
1373
+ __wbg_length_8768c6f6941913e3: function(arg0) {
1374
+ const ret = arg0.length;
1375
+ return ret;
1376
+ },
1191
1377
  __wbg_limits_f4203404018656d1: function(arg0) {
1192
1378
  const ret = arg0.limits;
1193
1379
  return ret;
@@ -1438,6 +1624,10 @@ function __wbg_get_imports(memory) {
1438
1624
  const ret = new Worker(getStringFromWasm0(arg0, arg1));
1439
1625
  return ret;
1440
1626
  },
1627
+ __wbg_now_d1fb6650485d7f3e: function() {
1628
+ const ret = Date.now();
1629
+ return ret;
1630
+ },
1441
1631
  __wbg_of_d9a05aa72bb023a2: function(arg0, arg1, arg2) {
1442
1632
  const ret = Array.of(arg0, arg1, arg2);
1443
1633
  return ret;
@@ -1453,6 +1643,9 @@ function __wbg_get_imports(memory) {
1453
1643
  __wbg_postMessage_8105a302ed002474: function() { return handleError(function (arg0, arg1) {
1454
1644
  arg0.postMessage(arg1);
1455
1645
  }, arguments); },
1646
+ __wbg_prototypesetcall_804a1eb1b047ccb9: function(arg0, arg1, arg2) {
1647
+ Float32Array.prototype.set.call(getArrayF32FromWasm0(arg0, arg1), arg2);
1648
+ },
1456
1649
  __wbg_prototypesetcall_ae9f5e7459250748: function(arg0, arg1, arg2) {
1457
1650
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
1458
1651
  },
@@ -1782,47 +1975,51 @@ function __wbg_get_imports(memory) {
1782
1975
  const ret = WasmModel.__wrap(arg0);
1783
1976
  return ret;
1784
1977
  },
1978
+ __wbg_wasmtrainer_new: function(arg0) {
1979
+ const ret = WasmTrainer.__wrap(arg0);
1980
+ return ret;
1981
+ },
1785
1982
  __wbg_writeBuffer_badef58fae6c9543: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
1786
1983
  arg0.writeBuffer(arg1, arg2, getArrayU8FromWasm0(arg3, arg4), arg5, arg6);
1787
1984
  }, arguments); },
1788
1985
  __wbindgen_generic_0000000000000001: function(arg0, arg1) {
1789
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 434, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1790
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___JsValue______true_);
1986
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1026, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1987
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___JsValue__core_2b10d7c4e784534e___result__Result_____wasm_bindgen_3c612a990bfab728___JsError___true_);
1791
1988
  return ret;
1792
1989
  },
1793
1990
  __wbindgen_generic_0000000000000002: function(arg0, arg1) {
1794
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 981, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1795
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___JsValue__core_2b10d7c4e784534e___result__Result_____wasm_bindgen_3c612a990bfab728___JsError___true_);
1991
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1028, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1992
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___js_sys_b608be85a12bc1d0___futures__task__wait_async_polyfill__MessageEvent______true_);
1796
1993
  return ret;
1797
1994
  },
1798
1995
  __wbindgen_generic_0000000000000003: function(arg0, arg1) {
1799
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 983, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1800
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___js_sys_b608be85a12bc1d0___futures__task__wait_async_polyfill__MessageEvent______true_);
1996
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 474, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1997
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___JsValue______true_);
1801
1998
  return ret;
1802
1999
  },
1803
2000
  __wbindgen_generic_0000000000000004: function(arg0, arg1) {
1804
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDevice")], shim_idx: 432, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
2001
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDevice")], shim_idx: 472, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1805
2002
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___sys__JsNullable_wgpu_4ecf802b864e9046___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_2b10d7c4e784534e___result__Result_____wasm_bindgen_3c612a990bfab728___JsError___true_);
1806
2003
  return ret;
1807
2004
  },
1808
2005
  __wbindgen_generic_0000000000000005: function(arg0, arg1) {
1809
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDeviceLostInfo")], shim_idx: 434, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1810
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___JsValue______true__52);
2006
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDeviceLostInfo")], shim_idx: 474, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2007
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___JsValue______true__62);
1811
2008
  return ret;
1812
2009
  },
1813
2010
  __wbindgen_generic_0000000000000006: function(arg0, arg1) {
1814
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUUncapturedErrorEvent")], shim_idx: 434, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1815
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___JsValue______true__53);
2011
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUUncapturedErrorEvent")], shim_idx: 474, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2012
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___JsValue______true__63);
1816
2013
  return ret;
1817
2014
  },
1818
2015
  __wbindgen_generic_0000000000000007: function(arg0, arg1) {
1819
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("any")], shim_idx: 432, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1820
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___sys__JsNullable_wgpu_4ecf802b864e9046___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_2b10d7c4e784534e___result__Result_____wasm_bindgen_3c612a990bfab728___JsError___true__54);
2016
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("any")], shim_idx: 472, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
2017
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___sys__JsNullable_wgpu_4ecf802b864e9046___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_2b10d7c4e784534e___result__Result_____wasm_bindgen_3c612a990bfab728___JsError___true__64);
1821
2018
  return ret;
1822
2019
  },
1823
2020
  __wbindgen_generic_0000000000000008: function(arg0, arg1) {
1824
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("undefined")], shim_idx: 432, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1825
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___sys__JsNullable_wgpu_4ecf802b864e9046___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_2b10d7c4e784534e___result__Result_____wasm_bindgen_3c612a990bfab728___JsError___true__55);
2021
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("undefined")], shim_idx: 472, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
2022
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___sys__JsNullable_wgpu_4ecf802b864e9046___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_2b10d7c4e784534e___result__Result_____wasm_bindgen_3c612a990bfab728___JsError___true__65);
1826
2023
  return ret;
1827
2024
  },
1828
2025
  __wbindgen_generic_0000000000000009: function(arg0) {
@@ -1876,20 +2073,20 @@ function __wbg_get_imports(memory) {
1876
2073
  };
1877
2074
  }
1878
2075
 
1879
- function wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___JsValue______true_(arg0, arg1, arg2) {
1880
- wasm.wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___JsValue______true_(arg0, arg1, arg2);
1881
- }
1882
-
1883
2076
  function wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___js_sys_b608be85a12bc1d0___futures__task__wait_async_polyfill__MessageEvent______true_(arg0, arg1, arg2) {
1884
2077
  wasm.wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___js_sys_b608be85a12bc1d0___futures__task__wait_async_polyfill__MessageEvent______true_(arg0, arg1, arg2);
1885
2078
  }
1886
2079
 
1887
- function wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___JsValue______true__52(arg0, arg1, arg2) {
1888
- wasm.wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___JsValue______true__52(arg0, arg1, arg2);
2080
+ function wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___JsValue______true_(arg0, arg1, arg2) {
2081
+ wasm.wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___JsValue______true_(arg0, arg1, arg2);
1889
2082
  }
1890
2083
 
1891
- function wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___JsValue______true__53(arg0, arg1, arg2) {
1892
- wasm.wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___JsValue______true__53(arg0, arg1, arg2);
2084
+ function wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___JsValue______true__62(arg0, arg1, arg2) {
2085
+ wasm.wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___JsValue______true__62(arg0, arg1, arg2);
2086
+ }
2087
+
2088
+ function wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___JsValue______true__63(arg0, arg1, arg2) {
2089
+ wasm.wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___JsValue______true__63(arg0, arg1, arg2);
1893
2090
  }
1894
2091
 
1895
2092
  function wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___JsValue__core_2b10d7c4e784534e___result__Result_____wasm_bindgen_3c612a990bfab728___JsError___true_(arg0, arg1, arg2) {
@@ -1906,15 +2103,15 @@ function wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bin
1906
2103
  }
1907
2104
  }
1908
2105
 
1909
- function wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___sys__JsNullable_wgpu_4ecf802b864e9046___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_2b10d7c4e784534e___result__Result_____wasm_bindgen_3c612a990bfab728___JsError___true__54(arg0, arg1, arg2) {
1910
- const ret = wasm.wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___sys__JsNullable_wgpu_4ecf802b864e9046___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_2b10d7c4e784534e___result__Result_____wasm_bindgen_3c612a990bfab728___JsError___true__54(arg0, arg1, arg2);
2106
+ function wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___sys__JsNullable_wgpu_4ecf802b864e9046___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_2b10d7c4e784534e___result__Result_____wasm_bindgen_3c612a990bfab728___JsError___true__64(arg0, arg1, arg2) {
2107
+ const ret = wasm.wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___sys__JsNullable_wgpu_4ecf802b864e9046___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_2b10d7c4e784534e___result__Result_____wasm_bindgen_3c612a990bfab728___JsError___true__64(arg0, arg1, arg2);
1911
2108
  if (ret[1]) {
1912
2109
  throw takeFromExternrefTable0(ret[0]);
1913
2110
  }
1914
2111
  }
1915
2112
 
1916
- function wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___sys__JsNullable_wgpu_4ecf802b864e9046___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_2b10d7c4e784534e___result__Result_____wasm_bindgen_3c612a990bfab728___JsError___true__55(arg0, arg1, arg2) {
1917
- const ret = wasm.wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___sys__JsNullable_wgpu_4ecf802b864e9046___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_2b10d7c4e784534e___result__Result_____wasm_bindgen_3c612a990bfab728___JsError___true__55(arg0, arg1, arg2);
2113
+ function wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___sys__JsNullable_wgpu_4ecf802b864e9046___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_2b10d7c4e784534e___result__Result_____wasm_bindgen_3c612a990bfab728___JsError___true__65(arg0, arg1, arg2) {
2114
+ const ret = wasm.wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___sys__JsNullable_wgpu_4ecf802b864e9046___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_2b10d7c4e784534e___result__Result_____wasm_bindgen_3c612a990bfab728___JsError___true__65(arg0, arg1, arg2);
1918
2115
  if (ret[1]) {
1919
2116
  throw takeFromExternrefTable0(ret[0]);
1920
2117
  }
@@ -1971,6 +2168,9 @@ const WasmModelFinalization = (typeof FinalizationRegistry === 'undefined')
1971
2168
  const WasmSessionFinalization = (typeof FinalizationRegistry === 'undefined')
1972
2169
  ? { register: () => {}, unregister: () => {} }
1973
2170
  : new FinalizationRegistry(ptr => wasm.__wbg_wasmsession_free(ptr, 1));
2171
+ const WasmTrainerFinalization = (typeof FinalizationRegistry === 'undefined')
2172
+ ? { register: () => {}, unregister: () => {} }
2173
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmtrainer_free(ptr, 1));
1974
2174
  const wbg_rayon_PoolBuilderFinalization = (typeof FinalizationRegistry === 'undefined')
1975
2175
  ? { register: () => {}, unregister: () => {} }
1976
2176
  : new FinalizationRegistry(ptr => wasm.__wbg_wbg_rayon_poolbuilder_free(ptr, 1));
@@ -2183,6 +2383,13 @@ function passArray8ToWasm0(arg, malloc) {
2183
2383
  return ptr;
2184
2384
  }
2185
2385
 
2386
+ function passArrayF32ToWasm0(arg, malloc) {
2387
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
2388
+ getFloat32ArrayMemory0().set(arg, ptr / 4);
2389
+ WASM_VECTOR_LEN = arg.length;
2390
+ return ptr;
2391
+ }
2392
+
2186
2393
  function passStringToWasm0(arg, malloc, realloc) {
2187
2394
  if (realloc === undefined) {
2188
2395
  const buf = cachedTextEncoder.encode(arg);
Binary file
@@ -6,6 +6,7 @@ export const __wbg_sha256hasher_free: (a: number, b: number) => void;
6
6
  export const __wbg_wasmimagemodel_free: (a: number, b: number) => void;
7
7
  export const __wbg_wasmmodel_free: (a: number, b: number) => void;
8
8
  export const __wbg_wasmsession_free: (a: number, b: number) => void;
9
+ export const __wbg_wasmtrainer_free: (a: number, b: number) => void;
9
10
  export const __wbg_wbg_rayon_poolbuilder_free: (a: number, b: number) => void;
10
11
  export const buildInfo: () => [number, number, number];
11
12
  export const initThreadPool: (a: number) => any;
@@ -18,6 +19,7 @@ export const sha256hasher_update: (a: number, b: number, c: number) => void;
18
19
  export const startThreadPool: (a: number) => any;
19
20
  export const supportedEncoderTypes: () => [number, number];
20
21
  export const supportedModelTypes: () => [number, number];
22
+ export const supportedSpeechTypes: () => [number, number];
21
23
  export const version: () => [number, number];
22
24
  export const wasmimagemodel_generate: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
23
25
  export const wasmimagemodel_info: (a: number) => [number, number, number];
@@ -31,11 +33,13 @@ export const wasmmodel_embed: (a: number, b: number, c: number, d: number, e: nu
31
33
  export const wasmmodel_generate: (a: number, b: number, c: number, d: number, e: number, f: any, g: number) => any;
32
34
  export const wasmmodel_info: (a: number) => [number, number, number];
33
35
  export const wasmmodel_isEncoder: (a: number) => number;
36
+ export const wasmmodel_isSpeech: (a: number) => number;
34
37
  export const wasmmodel_load: (a: number, b: number, c: number, d: number, e: number) => any;
35
38
  export const wasmmodel_removeAdapter: (a: number) => any;
36
39
  export const wasmmodel_renderChat: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
37
40
  export const wasmmodel_reset: (a: number) => [number, number];
38
41
  export const wasmmodel_tokenize: (a: number, b: number, c: number, d: number) => [number, number, number, number];
42
+ export const wasmmodel_transcribe: (a: number, b: any, c: number, d: number, e: number) => any;
39
43
  export const wasmsession_capacity: (a: number) => [number, number, number];
40
44
  export const wasmsession_chat: (a: number, b: number, c: number, d: number, e: number, f: any, g: number) => any;
41
45
  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;
@@ -50,6 +54,13 @@ export const wasmsession_shiftContext: (a: number, b: number, c: number) => any;
50
54
  export const wasmsession_step: (a: number, b: number, c: number, d: number) => any;
51
55
  export const wasmsession_tokens: (a: number) => [number, number, number, number];
52
56
  export const wasmsession_truncate: (a: number, b: number) => [number, number];
57
+ export const wasmtrainer_addExample: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => [number, number];
58
+ export const wasmtrainer_addGroup: (a: number, b: number, c: number) => [number, number, number];
59
+ export const wasmtrainer_commit: (a: number) => [number, number];
60
+ export const wasmtrainer_files: (a: number, b: number, c: number, d: number, e: number) => any;
61
+ export const wasmtrainer_info: (a: number) => [number, number, number];
62
+ export const wasmtrainer_load: (a: number, b: number, c: number) => any;
63
+ export const wasmtrainer_step: (a: number) => any;
53
64
  export const wbg_rayon_poolbuilder_build: (a: number) => void;
54
65
  export const wbg_rayon_poolbuilder_numThreads: (a: number) => number;
55
66
  export const wbg_rayon_poolbuilder_receiver: (a: number) => number;
@@ -57,12 +68,12 @@ export const wbg_rayon_start_worker: (a: number) => void;
57
68
  export const wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___js_sys_b608be85a12bc1d0___Function_fn_wasm_bindgen_3c612a990bfab728___JsValue_____wasm_bindgen_3c612a990bfab728___sys__Undefined___js_sys_b608be85a12bc1d0___Function_fn_wasm_bindgen_3c612a990bfab728___JsValue_____wasm_bindgen_3c612a990bfab728___sys__Undefined_______true_: (a: number, b: number, c: any, d: any) => void;
58
69
  export const wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___JsValue__core_2b10d7c4e784534e___result__Result_____wasm_bindgen_3c612a990bfab728___JsError___true_: (a: number, b: number, c: any) => [number, number];
59
70
  export const wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___sys__JsNullable_wgpu_4ecf802b864e9046___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_2b10d7c4e784534e___result__Result_____wasm_bindgen_3c612a990bfab728___JsError___true_: (a: number, b: number, c: any) => [number, number];
60
- export const wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___sys__JsNullable_wgpu_4ecf802b864e9046___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_2b10d7c4e784534e___result__Result_____wasm_bindgen_3c612a990bfab728___JsError___true__54: (a: number, b: number, c: any) => [number, number];
61
- export const wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___sys__JsNullable_wgpu_4ecf802b864e9046___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_2b10d7c4e784534e___result__Result_____wasm_bindgen_3c612a990bfab728___JsError___true__55: (a: number, b: number, c: any) => [number, number];
71
+ export const wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___sys__JsNullable_wgpu_4ecf802b864e9046___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_2b10d7c4e784534e___result__Result_____wasm_bindgen_3c612a990bfab728___JsError___true__64: (a: number, b: number, c: any) => [number, number];
72
+ export const wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___sys__JsNullable_wgpu_4ecf802b864e9046___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_2b10d7c4e784534e___result__Result_____wasm_bindgen_3c612a990bfab728___JsError___true__65: (a: number, b: number, c: any) => [number, number];
62
73
  export const wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___js_sys_b608be85a12bc1d0___futures__task__wait_async_polyfill__MessageEvent______true_: (a: number, b: number, c: any) => void;
63
74
  export const wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___JsValue______true_: (a: number, b: number, c: any) => void;
64
- export const wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___JsValue______true__52: (a: number, b: number, c: any) => void;
65
- export const wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___JsValue______true__53: (a: number, b: number, c: any) => void;
75
+ export const wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___JsValue______true__62: (a: number, b: number, c: any) => void;
76
+ export const wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___JsValue______true__63: (a: number, b: number, c: any) => void;
66
77
  export const memory: WebAssembly.Memory;
67
78
  export const __wbindgen_malloc: (a: number, b: number) => number;
68
79
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;