anyformer 0.4.11 → 0.4.12
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/CHANGELOG.md +18 -0
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/backends/transformers.js +19 -2
- package/src/models.js +3 -0
- package/src/sources.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.12 — 2026-10-29
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
- transformers.js pin 4.3.1 → 4.3.2 (in step with LocalMind), which adds `model_type` `lfm3` and `lfm3_vl`.
|
|
7
|
+
- transformers back end: a graph whose last-position input is named `logits_to_keep` (LiquidAI's LFM3 ONNX export)
|
|
8
|
+
gets it fed at the session's run; transformers.js 4.3.2 feeds only `num_logits_to_keep` and stopped with "Missing
|
|
9
|
+
the following inputs". `LiquidAI/LFM3-1.7B-ONNX` now loads and generates through `chat.html` (64 tokens at
|
|
10
|
+
67 tok/s, Chrome, this Mac, 2026-10-28).
|
|
11
|
+
- transformers back end, text pipeline path: `thinking: false` by default, as on every other back end. The template
|
|
12
|
+
renders with `enable_thinking` off (through `tokenizer_encode_kwargs`), so LFM3 answers directly; `thinking: true`
|
|
13
|
+
per request turns it on. Templates without the switch ignore it.
|
|
14
|
+
- `test/browser/chat.html` takes `?dtype=` and fails a reply that contains `<think>` text.
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
- `MODELS.chat.LFM3_1_7B`: `LiquidAI/LFM3-1.7B-ONNX` on `transformers` (asked for by LocalMind for Chirag). Browser
|
|
18
|
+
chat check on 2026-10-29, Chrome, this Mac: on topic, no `<think>` text, on q4 (anyformer's pick, 1.63 GB; 82.4
|
|
19
|
+
tok/s) and on q4f16 (`dtype: 'q4f16'`, LocalMind's precision, 1.38 GB; 76.6 tok/s), the same 61-token reply.
|
|
20
|
+
|
|
3
21
|
## 0.4.11 — 2026-10-24
|
|
4
22
|
|
|
5
23
|
### Added
|
package/README.md
CHANGED
|
@@ -54,7 +54,7 @@ back end's answer: yes with an estimate (GPU bytes, disk bytes, tok/s when measu
|
|
|
54
54
|
|
|
55
55
|
| Back end | Runs | Models |
|
|
56
56
|
|---|---|---|
|
|
57
|
-
| `transformers` | transformers.js 4.3.
|
|
57
|
+
| `transformers` | transformers.js 4.3.2: text generation (Nemotron 3.5 Bolt E4B and LFM3 1.7B among them), image and audio chat (Gemma 4, Qwen3.5), embeddings, speech to text, detection, classification, depth, segmentation | ONNX repos in the onnx-community / Xenova layout |
|
|
58
58
|
| `kohra` | kohra, text-diffusion over onnxruntime-web | MDLM and BD3LM repos tagged `text-diffusion`; Nemotron-Labs-Diffusion-3B |
|
|
59
59
|
| `localmind` | LocalMind's hand-written WebGPU kernels (shipped in diskformer), the whole model on the GPU | any LFM2 / LFM2.5 GGUF; Gemma 4 E2B / E4B QAT-mobile; Ternary Bonsai 2 |
|
|
60
60
|
| `wllama` | llama.cpp in WebAssembly: WebGPU when the budget holds the model, the CPU otherwise (no WebGPU needed) | any GGUF up to about 3.6 GB that no engine above covers; files over 2 GB are split into OPFS shards once |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "anyformer",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.12",
|
|
4
4
|
"description": "One call to run a model in a browser tab: anyformer reads the Hub repo, probes the browser, and picks the back end (transformers.js, LocalMind's WebGPU kernels, diskformer, kohra) that fits the model's format, architecture and your GPU budget.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -120,16 +120,33 @@ export const transformersBackend = {
|
|
|
120
120
|
const gen = await lib.pipeline('text-generation', model.repo, {
|
|
121
121
|
device: 'webgpu', dtype, revision: model.revision || 'main', progress_callback,
|
|
122
122
|
});
|
|
123
|
+
feedLogitsToKeep(lib, gen.model);
|
|
123
124
|
signal?.throwIfAborted();
|
|
124
125
|
return {
|
|
125
126
|
task: 'text-generation',
|
|
126
|
-
|
|
127
|
-
|
|
127
|
+
// thinking: false (the default, as on every back end here) renders the template with enable_thinking off, so a
|
|
128
|
+
// model that reasons by default (LFM3) answers directly; templates without the switch ignore it.
|
|
129
|
+
generate: (messages, { maxNewTokens = 256, repetitionPenalty, signal, thinking = false } = {}) => stream(lib, gen.tokenizer, signal,
|
|
130
|
+
(streamer, stopping_criteria) => gen(messages, { max_new_tokens: maxNewTokens, do_sample: false, ...(repetitionPenalty && { repetition_penalty: repetitionPenalty }), tokenizer_encode_kwargs: { enable_thinking: thinking === true }, streamer, stopping_criteria })),
|
|
128
131
|
dispose: () => gen.dispose?.(),
|
|
129
132
|
};
|
|
130
133
|
},
|
|
131
134
|
};
|
|
132
135
|
|
|
136
|
+
// LiquidAI's LFM3 ONNX export names its last-position input logits_to_keep (shape [1]); transformers.js 4.3.2 feeds
|
|
137
|
+
// only num_logits_to_keep and stops with "Missing the following inputs: logits_to_keep". Hide the input from
|
|
138
|
+
// transformers.js's check and add it at the session's run, set to 1: generate() reads only the last position's logits.
|
|
139
|
+
// LocalMind carries the same shim (index.html feedLogitsToKeep).
|
|
140
|
+
function feedLogitsToKeep(lib, net) {
|
|
141
|
+
const sess = net?.sessions?.model;
|
|
142
|
+
if (!sess?.inputNames.includes('logits_to_keep')) return;
|
|
143
|
+
const names = sess.inputNames.filter((n) => n !== 'logits_to_keep');
|
|
144
|
+
const one = new lib.Tensor('int64', [1n], [1]).ort_tensor;
|
|
145
|
+
const run = sess.run.bind(sess);
|
|
146
|
+
Object.defineProperty(sess, 'inputNames', { value: names });
|
|
147
|
+
sess.run = (feeds, opts) => run({ ...feeds, logits_to_keep: one }, opts);
|
|
148
|
+
}
|
|
149
|
+
|
|
133
150
|
// A non-generation task: one pipeline, run(input, opts) calls it. ImageData (from a canvas) becomes a RawImage; URLs,
|
|
134
151
|
// RawImage and, for speech, 16 kHz Float32Array samples pass through as transformers.js takes them.
|
|
135
152
|
async function loadPipeline(lib, model, task, { progress_callback, signal }) {
|
package/src/models.js
CHANGED
|
@@ -20,6 +20,7 @@ const MINICPM5_2B = M('openbmb/MiniCPM5-2B-GGUF', 'wllama', 'text-generation', '
|
|
|
20
20
|
const QWEN3_0_6B_MDLM = M('naklitechie/Qwen3-0.6B-diffusion-mdlm-ONNX', 'kohra', 'text-generation', 'kohra', { downloadBytes: 1.54e9, diffusion: true });
|
|
21
21
|
const NEMOTRON_DIFFUSION_3B = M('naklitechie/Nemotron-Labs-Diffusion-3B-ONNX', 'kohra', 'text-generation', 'kohra', { downloadBytes: 2.77e9, diffusion: true, experimental: true });
|
|
22
22
|
const GEMMA4_26B_A4B = M('google/gemma-4-26B-A4B-it-qat-q4_0-gguf', 'diskformer', 'text-generation', 'diskformer-chat', { budget: 2.5e9, downloadBytes: 14.44e9 });
|
|
23
|
+
const LFM3_1_7B = M('LiquidAI/LFM3-1.7B-ONNX', 'transformers', 'text-generation', 'chat', { downloadBytes: 1.63e9 });
|
|
23
24
|
const NEMOTRON_3_5_BOLT_E4B = M('danyalmalik/NVIDIA-Nemotron-3.5-Bolt-E4B-ONNX-WebGPU', 'transformers', 'text-generation', 'transformers', { budget: 5e9, downloadBytes: 4.94e9 });
|
|
24
25
|
// A tech demo, not a gated model: 231 GB on disk (4 IQ1_M parts plus the 110.6 GB Engram side file), about 0.4 tok/s.
|
|
25
26
|
// diskformer checked one hand-written prompt through complete(); generate() renders the GGUF's chat template, which no
|
|
@@ -54,6 +55,8 @@ export const MODELS = {
|
|
|
54
55
|
GEMMA4_26B_A4B,
|
|
55
56
|
/** NVIDIA's Nemotron 3.5 Bolt E4B (dense, text only), a community q4f16 ONNX export in Gemma 4 E4B's graph. */
|
|
56
57
|
NEMOTRON_3_5_BOLT_E4B,
|
|
58
|
+
/** LiquidAI's LFM3 1.7B (dense), LiquidAI's own ONNX export; thinking off unless a request asks for it. */
|
|
59
|
+
LFM3_1_7B,
|
|
57
60
|
/** DeepSeek V4.1 Flash (763B MoE), a tech demo on diskformer's llama.cpp path: 231 GB on disk, very slow. */
|
|
58
61
|
DEEPSEEK_V4_1_FLASH,
|
|
59
62
|
},
|
package/src/sources.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// transformers.js and wllama move only by hand, in step with LocalMind's pins (plan/history.md, 2026-10-08).
|
|
5
5
|
|
|
6
6
|
export const PINS = {
|
|
7
|
-
transformers: '4.3.
|
|
7
|
+
transformers: '4.3.2', // 4.3.2 adds model_type lfm3 (LFM3 1.7B)
|
|
8
8
|
wllama: '3.4.1', // LocalMind's pin; its stream-drain workaround (src/backends/wllama.js) is for this version
|
|
9
9
|
// v0.3.1: seeded block-KV graphs (Nemotron-Labs-Diffusion-3B), chatFormat, split external data; download progress
|
|
10
10
|
// (progress_callback) and the graph files cached in Cache Storage 'kohra-models'.
|