webslm 0.12.0 → 0.12.2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # webslm
2
2
 
3
- Run small language models in the browser and in Node, straight from their original Hugging Face checkpoints. A Rust engine compiled to WebAssembly reads `config.json`, `tokenizer.json`, the chat template and the `*.safetensors` weights as published, with no conversion step.
3
+ Run small language and vision-language models (and small embedding, speech recognition and text-to-image models) in the browser and in Node, straight from their original Hugging Face checkpoints. A Rust engine compiled to WebAssembly reads `config.json`, `tokenizer.json`, the chat template and the `*.safetensors` weights as published, with no conversion step.
4
4
 
5
5
  ```sh
6
6
  npm install webslm
@@ -18,8 +18,9 @@ The first call downloads the default model ([LFM2.5 350M](https://huggingface.co
18
18
  - Downloads a checkpoint once into the Origin Private File System (a directory in Node), resumes interrupted downloads, checks the Hub's SHA-256 and loads offline afterwards.
19
19
  - Streams answers, keeps conversations, and exposes a low-level session API (teacher-forced scoring, step-wise decoding, logits and hidden states as `Float32Array`s).
20
20
  - Searches the Hub for models it can run.
21
+ - Answers about [images and video](#images-and-video), [embeds](#embeddings) texts, [transcribes](#speech-recognition) speech, [generates images](#image-generation) and [trains](#training) LoRA adapters on the device.
21
22
 
22
- Supported architectures: Llama-style (SmolLM2, Mistral), Qwen2, Qwen3, Qwen3.5 (language model; Gated DeltaNet hybrid), LFM2 / LFM2.5 and LFM3. Models run on WebGPU or on the CPU through WebAssembly (SIMD, and Web Worker threads where the page allows): with `device: "auto"` (the default), WebGPU for models above ~100M parameters when the browser has an adapter, the CPU otherwise; `ModelInfo.backend` says which one runs. In Node and Bun, the [native engine](#native-engine-in-node) runs instead (downloaded once from the release, checked, and cached): native SIMD kernels on every core, and the GPU through Metal, Vulkan or DX12. ESM only; browsers with WebAssembly SIMD (every current browser). Demo: <https://maxgfr.github.io/webslm/>.
23
+ Supported architectures: Llama-style (SmolLM2, Mistral), Qwen2, Qwen3, Qwen3.5 (Gated DeltaNet hybrid, with its vision encoder), LFM2 / LFM2.5 and LFM3; the vision-language models SmolVLM / SmolVLM2 and LFM2-VL / LFM2.5-VL; the encoders BERT / MiniLM, ModernBERT and model2vec; Whisper; and Stable Diffusion style UNets (SDXS) and Sana-Sprint for image generation. Models run on WebGPU or on the CPU through WebAssembly (SIMD, and Web Worker threads where the page allows): with `device: "auto"` (the default), WebGPU for models above ~100M parameters when the browser has an adapter, the CPU otherwise; `ModelInfo.backend` says which one runs. In Node and Bun, the [native engine](#native-engine-in-node) runs instead (downloaded once from the release, checked, and cached): native SIMD kernels on every core, and the GPU through Metal, Vulkan or DX12. ESM only; browsers with WebAssembly SIMD (every current browser). Demo: <https://maxgfr.github.io/webslm/>.
23
24
 
24
25
  ## Ask
25
26
 
@@ -609,7 +610,7 @@ export default defineConfig({
609
610
  });
610
611
  ```
611
612
 
612
- Server code that imports webslm must not be bundled: webslm runs from its own files in `node_modules` (Next.js: `serverExternalPackages: ["webslm"]`). Without a bundler, a page can import it from jsDelivr (`https://cdn.jsdelivr.net/npm/webslm@0.12.0/dist/index.js`); webslm starts its workers through same-origin `blob:` workers when its files come from another origin. Guides for Next.js, Vite, webpack, Node servers, Bun, Deno and CDNs, each with a tested example: <https://github.com/maxgfr/webslm#frameworks-bundlers-and-runtimes>.
613
+ Server code that imports webslm must not be bundled: webslm runs from its own files in `node_modules` (Next.js: `serverExternalPackages: ["webslm"]`). Without a bundler, a page can import it from jsDelivr (`https://cdn.jsdelivr.net/npm/webslm@0.12.2/dist/index.js`); webslm starts its workers through same-origin `blob:` workers when its files come from another origin. Guides for Next.js, Vite, webpack, Node servers, Bun, Deno and CDNs, each with a tested example: <https://github.com/maxgfr/webslm#frameworks-bundlers-and-runtimes>.
613
614
 
614
615
  ## Errors
615
616
 
@@ -1,47 +1,47 @@
1
1
  {
2
- "version": "0.12.0",
2
+ "version": "0.12.2",
3
3
  "assets": {
4
4
  "darwin-arm64": {
5
- "file": "webslm-node-0.12.0-darwin-arm64.node.gz",
6
- "size": 6140716,
7
- "sha256": "82fabc24d852f30164262e4464ccaf66d7fbb9d8f15036741f0a329e809eeac6",
8
- "nodeSha256": "214c12103f111e26b6d9e723d05b94f2e9a921fad40b0acccbbaa361488aedc7"
5
+ "file": "webslm-node-0.12.2-darwin-arm64.node.gz",
6
+ "size": 6151637,
7
+ "sha256": "281a6d243e71f755afe17f9e4b423e8b699e07a00d8f59fe435858b83ad2a73a",
8
+ "nodeSha256": "147a3d50e0445f292143796bc1444fc1b4a7fb07d49cce712af0204e959db8d3"
9
9
  },
10
10
  "darwin-x64": {
11
- "file": "webslm-node-0.12.0-darwin-x64.node.gz",
12
- "size": 6499071,
13
- "sha256": "2c83db8c7305481ca92aa1652ae9bd5023a812beed0017cf2ddc8c97fb4d7820",
14
- "nodeSha256": "b34c7d90d43a2eed6cd5626b0359c3fa6f0b9141ec5a4df3cff80012bdaf1e38"
11
+ "file": "webslm-node-0.12.2-darwin-x64.node.gz",
12
+ "size": 6516418,
13
+ "sha256": "62fe740454dd9f5447105398cad98328fd7741c1f5de870cdfcde0609ae0f9fa",
14
+ "nodeSha256": "da63c5c39b53b8507a58c4498ea2583f905a079de1e26fd98510b51dd408500c"
15
15
  },
16
16
  "linux-x64-gnu": {
17
- "file": "webslm-node-0.12.0-linux-x64-gnu.node.gz",
18
- "size": 6512134,
19
- "sha256": "210abd09d68e933b7323a0319ba51558006dab011d935a5d6e20db5312f1835c",
20
- "nodeSha256": "bf31ad28980cf3890af93c706f262cf16208b704114869236ce5219b0cd4e588"
17
+ "file": "webslm-node-0.12.2-linux-x64-gnu.node.gz",
18
+ "size": 6523043,
19
+ "sha256": "8ff1d8dba2dcfe81f0c6e80a01f882c113d4755957dc42c32f44678188623a9f",
20
+ "nodeSha256": "04c6a73e55a7056c160c02302392cbd55307d6409041f8aa8b568f577a89a7d1"
21
21
  },
22
22
  "linux-arm64-gnu": {
23
- "file": "webslm-node-0.12.0-linux-arm64-gnu.node.gz",
24
- "size": 6106673,
25
- "sha256": "6904daf73a001100becd269f7d34c7d04db995194d2f2e66ebbbcb731cee8a7f",
26
- "nodeSha256": "86beb6444acb5a413f14d782deccea94b9ae8cb4c1a31ff1aa0ede856a89b0c8"
23
+ "file": "webslm-node-0.12.2-linux-arm64-gnu.node.gz",
24
+ "size": 6111140,
25
+ "sha256": "c8137e2482f737dcac4d0e7c928f95ab4fdad7738c6672640e521ef78775700d",
26
+ "nodeSha256": "8aa39b663d61948cc9fbb085baca1fc0e388021bae43d18e5295ebe98886a1cf"
27
27
  },
28
28
  "linux-x64-musl": {
29
- "file": "webslm-node-0.12.0-linux-x64-musl.node.gz",
30
- "size": 6939402,
31
- "sha256": "25fdbec04d3bfd53a1134975c6d71a422515a4326c5dfc4cd7fd63bd9e11736a",
32
- "nodeSha256": "97b7acd9fd0e0c65ec39f694faa44e3d7f4ba59bfa34dc1552e16e6f3eb52bbf"
29
+ "file": "webslm-node-0.12.2-linux-x64-musl.node.gz",
30
+ "size": 6950263,
31
+ "sha256": "8f979247e57750d109be24e588cabd596a814400bbb733382f4f748a652fbad4",
32
+ "nodeSha256": "f5fe2429349ea1cbb7ae79b31e4bb9127d3955efa23f35b33e7a1053e03084cc"
33
33
  },
34
34
  "linux-arm64-musl": {
35
- "file": "webslm-node-0.12.0-linux-arm64-musl.node.gz",
36
- "size": 6661808,
37
- "sha256": "a71f54029461a8d4b4bdff84f4e17318061314ba5c46e6b2a3468e2b8831ae83",
38
- "nodeSha256": "cfc9475765b25e0a033d52286347054bb74c19d8c30fd306462b600012ab837d"
35
+ "file": "webslm-node-0.12.2-linux-arm64-musl.node.gz",
36
+ "size": 6673702,
37
+ "sha256": "19fd3424417629c12e25a62f3698950d439004aba1df64b98445f4a376ef16bc",
38
+ "nodeSha256": "3b26f6d8291f64e438130cd95a92c5a71e208d9d0832728ce3f8e322698ac701"
39
39
  },
40
40
  "win32-x64-msvc": {
41
- "file": "webslm-node-0.12.0-win32-x64-msvc.node.gz",
42
- "size": 7073063,
43
- "sha256": "b8184caa26f7c249e02bc9266177bf1366a2230c4c5d0a0f16cfbd8914a64bb5",
44
- "nodeSha256": "d611a4dde4770ef7df4df92424b09a1b704ea42cef8fbcbe39bddb3c972845e5"
41
+ "file": "webslm-node-0.12.2-win32-x64-msvc.node.gz",
42
+ "size": 7079854,
43
+ "sha256": "596c0de00abc339ac33895f630b6d33bfb3e7ebc447fa9b0f39a7f5a3e8c8001",
44
+ "nodeSha256": "074378a14e0f97e3952c52bd2ee13faac0fa3862bce698f083963e8b97f72bba"
45
45
  }
46
46
  }
47
47
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webslm",
3
- "version": "0.12.0",
3
+ "version": "0.12.2",
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",
Binary file
Binary file
@@ -1984,42 +1984,42 @@ function __wbg_get_imports(memory) {
1984
1984
  arg0.writeBuffer(arg1, arg2, getArrayU8FromWasm0(arg3, arg4), arg5, arg6);
1985
1985
  }, arguments); },
1986
1986
  __wbindgen_generic_0000000000000001: function(arg0, arg1) {
1987
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1055, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1987
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1058, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1988
1988
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___JsValue__core_2b10d7c4e784534e___result__Result_____wasm_bindgen_3c612a990bfab728___JsError___true_);
1989
1989
  return ret;
1990
1990
  },
1991
1991
  __wbindgen_generic_0000000000000002: function(arg0, arg1) {
1992
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1057, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1992
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1060, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1993
1993
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___js_sys_b608be85a12bc1d0___futures__task__wait_async_polyfill__MessageEvent______true_);
1994
1994
  return ret;
1995
1995
  },
1996
1996
  __wbindgen_generic_0000000000000003: function(arg0, arg1) {
1997
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 503, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1997
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 506, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1998
1998
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___JsValue______true_);
1999
1999
  return ret;
2000
2000
  },
2001
2001
  __wbindgen_generic_0000000000000004: function(arg0, arg1) {
2002
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDevice")], shim_idx: 501, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
2002
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDevice")], shim_idx: 504, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
2003
2003
  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_);
2004
2004
  return ret;
2005
2005
  },
2006
2006
  __wbindgen_generic_0000000000000005: function(arg0, arg1) {
2007
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDeviceLostInfo")], shim_idx: 503, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2007
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDeviceLostInfo")], shim_idx: 506, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2008
2008
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___JsValue______true__62);
2009
2009
  return ret;
2010
2010
  },
2011
2011
  __wbindgen_generic_0000000000000006: function(arg0, arg1) {
2012
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUUncapturedErrorEvent")], shim_idx: 503, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2012
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUUncapturedErrorEvent")], shim_idx: 506, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2013
2013
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_3c612a990bfab728___convert__closures_____invoke___wasm_bindgen_3c612a990bfab728___JsValue______true__63);
2014
2014
  return ret;
2015
2015
  },
2016
2016
  __wbindgen_generic_0000000000000007: function(arg0, arg1) {
2017
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("any")], shim_idx: 501, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
2017
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("any")], shim_idx: 504, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
2018
2018
  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);
2019
2019
  return ret;
2020
2020
  },
2021
2021
  __wbindgen_generic_0000000000000008: function(arg0, arg1) {
2022
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("undefined")], shim_idx: 501, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
2022
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("undefined")], shim_idx: 504, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
2023
2023
  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);
2024
2024
  return ret;
2025
2025
  },
Binary file