{"id":"src_Xpuy_bSviQuAwbH7CzGKR","slug":"transformers-js","name":"Transformers.js","type":"github","url":"https://github.com/huggingface/transformers.js","orgId":"org_GDdYeYynEgCEBNBwy-m6s","productId":"prod_766UloABFcuw8w2LvR2iy","productSlug":"transformers","org":{"id":"org_GDdYeYynEgCEBNBwy-m6s","slug":"hugging-face","name":"Hugging Face"},"isPrimary":false,"isHidden":false,"discovery":"curated","fetchPriority":"low","metadata":"{\"evaluatedMethod\":\"github\",\"evaluatedAt\":\"2026-04-07T17:19:25.246Z\",\"changelogDetectedAt\":\"2026-04-07T17:29:37.248Z\",\"wellKnownSweptAt\":\"2026-10-31T06:00:36.365Z\"}","notice":null,"kind":"sdk","stars":16402,"starsFetchedAt":"2026-11-06T01:48:04.188Z","releaseCount":85,"releasesLast30Days":1,"avgReleasesPerWeek":0.2,"latestVersion":"4.3.2","latestDate":"2026-10-28T02:23:09.000Z","changelogUrl":null,"hasChangelogFile":false,"lastFetchedAt":"2026-11-06T01:48:04.188Z","lastPolledAt":"2026-11-06T01:47:53.903Z","changeDetectedAt":null,"trackingSince":"2023-05-17T17:48:51.000Z","releases":[{"id":"rel_9PmZxzHYTk6r7RA-s6yss","version":"4.3.2","type":"feature","title":"4.3.2","summary":"Added support for the LFM3 and LFM3-VL model architectures, and exposed getSupportedDevices() under env.backends.onnx. Fixed negative integer random seeds and a from_pretrained hang when external data downloads fail.","titleGenerated":"Transformers.js 4.3.2 adds LFM3 and LFM3-VL support","titleShort":"LFM3 and LFM3-VL supported; download hang fixed","breaking":"none","importance":2,"content":"## What's new?\r\n* Add support for LFM3 and LFM3-VL by @xenova in https://github.com/huggingface/transformers.js/pull/1821\r\n* test: stabilize Whisper, Idefics3, and tokenizer CI timeouts by @nico-martin in https://github.com/huggingface/transformers.js/pull/1808\r\n* Expose getSupportedDevices() under env.backends.onnx by @Amarnath10i in https://github.com/huggingface/transformers.js/pull/1753\r\n* Fix negative integer random seeds by @original4422 in https://github.com/huggingface/transformers.js/pull/1798\r\n* fix: external data download failure no longer hangs from_pretrained by @iamdgarcia in https://github.com/huggingface/transformers.js/pull/1804\r\n\r\n## New contributors\r\n* @Amarnath10i made their first contribution in https://github.com/huggingface/transformers.js/pull/1753\r\n* @original4422 made their first contribution in https://github.com/huggingface/transformers.js/pull/1798\r\n* @iamdgarcia made their first contribution in https://github.com/huggingface/transformers.js/pull/1804\r\n\r\n**Full Changelog**: https://github.com/huggingface/transformers.js/compare/4.3.1...4.3.2","publishedAt":"2026-10-28T02:23:09.000Z","fetchedAt":"2026-10-28T05:18:22.249Z","url":"https://github.com/huggingface/transformers.js/releases/tag/4.3.2","media":[],"coverageCount":0},{"id":"rel_IidBNyYPcyrXhWAnMLlDR","version":"4.3.1","type":"feature","title":"4.3.1","summary":"Adds support for EmbeddingGemma 2, an open multimodal embedding model that maps text, images, video, and audio into a single unified 768-dimensional vector space. Text search works via the feature-extraction pipeline, while other modalities use AutoProcessor and AutoModel directly, with all inputs comparable through cosine similarity.","titleGenerated":"Transformers.js 4.3.1 adds EmbeddingGemma 2 multimodal embeddings","titleShort":"EmbeddingGemma 2 lands in Transformers.js","breaking":"none","importance":3,"content":"## What's new?\r\n\r\nThis release adds support for [EmbeddingGemma 2](https://huggingface.co/onnx-community/embeddinggemma-2-ONNX). **EmbeddingGemma 2** is an open multimodal embedding model built by Google DeepMind which maps text (incl. code), images, video, and audio inputs—and combinations thereof—into a single, unified 768-dimensional vector space. The model has 740M total parameters, combining a 270M parameter text model with modular vision (170M) and audio (300M) encoders.\r\n\r\n\r\n### Text search\r\n\r\nThe `feature-extraction` pipeline returns normalized embeddings, so the dot product of two embeddings is their cosine similarity:\r\n\r\n```js\r\nimport { pipeline, matmul } from \"@huggingface/transformers\";\r\n\r\nconst extractor = await pipeline(\"feature-extraction\", \"onnx-community/embeddinggemma-2-ONNX\", {\r\n  device: \"webgpu\", // or \"wasm\" (browser) / \"cpu\" (Node.js)\r\n  dtype: \"q4\", // see \"Choosing a dtype\" below\r\n});\r\n\r\nconst query = \"task: search result | query: Which planet is known as the Red Planet?\";\r\nconst documents = [\r\n  \"title: none | text: Venus is often called Earth's twin because of its similar size and proximity.\",\r\n  \"title: none | text: Mars, known for its reddish appearance, is often referred to as the Red Planet.\",\r\n  \"title: none | text: Jupiter, the largest planet in our solar system, has a prominent red spot.\",\r\n  \"title: none | text: Saturn, famous for its rings, is sometimes mistaken for the Red Planet.\",\r\n];\r\n\r\nconst embeddings = await extractor([query, ...documents], { pooling: \"mean\", normalize: true });\r\nconst query_embedding = embeddings.slice([0, 1]);\r\nconst document_embeddings = embeddings.slice([1, null]);\r\n\r\nconst scores = (await matmul(query_embedding, document_embeddings.transpose(1, 0))).tolist()[0];\r\nconst ranking = scores.map((score, i) => ({ score, document: documents[i] })).sort((a, b) => b.score - a.score);\r\nconsole.log(ranking);\r\n// [\r\n//   { score: 0.854, document: \"title: none | text: Mars, known for its reddish appearance, ...\" },\r\n//   { score: 0.783, document: \"title: none | text: Saturn, famous for its rings, ...\" },\r\n//   { score: 0.752, document: \"title: none | text: Jupiter, the largest planet in our solar system, ...\" },\r\n//   { score: 0.684, document: \"title: none | text: Venus is often called Earth's twin, ...\" },\r\n// ]\r\n```\r\n\r\n### Images, audio and video\r\n\r\nFor other modalities, use the processor and the model directly. Every input maps into the same embedding space, so any embedding can be compared with any other: here, text queries against an image, an audio clip and a video.\r\n\r\n```js\r\nimport { AutoModel, AutoProcessor, load_image, load_audio, load_video, cat, matmul } from \"@huggingface/transformers\";\r\n\r\nconst model_id = \"onnx-community/embeddinggemma-2-ONNX\";\r\nconst processor = await AutoProcessor.from_pretrained(model_id);\r\nconst model = await AutoModel.from_pretrained(model_id, { device: \"webgpu\", dtype: \"q4\" });\r\n\r\n// The processor takes (text, images, audio, videos)\r\nconst embed = async (...inputs) => (await model(await processor(...inputs))).sentence_embedding;\r\n\r\n// Text queries, with a task prefix (see \"Task Instruction Prefixes\" below)\r\nconst queries = [\r\n  \"task: search result | query: cats sleeping on a couch\",\r\n  \"task: search result | query: a president's speech about serving your country\",\r\n  \"task: search result | query: a turtle swimming in the ocean\",\r\n];\r\nconst query_embeddings = await embed(queries);\r\n\r\n// An image, an audio clip (mono, 16 kHz) and a video (1 frame per second)\r\nconst url = \"https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main\";\r\nconst image = await load_image(`${url}/cats.jpg`);\r\nconst audio = await load_audio(`${url}/jfk.wav`, 16000);\r\nconst video = await load_video(`${url}/sea-turtle.mp4`, { fps: 1 });\r\n\r\nconst media_embeddings = cat([\r\n  await embed(null, image),\r\n  await embed(null, null, audio),\r\n  await embed(null, null, null, video),\r\n]);\r\n\r\n// Embeddings are normalized: the dot product is the cosine similarity\r\nconst scores = (await matmul(media_embeddings, query_embeddings.transpose(1, 0))).tolist();\r\n[\"image\", \"audio\", \"video\"].forEach((name, i) => console.log(name, scores[i].map((x) => x.toFixed(3))));\r\n// Each input scores highest with its own query:\r\n//          cats     speech   turtle\r\n// image [\"0.740\", \"0.462\", \"0.508\"]\r\n// audio [\"0.504\", \"0.763\", \"0.487\"]\r\n// video [\"0.505\", \"0.500\", \"0.731\"]\r\n```\r\n\r\nTo embed several items of a modality at once, pass one list per input: `processor(null, [[image1], [image2]])` returns two image embeddings, while a flat list of images, `processor(null, [image1, image2])`, is a single input made of both images.\r\n\r\n\r\n\r\n**Full Changelog**: https://github.com/huggingface/transformers.js/compare/4.3.0...4.3.1","publishedAt":"2026-10-07T03:19:38.000Z","fetchedAt":"2026-10-07T04:33:19.073Z","url":"https://github.com/huggingface/transformers.js/releases/tag/4.3.1","media":[],"coverageCount":0},{"id":"rel_8CXBPvhN_C8b2xdJadcFP","version":"4.3.0","type":"feature","title":"4.3.0","summary":"Adds a dependency-free @huggingface/transformers-structured-output package that constrains generation to a JSON schema, JSON object, or regular expression, plus three new model architectures (DeepSeek-V4, Zaya, HRM-Text) and WebGPU support for Safari 26 and above. Fixes duplicate model file downloads when progress_callback is active, RawAudio.toBlob() handling of typed array byte offsets, and Moonshine ASR token decoding.","titleGenerated":"Transformers.js 4.3.0 adds structured output and three new model architectures","titleShort":"Structured output lands; DeepSeek-V4 and Safari WebGPU supported","breaking":"none","importance":3,"content":"# 🚀 Transformers.js v4.3 — Structured Output, New Models, WebGPU upgrade, Documentation Overhaul\r\n\r\nThis release adds structured output, three new model architectures, WebGPU support for Safari 26+, and a documentation overhaul. We also upgraded ONNX Runtime to the latest version.\r\n\r\n## What's new?\r\n\r\n### Structured output\r\n\r\nConstrain generation to a JSON schema, JSON object, or regular expression with the experimental, dependency-free `@huggingface/transformers-structured-output` package in https://github.com/huggingface/transformers.js/pull/1758.\r\n\r\nFor example, classify customer feedback into a fixed set of sentiments and topics:\r\n\r\n```js\r\nimport { pipeline, TextStreamer } from \"@huggingface/transformers\";\r\nimport { StructuredOutputProcessor } from \"@huggingface/transformers-structured-output\";\r\n\r\n// Create the pipeline first so its tokenizer is available.\r\nconst generator = await pipeline(\r\n  \"text-generation\",\r\n  \"onnx-community/LFM2.5-350M-ONNX\",\r\n  { dtype: \"q4f16\", device: \"webgpu\" },\r\n);\r\n\r\nconst processor = new StructuredOutputProcessor(generator.tokenizer, {\r\n  type: \"json_schema\",\r\n  json_schema: {\r\n    type: \"object\",\r\n    properties: {\r\n      sentiment: { enum: [\"positive\", \"negative\", \"neutral\"] },\r\n      topic: { enum: [\"price\", \"quality\", \"delivery\", \"other\"] },\r\n    },\r\n    required: [\"sentiment\", \"topic\"],\r\n    additionalProperties: false,\r\n  },\r\n});\r\n\r\nconst messages = [\r\n  {\r\n    role: \"user\",\r\n    content: \"Classify this feedback: The product is way too expensive.\",\r\n  },\r\n];\r\n\r\nconst output = await generator(messages, {\r\n  max_new_tokens: 512,\r\n  do_sample: false,\r\n  streamer: new TextStreamer(generator.tokenizer, {\r\n    skip_prompt: true,\r\n    skip_special_tokens: true,\r\n  }),\r\n  logits_processor: [processor],\r\n});\r\n\r\nconsole.log(output[0].generated_text.at(-1).content);\r\n// {\"sentiment\": \"negative\", \"topic\": \"price\"}\r\n```\r\n\r\nCurrently supports one generated sequence at a time. Set a sufficient token budget so the output can finish.\r\n\r\n### New models\r\n\r\n* **DeepSeek-V4** in https://github.com/huggingface/transformers.js/pull/1679\r\n* **Zaya** in https://github.com/huggingface/transformers.js/pull/1682\r\n* **HRM-Text** in https://github.com/huggingface/transformers.js/pull/1695\r\n\r\n### Browser and storage improvements\r\n\r\n* Enable WebGPU for Safari 26 and above in https://github.com/huggingface/transformers.js/pull/1700\r\n* Update Cross-Origin Storage to use `requestFileHandle()` and allow all origins by @tomayac in https://github.com/huggingface/transformers.js/pull/1709 and https://github.com/huggingface/transformers.js/pull/1716\r\n* Skip browser cache writes for non-HTTP(S) resources by @patrickkettner in https://github.com/huggingface/transformers.js/pull/1723\r\n* Fix Rspack and Webpack `import.meta` warnings by @nico-martin in https://github.com/huggingface/transformers.js/pull/1760\r\n\r\n### Fixes\r\n\r\n* Fix duplicate model file downloads when `progress_callback` is active by @anishesg in https://github.com/huggingface/transformers.js/pull/1664\r\n* Fix Whisper progress callbacks in https://github.com/huggingface/transformers.js/pull/1680\r\n* Ensure `num_logits_to_keep` is always set to `1` for generation in https://github.com/huggingface/transformers.js/pull/1681\r\n* Fix the number of features in the Granite Speech processor in https://github.com/huggingface/transformers.js/pull/1685\r\n* Restore missing global exports in https://github.com/huggingface/transformers.js/pull/1696\r\n* Fix `RawAudio.toBlob()` to respect typed array byte offsets and lengths by @yushuosun in https://github.com/huggingface/transformers.js/pull/1712\r\n* Dispose of the KV cache after Chatterbox generation by @m96-chan in https://github.com/huggingface/transformers.js/pull/1737\r\n* Fix Moonshine ASR token decoding by @Mr-Neutr0n in https://github.com/huggingface/transformers.js/pull/1738\r\n* Pin the WebGPU KV cache for Gemma3n and Gemma4 image-audio-text-to-text models by @shoemoney in https://github.com/huggingface/transformers.js/pull/1757\r\n\r\n### Documentation and maintenance\r\n\r\n* Overhaul the documentation in https://github.com/huggingface/transformers.js/pull/1665\r\n* Enable weekly Dependabot updates for GitHub Actions by https://github.com/huggingface/transformers.js/pull/1690\r\n* Run tests on internal workers in https://github.com/huggingface/transformers.js/pull/1710\r\n* Remove unused code and exports by @nico-martin in https://github.com/huggingface/transformers.js/pull/1763\r\n* Update dependencies in https://github.com/huggingface/transformers.js/pull/1766\r\n\r\n## New contributors\r\n\r\nThanks to our first-time contributors:\r\n\r\n* @anishesg in https://github.com/huggingface/transformers.js/pull/1664\r\n* @Mr-Neutr0n in https://github.com/huggingface/transformers.js/pull/1738\r\n* @m96-chan in https://github.com/huggingface/transformers.js/pull/1737\r\n* @shoemoney in https://github.com/huggingface/transformers.js/pull/1757\r\n* @patrickkettner in https://github.com/huggingface/transformers.js/pull/1723\r\n* @yushuosun in https://github.com/huggingface/transformers.js/pull/1712\r\n\r\n**Full changelog:** https://github.com/huggingface/transformers.js/compare/4.2.0...4.3.0\r\n","publishedAt":"2026-09-16T05:13:21.000Z","fetchedAt":"2026-09-16T07:50:52.474Z","url":"https://github.com/huggingface/transformers.js/releases/tag/4.3.0","media":[],"coverageCount":0},{"id":"rel_oqMwQpDs3jh8I8F-_u38J","version":"4.0.1","type":"feature","title":"4.0.1","summary":"What's new? Add support for Gemma 4 in #1627 Full Changelog: 4.0.0...4.0.1","titleGenerated":null,"titleShort":null,"breaking":"unknown","importance":null,"content":"## What's new?\r\n\r\n- Add support for [Gemma 4](https://deepmind.google/models/gemma/gemma-4/) in [#1627](https://github.com/huggingface/transformers.js/pull/1627)\r\n\r\n**Full Changelog**: [4.0.0...4.0.1](https://github.com/huggingface/transformers.js/compare/4.0.0...4.0.1)","publishedAt":"2026-04-23T13:03:02.000Z","fetchedAt":"2026-04-23T17:00:14.494Z","url":"https://github.com/huggingface/transformers.js/releases/tag/4.0.1","media":[],"coverageCount":0},{"id":"rel_LWJTiigu3nzdNbL6LJ59S","version":"4.2.0","type":"feature","title":"4.2.0","summary":"🚀 Transformers.js v4.2 — Tool calling, simpler internals, and privacy filtering Added tools to TextGenerationPipeline in #1655 Use inputMetadata API for simplified internals in #1657 Add support for OpenAI privacy filter model in #1658 Full Changelog: 4.1.0...4.2.0","titleGenerated":null,"titleShort":null,"breaking":"unknown","importance":null,"content":"# 🚀 Transformers.js v4.2 — Tool calling, simpler internals, and privacy filtering\r\n\r\n- Added `tools` to `TextGenerationPipeline` in [#1655](https://github.com/huggingface/transformers.js/pull/1655)\r\n- Use `inputMetadata` API for simplified internals in [#1657](https://github.com/huggingface/transformers.js/pull/1657)\r\n- Add support for OpenAI privacy filter model in [#1658](https://github.com/huggingface/transformers.js/pull/1658)\r\n\r\n**Full Changelog**: [4.1.0...4.2.0](https://github.com/huggingface/transformers.js/compare/4.1.0...4.2.0)","publishedAt":"2026-04-23T12:49:47.000Z","fetchedAt":"2026-04-23T17:00:14.494Z","url":"https://github.com/huggingface/transformers.js/releases/tag/4.2.0","media":[],"coverageCount":0},{"id":"rel_FOngdPndCIdUMg0XAiaCL","version":"4.1.0","type":"feature","title":"4.1.0","summary":"🚀 Transformers.js v4.1 — Gemma 4, KV cache improvements, and new quantization dtypes Add support for Gemma 4 in #1627 Cached generation improvements (+ past_key_values via pipeline function) in #1638 Improve tokenizer types based on input function parameters in #1641 Add…","titleGenerated":null,"titleShort":null,"breaking":"unknown","importance":null,"content":"# 🚀 Transformers.js v4.1 — Gemma 4, KV cache improvements, and new quantization dtypes\r\n\r\n- Add support for Gemma 4 in [#1627](https://github.com/huggingface/transformers.js/pull/1627)\r\n- Cached generation improvements (+ `past_key_values` via pipeline function) in [#1638](https://github.com/huggingface/transformers.js/pull/1638)\r\n- Improve tokenizer types based on input function parameters in [#1641](https://github.com/huggingface/transformers.js/pull/1641)\r\n- Add support for `q1`, `q1f16`, `q2`, and `q2f16` data types in [#1647](https://github.com/huggingface/transformers.js/pull/1647)\r\n- Re-enable SmolVLM in [#1648](https://github.com/huggingface/transformers.js/pull/1648)\r\n- Update default generation parameters in [#1649](https://github.com/huggingface/transformers.js/pull/1649)\r\n- Pin GitHub Actions to commit SHAs in [#1626](https://github.com/huggingface/transformers.js/pull/1626)\r\n\r\n**Full Changelog**: [4.0.0...4.1.0](https://github.com/huggingface/transformers.js/compare/4.0.0...4.1.0)\r\n","publishedAt":"2026-04-23T12:49:02.000Z","fetchedAt":"2026-04-23T17:00:14.494Z","url":"https://github.com/huggingface/transformers.js/releases/tag/4.1.0","media":[],"coverageCount":0},{"id":"rel_YL2j5hdHQ8bscu9gNf7qW","version":"4.0.0","type":"feature","title":"4.0.0","summary":"🚀 Transformers.js v4 We're excited to announce that Transformers.js v4 is now available on NPM! After a year of development (we started in March 2025 🤯), we're finally ready for you to use it. Links: YouTube Video, Blog Post, Demo Collection New WebGPU backend The biggest…","titleGenerated":null,"titleShort":null,"breaking":"unknown","importance":null,"content":"# 🚀 Transformers.js v4\r\n\r\nWe're excited to announce that Transformers.js v4 is now available on NPM! After a year of development (we started in March 2025 🤯), we're finally ready for you to use it.\r\n\r\n```sh\r\nnpm i @huggingface/transformers\r\n```\r\n\r\nLinks: [YouTube Video](https://www.youtube.com/watch?v=KnhppkY4gHs), [Blog Post](https://huggingface.co/blog/transformersjs-v4), [Demo Collection](https://huggingface.co/collections/webml-community/transformersjs-v4-demos)\r\n\r\n## New WebGPU backend\r\n\r\nThe biggest change is undoubtedly the adoption of a new WebGPU Runtime, completely rewritten in C++. We've worked closely with the ONNX Runtime team to thoroughly test this runtime across our ~200 supported model architectures, as well as many new v4-exclusive architectures.\r\n\r\nIn addition to better operator support (for performance, accuracy, and coverage), this new WebGPU runtime allows the same transformers.js code to be used across a wide variety of JavaScript environments, including browsers, server-side runtimes, and desktop applications. That's right, you can now run WebGPU-accelerated models directly in Node, Bun, and Deno!\r\n\r\n<img src=\"https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformersjs-v4/webgpu.png\" alt=\"WebGPU Overview\" width=\"100%\">\r\n\r\nWe've proven that it's possible to run state-of-the-art AI models 100% locally in the browser, and now we're focused on performance: making these models run as fast as possible, even in resource-constrained environments. This required completely rethinking our export strategy, especially for large language models. We achieve this by re-implementing new models operation by operation, leveraging specialized ONNX Runtime [Contrib Operators](https://github.com/microsoft/onnxruntime/blob/main/docs/ContribOperators.md) like [com.microsoft.GroupQueryAttention](https://github.com/microsoft/onnxruntime/blob/main/docs/ContribOperators.md#com.microsoft.GroupQueryAttention), [com.microsoft.MatMulNBits](https://github.com/microsoft/onnxruntime/blob/main/docs/ContribOperators.md#com.microsoft.MatMulNBits), or [com.microsoft.QMoE](https://github.com/microsoft/onnxruntime/blob/main/docs/ContribOperators.md#com.microsoft.QMoE) to maximize performance.\r\n\r\nFor example, adopting the [com.microsoft.MultiHeadAttention](https://github.com/microsoft/onnxruntime/blob/main/docs/ContribOperators.md#com.microsoft.MultiHeadAttention) operator, we were able to achieve a ~4x speedup for BERT-based embedding models.\r\n\r\n<img src=\"https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformersjs-v4/speedups.png\" alt=\"Optimized ONNX Exports\" width=\"100%\">\r\n\r\n\r\n* ONNX Runtime improvements by @xenova in https://github.com/huggingface/transformers.js/pull/1306\r\n* Transformers.js V4: Native WebGPU EP, repo restructuring, and more! by @xenova in https://github.com/huggingface/transformers.js/pull/1382\r\n\r\n## New models\r\n\r\nThanks to our new export strategy and ONNX Runtime's expanding support for custom operators, we've been able to add many new models and architectures to Transformers.js v4. These include popular models like GPT-OSS, Chatterbox, GraniteMoeHybrid, LFM2-MoE, HunYuanDenseV1, Apertus, Olmo3, FalconH1, and Youtu-LLM. Many of these required us to implement support for advanced architectural patterns, including Mamba (state-space models), Multi-head Latent Attention (MLA), and Mixture of Experts (MoE). Perhaps most importantly, these models are all compatible with WebGPU, allowing users to run them directly in the browser or server-side JavaScript environments with hardware acceleration. We've released several [Transformers.js v4 demos](https://huggingface.co/collections/webml-community/transformersjs-v4-demos) so far... and we'll continue to release more!\r\n\r\nAdditionally, we've added support for larger models exceeding 8B parameters. In our tests, we've been able to run GPT-OSS 20B (q4f16) at ~60 tokens per second on an M4 Pro Max.\r\n\r\n* Add support for Apertus by @nico-martin in https://github.com/huggingface/transformers.js/pull/1465\r\n* Add support for FalconH1 by @xenova in https://github.com/huggingface/transformers.js/pull/1502\r\n* Add support for Cohere's Tiny Aya models by @xenova in https://github.com/huggingface/transformers.js/pull/1529\r\n* Add support for AFMoE by @xenova in https://github.com/huggingface/transformers.js/pull/1542\r\n* Add support for new Qwen VL models (Qwen2.5-VL, Qwen3-VL, Qwen3.5, and Qwen3.5 MoE) by @xenova in https://github.com/huggingface/transformers.js/pull/1551\r\n* Add support for Qwen2 MoE, Qwen3 MoE, Qwen3 Next, Qwen3-VL MoE, and Olmo Hybrid by @xenova in https://github.com/huggingface/transformers.js/pull/1562\r\n* Add support for EuroBERT by @xenova in https://github.com/huggingface/transformers.js/pull/1583\r\n* Add support for LightOnOCR and GLM-OCR by @xenova in https://github.com/huggingface/transformers.js/pull/1582\r\n* Add support for Nemotron-H by @xenova in https://github.com/huggingface/transformers.js/pull/1585\r\n* Add support for DeepSeek-v3 by @xenova in https://github.com/huggingface/transformers.js/pull/1586\r\n* Add support for mistral4 by @xenova in https://github.com/huggingface/transformers.js/pull/1587\r\n* Add support for GLM-MoE-DSA by @xenova in https://github.com/huggingface/transformers.js/pull/1588\r\n* Add support for Chatterbox @xenova in https://github.com/huggingface/transformers.js/pull/1592\r\n* Add support for Cohere ASR by @xenova in https://github.com/huggingface/transformers.js/pull/1610\r\n* Add support for SolarOpen and CHMv2 models by @xenova in https://github.com/huggingface/transformers.js/pull/1593\r\n* Voxtral Realtime, LFM2-VL, Granite Speech, and modeling type refactoring by @xenova in https://github.com/huggingface/transformers.js/pull/1569\r\n* Add support for Gemma3 VLM architecture by @xenova in https://github.com/huggingface/transformers.js/pull/1601\r\n\r\n\r\n## New features\r\n\r\n### ModelRegistry\r\n\r\nThe new `ModelRegistry` API is designed for production workflows. It provides explicit visibility into pipeline assets before loading anything: list required files with `get_pipeline_files`, inspect per-file metadata with `get_file_metadata` (quite useful to calculate total download size), check cache status with `is_pipeline_cached`, and clear cached artifacts with `clear_pipeline_cache`. You can also query available precision types for a model with `get_available_dtypes`. Based on this new API, `progress_callback` now includes a `progress_total` event, making it easy to render end-to-end loading progress without manually aggregating per-file updates.\r\n\r\n<details>\r\n<summary>See `ModelRegistry` examples</summary>\r\n\r\n```javascript\r\nimport { ModelRegistry, pipeline } from \"@huggingface/transformers\";\r\n\r\nconst modelId = \"onnx-community/all-MiniLM-L6-v2-ONNX\";\r\nconst modelOptions = { dtype: \"fp32\" };\r\n\r\nconst files = await ModelRegistry.get_pipeline_files(\r\n  \"feature-extraction\",\r\n  modelId,\r\n  modelOptions\r\n);\r\n// ['config.json', 'onnx/model.onnx', ..., 'tokenizer_config.json']\r\n\r\nconst metadata = await Promise.all(\r\n  files.map(file => ModelRegistry.get_file_metadata(modelId, file))\r\n);\r\n\r\nconst downloadSize = metadata.reduce((total, item) => total + item.size, 0);\r\n\r\nconst cached = await ModelRegistry.is_pipeline_cached(\r\n  \"feature-extraction\",\r\n  modelId,\r\n  modelOptions\r\n);\r\n\r\nconst dtypes = await ModelRegistry.get_available_dtypes(modelId);\r\n// ['fp32', 'fp16', 'q4', 'q4f16']\r\n\r\nif (cached) {\r\n  await ModelRegistry.clear_pipeline_cache(\r\n    \"feature-extraction\",\r\n    modelId,\r\n    modelOptions\r\n  );\r\n}\r\n\r\nconst pipe = await pipeline(\r\n  \"feature-extraction\",\r\n  modelId,\r\n  {\r\n    progress_callback: e => {\r\n      if (e.status === \"progress_total\") {\r\n        console.log(`${Math.round(e.progress)}%`);\r\n      }\r\n    },\r\n  }\r\n);\r\n```\r\n\r\n</details>\r\n\r\n### New Environment Settings\r\n\r\nWe also added new environment controls for model loading. `env.useWasmCache` enables caching of WASM runtime files (when cache storage is available), allowing applications to work fully offline after the initial load.\r\n\r\n`env.fetch` lets you provide a custom fetch implementation for use cases such as authenticated model access, custom headers, and abortable requests.\r\n\r\n<details>\r\n<summary>See env examples</summary>\r\n\r\n```javascript\r\nimport { env } from \"@huggingface/transformers\";\r\n\r\nenv.useWasmCache = true;\r\n\r\nenv.fetch = (url, options) =>\r\n  fetch(url, {\r\n    ...options,\r\n    headers: {\r\n      ...options?.headers,\r\n      Authorization: `Bearer ${MY_TOKEN}`,\r\n    },\r\n  });\r\n```\r\n\r\n</details>\r\n\r\n### Improved Logging Controls\r\n\r\nFinally, logging is easier to manage in real-world deployments. ONNX Runtime WebGPU warnings are now hidden by default, and you can set explicit verbosity levels for both Transformers.js and ONNX Runtime. This update, also driven by community feedback, keeps console output focused on actionable signals rather than low-value noise.\r\n\r\n<details>\r\n<summary>See `logLevel` example</summary>\r\n\r\n```javascript\r\nimport { env, LogLevel } from \"@huggingface/transformers\";\r\n\r\n// LogLevel.DEBUG\r\n// LogLevel.INFO\r\n// LogLevel.WARNING\r\n// LogLevel.ERROR\r\n// LogLevel.NONE\r\n\r\nenv.logLevel = LogLevel.WARNING;\r\n```\r\n\r\n</details>\r\n\r\n* [v4] added wasm cache by @nico-martin in https://github.com/huggingface/transformers.js/pull/1471\r\n* V4 cache wasm file blob fix by @nico-martin in https://github.com/huggingface/transformers.js/pull/1489\r\n* [v4] suppress console.error while creating InferenceSession by @nico-martin in https://github.com/huggingface/transformers.js/pull/1468\r\n* feat: add configurable log levels via env.logLevel by @taronsung in https://github.com/huggingface/transformers.js/pull/1507\r\n* [v4] Improve download progress tracking (model cache registry and define which files will be loaded for pipelines) by @nico-martin in https://github.com/huggingface/transformers.js/pull/1511\r\n* Add support for seedable random number generation by @xenova in https://github.com/huggingface/transformers.js/pull/1537\r\n* Add customFetch to env for user override by @sroussey in https://github.com/huggingface/transformers.js/pull/1538 and @xenova in https://github.com/huggingface/transformers.js/pull/1543\r\n* [deno] Support both wgpu and dawn webgpu backends by @xenova in https://github.com/huggingface/transformers.js/pull/1546\r\n* feat: experimental Cross-Origin Storage cache backend by @nico-martin in https://github.com/huggingface/transformers.js/pull/1549\r\n* Support PKV cached generation for Qwen-VL models by @xenova in https://github.com/huggingface/transformers.js/pull/1557\r\n* Use ModelRegistry for pipeline file loading by @xenova in https://github.com/huggingface/transformers.js/pull/1555\r\n* feat: add fast boolean `is_cached` / `is_pipeline_cached`, closes #1554 by @nico-martin in https://github.com/huggingface/transformers.js/pull/1559\r\n* feat: add ModelRegistry.get_available_dtypes() to detect quantization by @sroussey in https://github.com/huggingface/transformers.js/pull/1580\r\n* Add support for qwen3_5_text <-> Qwen3_5ForCausalLM by @xenova in https://github.com/huggingface/transformers.js/pull/1602\r\n* Fix ModelRegistry calls when loading multimodal models with text-generation pipeline by @xenova in https://github.com/huggingface/transformers.js/pull/1614\r\n* Emit `progress_total` events from `PreTrainedModel.from_pretrained()` by @xenova in https://github.com/huggingface/transformers.js/pull/1615\r\n\r\n## Repository Restructuring\r\n\r\nDeveloping a new major version gave us the opportunity to invest in the codebase and tackle long-overdue refactoring efforts.\r\n\r\n### PNPM Workspaces\r\n\r\nUntil now, the GitHub repository served as our npm package. This worked well as long as the repository only exposed a single library. However, looking to the future, we saw the need for various sub-packages that depend heavily on the Transformers.js core while addressing different use cases, like library-specific implementations, or smaller utilities that most users don't need but are essential for some.\r\n\r\nThat's why we converted the repository to a monorepo using pnpm workspaces. This allows us to ship smaller packages that depend on `@huggingface/transformers` without the overhead of maintaining separate repositories.\r\n\r\n### Modular Class Structure\r\n\r\nAnother major refactoring effort targeted the ever-growing models.js file. In v3, all available models were defined in a single file spanning over 8,000 lines, becoming increasingly difficult to maintain. For v4, we split this into smaller, focused modules with a clear distinction between utility functions, core logic, and model-specific implementations. This new structure improves readability and makes it much easier to add new models. Developers can now focus on model-specific logic without navigating through thousands of lines of unrelated code.\r\n\r\n### Examples Repository\r\n\r\nIn v3, many Transformers.js example projects lived directly in the main repository. For v4, we've moved them to a [dedicated repository](https://github.com/huggingface/transformers.js-examples), allowing us to maintain a cleaner codebase focused on the core library. This also makes it easier for users to find and contribute to examples without sifting through the main repository.\r\n\r\n### Prettier\r\n\r\nWe updated the Prettier configuration and reformatted all files in the repository. This ensures consistent formatting throughout the codebase, with all future PRs automatically following the same style. No more debates about formatting... Prettier handles it all, keeping the code clean and readable for everyone.\r\n\r\n### Standalone Tokenizers.js Library\r\n\r\nA frequent request from users was to extract the tokenization logic into a separate library, and with v4, that's exactly what we've done. [@huggingface/tokenizers](https://www.npmjs.com/package/@huggingface/tokenizers) is a complete refactor of the tokenization logic, designed to work seamlessly across browsers and server-side runtimes. At just 8.8kB (gzipped) with zero dependencies, it's incredibly lightweight while remaining fully type-safe.\r\n\r\n<details>\r\n<summary>See example code</summary>\r\n\r\n```javascript\r\nimport { Tokenizer } from \"@huggingface/tokenizers\";\r\n\r\n// Load from Hugging Face Hub\r\nconst modelId = \"HuggingFaceTB/SmolLM3-3B\";\r\nconst tokenizerJson = await fetch(\r\n  `https://huggingface.co/${modelId}/resolve/main/tokenizer.json`\r\n).then(res => res.json());\r\n\r\nconst tokenizerConfig = await fetch(\r\n  `https://huggingface.co/${modelId}/resolve/main/tokenizer_config.json`\r\n).then(res => res.json());\r\n\r\n// Create tokenizer\r\nconst tokenizer = new Tokenizer(tokenizerJson, tokenizerConfig);\r\n\r\n// Tokenize text\r\nconst tokens = tokenizer.tokenize(\"Hello World\");\r\n// ['Hello', 'ĠWorld']\r\n\r\nconst encoded = tokenizer.encode(\"Hello World\");\r\n// { ids: [9906, 4435], tokens: ['Hello', 'ĠWorld'], ... }\r\n```\r\n\r\n</details>\r\n\r\nThis separation keeps the core of Transformers.js focused and lean while offering a versatile, standalone tool that any WebML project can use independently.\r\n\r\n* Move examples by @xenova in https://github.com/huggingface/transformers.js/pull/1362\r\n* [v4] Refactor models.js into separate per-model modeling files by @nico-martin in https://github.com/huggingface/transformers.js/pull/1498\r\n* V4 move to pnpm workspaces by @nico-martin in https://github.com/huggingface/transformers.js/pull/1504\r\n* [v4] Tokenizers.js migration by @xenova in https://github.com/huggingface/transformers.js/pull/1501\r\n\r\n## New build system\r\n\r\nWe've migrated our build system from Webpack to esbuild, and the results have been incredible. Build times dropped from 2 seconds to just 200 milliseconds, a 10x improvement that makes development iteration significantly faster. Speed isn't the only benefit, though: bundle sizes also decreased by an average of 10% across all builds. The most notable improvement is in transformers.web.js, our default export, which is now 53% smaller, meaning faster downloads and quicker startup times for users.\r\n\r\n* [v4] Switch build system to use esbuild by @nico-martin in https://github.com/huggingface/transformers.js/pull/1466\r\n\r\n## Improved types\r\n\r\nWe've made several quality-of-life improvements across the library. The type system has been enhanced with dynamic pipeline types that adapt based on inputs, providing better developer experience and type safety.\r\n\r\n<img src=\"https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformersjs-v4/types.png\" alt=\"Type Improvements\" width=\"100%\">\r\n\r\n* [v4] Finalize pipeline types by @xenova in https://github.com/huggingface/transformers.js/pull/1505\r\n* Add type definitions for various pipeline outputs in transformers.js by @sroussey in https://github.com/huggingface/transformers.js/pull/1535\r\n* fix: improves typedef of Message by @philnash in https://github.com/huggingface/transformers.js/pull/1525\r\n* added ProgressCallback and ProgressInfo as type exports by @nico-martin in https://github.com/huggingface/transformers.js/pull/1528\r\n\r\n## Bug fixes\r\n* fixed backend loading path by @nico-martin in https://github.com/huggingface/transformers.js/pull/1464\r\n* fixed v4 ts errors by @nico-martin in https://github.com/huggingface/transformers.js/pull/1477\r\n* Hot-fix Float16Array usage in node by @xenova in https://github.com/huggingface/transformers.js/pull/1482\r\n* [v4@next] Fix WebGPU validation failed by @xenova in https://github.com/huggingface/transformers.js/pull/1519\r\n* Fix `stopping_criteria` missing from generation pipelines by @xenova in https://github.com/huggingface/transformers.js/pull/1523\r\n* Overdue Whisper fixes by @xenova in https://github.com/huggingface/transformers.js/pull/1594\r\n* Fix custom cache in Node.js when cache returns non-paths (e.g., Response) by @xenova in https://github.com/huggingface/transformers.js/pull/1617\r\n* Include `content-length` header in COS `Response` by @tomayac in https://github.com/huggingface/transformers.js/pull/1572\r\n* Fix: file size missing for cached files by @nico-martin in https://github.com/huggingface/transformers.js/pull/1575\r\n* [deno via CDN] Fix simultaneous multi-session loading (e.g., VLMs) and d support usage for image loading by @xenova in https://github.com/huggingface/transformers.js/pull/1556\r\n* fix: prevent partial file reads during concurrent downloads by @nico-martin in https://github.com/huggingface/transformers.js/pull/1548\r\n* Fix WASM factory blob URL loading (#1527, #1532) by @nico-martin in https://github.com/huggingface/transformers.js/pull/1558\r\n\r\n## Documentation improvements\r\n* Fix broken source code links in the Tutorials sections. by @SeanGallen in https://github.com/huggingface/transformers.js/pull/1526\r\n* V4 (docs): add Vercel AI SDK integration with browser-ai/transformers.js package by @xenova in https://github.com/huggingface/transformers.js/pull/1566\r\n* docs: add step-by-step guide for contributing a new model by @nico-martin in https://github.com/huggingface/transformers.js/pull/1560\r\n* Add background-removal pipeline to JSDoc by @xenova in https://github.com/huggingface/transformers.js/pull/1595\r\n* fix(docs): Fix typo in WebGPU documentation by @mattsoulanille in https://github.com/huggingface/transformers.js/pull/1607\r\n\r\n## Miscellaneous improvements\r\n\r\n* Improve text streamer when `skip_special_tokens: false` by @xenova in https://github.com/huggingface/transformers.js/pull/1520\r\n* Upgrade GitHub Actions for Node 24 compatibility (follow-up) by @xenova in https://github.com/huggingface/transformers.js/pull/1531\r\n* Align audio_spectrogram_transformer name with python library by @xenova in https://github.com/huggingface/transformers.js/pull/1591\r\n* Memoize network calls in model registry by @nico-martin in https://github.com/huggingface/transformers.js/pull/1552\r\n* added no-store to range request #1561 by @nico-martin in https://github.com/huggingface/transformers.js/pull/1564\r\n\r\n## New Contributors\r\n* @taronsung made their first contribution in https://github.com/huggingface/transformers.js/pull/1507\r\n* @philnash made their first contribution in https://github.com/huggingface/transformers.js/pull/1525\r\n* @tomayac made their first contribution in https://github.com/huggingface/transformers.js/pull/1572\r\n* @mattsoulanille made their first contribution in https://github.com/huggingface/transformers.js/pull/1607\r\n\r\n**Full Changelog**: https://github.com/huggingface/transformers.js/compare/3.8.1...4.0.0","publishedAt":"2026-03-30T12:55:30.000Z","fetchedAt":"2026-04-07T17:29:35.494Z","url":"https://github.com/huggingface/transformers.js/releases/tag/4.0.0","media":[{"type":"video","url":"https://i.ytimg.com/vi/KnhppkY4gHs/hqdefault.jpg","alt":"Transformers.js v4: State-of-the-art machine learning for the web","linkUrl":"https://www.youtube.com/watch?v=KnhppkY4gHs","r2Key":"releases/16ab44244adf69503a170aabd89aaaabb14b2c742ac6252c7c0e92cd99573c25.jpg","r2Url":"https://media.releases.sh/releases/16ab44244adf69503a170aabd89aaaabb14b2c742ac6252c7c0e92cd99573c25.jpg"}],"coverageCount":0},{"id":"rel_TmGbXoAnkMxwUjFGO5hwV","version":"3.8.1","type":"feature","title":"3.8.1","summary":"What's new? Add support for Ministral 3 in https://github.com/huggingface/transformers.js/pull/1474 Fix Ernie 4.5 naming in https://github.com/huggingface/transformers.js/pull/1473 Update Supertonic TTS paper + authors in https://github.com/huggingface/transformers.js/pull/1463…","titleGenerated":null,"titleShort":null,"breaking":"unknown","importance":null,"content":"## What's new?\r\n* Add support for Ministral 3 in https://github.com/huggingface/transformers.js/pull/1474\r\n* Fix Ernie 4.5 naming in https://github.com/huggingface/transformers.js/pull/1473\r\n* Update Supertonic TTS paper + authors in https://github.com/huggingface/transformers.js/pull/1463\r\n\r\n\r\n**Full Changelog**: https://github.com/huggingface/transformers.js/compare/3.8.0...3.8.1","publishedAt":"2025-12-02T14:37:50.000Z","fetchedAt":"2026-04-07T17:29:35.494Z","url":"https://github.com/huggingface/transformers.js/releases/tag/3.8.1","media":[],"coverageCount":0},{"id":"rel_jPsQiG3wex6I0LtNFr2mE","version":"3.8.0","type":"feature","title":"3.8.0","summary":"🚀 Transformers.js v3.8 — SAM2, SAM3, EdgeTAM, Supertonic TTS Add support for EdgeTAM in https://github.com/huggingface/transformers.js/pull/1454 Add support for Supertonic TTS in https://github.com/huggingface/transformers.js/pull/1459 Example: Add support for SAM2 and SAM3…","titleGenerated":null,"titleShort":null,"breaking":"unknown","importance":null,"content":"# 🚀 Transformers.js v3.8 — SAM2, SAM3, EdgeTAM, Supertonic TTS\r\n\r\n* Add support for EdgeTAM in https://github.com/huggingface/transformers.js/pull/1454\r\n* Add support for Supertonic TTS in https://github.com/huggingface/transformers.js/pull/1459\r\n\r\n    \r\n    **Example:**\r\n    ```js\r\n    import { pipeline } from '@huggingface/transformers';\r\n    \r\n    const tts = await pipeline('text-to-speech', 'onnx-community/Supertonic-TTS-ONNX');\r\n    \r\n    const input_text = 'This is really cool!';\r\n    const audio = await tts(input_text, {\r\n        speaker_embeddings: 'https://huggingface.co/onnx-community/Supertonic-TTS-ONNX/resolve/main/voices/F1.bin',\r\n    });\r\n    await audio.save('output.wav');\r\n    ```\r\n\r\n\r\n* Add support for SAM2 and SAM3 (Tracker) in https://github.com/huggingface/transformers.js/pull/1461\r\n* Remove Metaspace add_prefix_space logic in https://github.com/huggingface/transformers.js/pull/1451\r\n* ImageProcessor preprocess uses image_std for fill value by @NathanKolbas in https://github.com/huggingface/transformers.js/pull/1455\r\n\r\n## New Contributors\r\n* @NathanKolbas made their first contribution in https://github.com/huggingface/transformers.js/pull/1455\r\n\r\n**Full Changelog**: https://github.com/huggingface/transformers.js/compare/3.7.6...3.8.0","publishedAt":"2025-11-19T16:50:46.000Z","fetchedAt":"2026-04-07T17:29:35.494Z","url":"https://github.com/huggingface/transformers.js/releases/tag/3.8.0","media":[],"coverageCount":0},{"id":"rel_KYv_vSoQ93Jm9V52bjfVt","version":"3.7.6","type":"feature","title":"3.7.6","summary":"What's new? Fix issue when temperature=0 and do_sample=true by @nico-martin in https://github.com/huggingface/transformers.js/pull/1431 Fix type errors by @nico-martin in https://github.com/huggingface/transformers.js/pull/1436 Add support for NanoChat in…","titleGenerated":null,"titleShort":null,"breaking":"unknown","importance":null,"content":"## What's new?\r\n* Fix issue when `temperature=0` and `do_sample=true` by @nico-martin in https://github.com/huggingface/transformers.js/pull/1431\r\n* Fix type errors by @nico-martin in https://github.com/huggingface/transformers.js/pull/1436\r\n* Add support for NanoChat in https://github.com/huggingface/transformers.js/pull/1441\r\n* Add support for Parakeet CTC in https://github.com/huggingface/transformers.js/pull/1440\r\n\r\n## New Contributors\r\n* @nico-martin made their first contribution in https://github.com/huggingface/transformers.js/pull/1431\r\n\r\n**Full Changelog**: https://github.com/huggingface/transformers.js/compare/3.7.5...3.7.6","publishedAt":"2025-10-20T19:44:04.000Z","fetchedAt":"2026-04-07T17:29:35.494Z","url":"https://github.com/huggingface/transformers.js/releases/tag/3.7.6","media":[],"coverageCount":0},{"id":"rel_WyZOB8YO5eDagYMO9Mg9I","version":"3.7.5","type":"feature","title":"3.7.5","summary":"What's new? Add support for GraniteMoeHybrid in https://github.com/huggingface/transformers.js/pull/1426 Full Changelog: https://github.com/huggingface/transformers.js/compare/3.7.4...3.7.5","titleGenerated":null,"titleShort":null,"breaking":"unknown","importance":null,"content":"## What's new?\r\n* Add support for GraniteMoeHybrid in https://github.com/huggingface/transformers.js/pull/1426\r\n\r\n\r\n**Full Changelog**: https://github.com/huggingface/transformers.js/compare/3.7.4...3.7.5","publishedAt":"2025-10-02T13:58:48.000Z","fetchedAt":"2026-04-07T17:29:35.494Z","url":"https://github.com/huggingface/transformers.js/releases/tag/3.7.5","media":[],"coverageCount":0},{"id":"rel__889F8RnHTTuo-32mrgoR","version":"3.7.4","type":"feature","title":"3.7.4","summary":"What's new? Correctly assign logits warpers in _get_logits_processor in https://github.com/huggingface/transformers.js/pull/1422 Full Changelog: https://github.com/huggingface/transformers.js/compare/3.7.3...3.7.4","titleGenerated":null,"titleShort":null,"breaking":"unknown","importance":null,"content":"## What's new?\r\n* Correctly assign logits warpers in `_get_logits_processor` in https://github.com/huggingface/transformers.js/pull/1422\r\n\r\n**Full Changelog**: https://github.com/huggingface/transformers.js/compare/3.7.3...3.7.4","publishedAt":"2025-09-29T17:40:31.000Z","fetchedAt":"2026-04-07T17:29:35.479Z","url":"https://github.com/huggingface/transformers.js/releases/tag/3.7.4","media":[],"coverageCount":0},{"id":"rel_oz_myDQ-egWDMiAvCAn1s","version":"3.7.3","type":"feature","title":"3.7.3","summary":"What's new? Unify inference chains in https://github.com/huggingface/transformers.js/pull/1399 Fix progress tracking bug by @kukudixiaoming in https://github.com/huggingface/transformers.js/pull/1405 Add support for MobileLLM-R1 (llama4_text) in…","titleGenerated":null,"titleShort":null,"breaking":"unknown","importance":null,"content":"## What's new?\r\n* Unify inference chains in https://github.com/huggingface/transformers.js/pull/1399\r\n* Fix progress tracking bug by @kukudixiaoming in https://github.com/huggingface/transformers.js/pull/1405\r\n* Add support for MobileLLM-R1 (llama4_text) in https://github.com/huggingface/transformers.js/pull/1412\r\n* Add support for VaultGemma in https://github.com/huggingface/transformers.js/pull/1413\r\n\r\n## New Contributors\r\n* @kukudixiaoming made their first contribution in https://github.com/huggingface/transformers.js/pull/1405\r\n\r\n**Full Changelog**: https://github.com/huggingface/transformers.js/compare/3.7.2...3.7.3","publishedAt":"2025-09-12T20:35:32.000Z","fetchedAt":"2026-04-07T17:29:35.479Z","url":"https://github.com/huggingface/transformers.js/releases/tag/3.7.3","media":[],"coverageCount":0},{"id":"rel_30Ii2uc5q8brdSu1a47a5","version":"3.7.2","type":"feature","title":"3.7.2","summary":"What's new? Add support for DINOv3 in https://github.com/huggingface/transformers.js/pull/1390 See here for the full list of supported models. Example: Compute image embeddings Try it out using our online demo:…","titleGenerated":null,"titleShort":null,"breaking":"unknown","importance":null,"content":"## What's new?\r\n* Add support for DINOv3 in https://github.com/huggingface/transformers.js/pull/1390\r\n\r\n    See [here](https://huggingface.co/models?library=transformers.js&other=dinov3&sort=trending) for the full list of supported models.\r\n\r\n    **Example**: Compute image embeddings\r\n    ```js\r\n    import { pipeline } from '@huggingface/transformers';\r\n    \r\n    const image_feature_extractor = await pipeline(\r\n        'image-feature-extraction',\r\n        'onnx-community/dinov3-vits16-pretrain-lvd1689m-ONNX',\r\n    );\r\n    const url = 'https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/cats.png';\r\n    const features = await image_feature_extractor(url);\r\n    console.log(features);\r\n    ```\r\n\r\n\r\n    Try it out using our [online demo](https://huggingface.co/spaces/webml-community/dinov3-web):\r\n\r\n    https://github.com/user-attachments/assets/7b46f225-1699-467a-9d62-87c0ef497029\r\n\r\n\r\n\r\n**Full Changelog**: https://github.com/huggingface/transformers.js/compare/3.7.1...3.7.2","publishedAt":"2025-08-15T17:58:06.000Z","fetchedAt":"2026-04-07T17:29:35.479Z","url":"https://github.com/huggingface/transformers.js/releases/tag/3.7.2","media":[],"coverageCount":0},{"id":"rel_RJ4_5GeIwEY0t5OneafcX","version":"3.7.1","type":"feature","title":"3.7.1","summary":"What's new? Add support for Arcee in https://github.com/huggingface/transformers.js/pull/1377 Optimize tensor.slice() by @Honry in https://github.com/huggingface/transformers.js/pull/1381 New Contributors @Honry made their first contribution in…","titleGenerated":null,"titleShort":null,"breaking":"unknown","importance":null,"content":"## What's new?\r\n* Add support for Arcee in https://github.com/huggingface/transformers.js/pull/1377\r\n* Optimize tensor.slice() by @Honry in https://github.com/huggingface/transformers.js/pull/1381\r\n\r\n## New Contributors\r\n* @Honry made their first contribution in https://github.com/huggingface/transformers.js/pull/1381\r\n\r\n**Full Changelog**: https://github.com/huggingface/transformers.js/compare/3.7.0...3.7.1","publishedAt":"2025-08-01T21:14:19.000Z","fetchedAt":"2026-04-07T17:29:35.479Z","url":"https://github.com/huggingface/transformers.js/releases/tag/3.7.1","media":[],"coverageCount":0},{"id":"rel_94jAS0hww9RFBPKbeE0QB","version":"3.7.0","type":"feature","title":"3.7.0","summary":"🚀 Transformers.js v3.7 — Voxtral, LFM2, ModernBERT Decoder 🤖 New models This update adds support for 3 new architectures: Voxtral LFM2 ModernBERT Decoder <h3 id=\"new-models-voxtral\">Voxtral</h2> Voxtral Mini is an enhancement of Ministral 3B, incorporating state-of-the-art…","titleGenerated":null,"titleShort":null,"breaking":"unknown","importance":null,"content":"# 🚀 Transformers.js v3.7 — Voxtral, LFM2, ModernBERT Decoder\r\n\r\n## 🤖 New models\r\n\r\nThis update adds support for 3 new architectures:\r\n\r\n- [Voxtral](#new-models-voxtral)\r\n- [LFM2](#new-models-lfm2)\r\n- [ModernBERT Decoder](#new-models-modernbert-decoder)\r\n\r\n<h3 id=\"new-models-voxtral\">Voxtral</h2>\r\n\r\nVoxtral Mini is an enhancement of [Ministral 3B](https://mistral.ai/news/ministraux), incorporating state-of-the-art audio input capabilities while retaining best-in-class text performance. It excels at speech transcription, translation and audio understanding. ONNX weights for Voxtral-Mini-3B-2507 can be found [here](https://huggingface.co/onnx-community/Voxtral-Mini-3B-2507-ONNX). Learn more about Voxtral in the release [blog post](https://mistral.ai/news/voxtral).\r\n\r\nTry it out with our [online demo](https://huggingface.co/spaces/webml-community/Voxtral-WebGPU):\r\n\r\nhttps://github.com/user-attachments/assets/e1b95fe1-461d-4cb9-8fe8-5ec17e6c93f0\r\n\r\n\r\n**Example**: Audio transcription\r\n```js\r\nimport { VoxtralForConditionalGeneration, VoxtralProcessor, TextStreamer, read_audio } from \"@huggingface/transformers\";\r\n\r\n// Load the processor and model\r\nconst model_id = \"onnx-community/Voxtral-Mini-3B-2507-ONNX\";\r\nconst processor = await VoxtralProcessor.from_pretrained(model_id);\r\nconst model = await VoxtralForConditionalGeneration.from_pretrained(\r\n    model_id,\r\n    {\r\n        dtype: {\r\n            embed_tokens: \"fp16\", // \"fp32\", \"fp16\", \"q8\", \"q4\"\r\n            audio_encoder: \"q4\", // \"fp32\", \"fp16\", \"q8\", \"q4\", \"q4f16\"\r\n            decoder_model_merged: \"q4\", // \"q4\", \"q4f16\"\r\n        },\r\n        device: \"webgpu\",\r\n    },\r\n);\r\n\r\n// Prepare the conversation\r\nconst conversation = [\r\n    {\r\n        \"role\": \"user\",\r\n        \"content\": [\r\n            { \"type\": \"audio\" },\r\n            { \"type\": \"text\", \"text\": \"lang:en [TRANSCRIBE]\" },\r\n        ],\r\n    }\r\n];\r\nconst text = processor.apply_chat_template(conversation, { tokenize: false });\r\nconst audio = await read_audio(\"http://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/mlk.wav\", 16000);\r\nconst inputs = await processor(text, audio);\r\n\r\n// Generate the response\r\nconst generated_ids = await model.generate({\r\n    ...inputs,\r\n    max_new_tokens: 256,\r\n    streamer: new TextStreamer(processor.tokenizer, { skip_special_tokens: true, skip_prompt: true }),\r\n});\r\n\r\n// Decode the generated tokens\r\nconst new_tokens = generated_ids.slice(null, [inputs.input_ids.dims.at(-1), null]);\r\nconst generated_texts = processor.batch_decode(\r\n    new_tokens,\r\n    { skip_special_tokens: true },\r\n);\r\nconsole.log(generated_texts[0]);\r\n// I have a dream that one day this nation will rise up and live out the true meaning of its creed.\r\n```\r\n\r\nAdded in https://github.com/huggingface/transformers.js/pull/1373 and https://github.com/huggingface/transformers.js/pull/1375.\r\n\r\n<h3 id=\"new-models-lfm2\">LFM2</h2>\r\n\r\nLFM2 is a new generation of hybrid models developed by [Liquid AI](https://www.liquid.ai/), specifically designed for edge AI and on-device deployment. It sets a new standard in terms of quality, speed, and memory efficiency.\r\n\r\nThe models, which we have converted to ONNX, come in three different sizes: [350M](https://huggingface.co/onnx-community/LFM2-350M-ONNX), [700M](https://huggingface.co/onnx-community/LFM2-700M-ONNX), and [1.2B](https://huggingface.co/onnx-community/LFM2-1.2B-ONNX) parameters.\r\n\r\n**Example**: Text-generation with LFM2-350M:\r\n\r\n```js\r\nimport { pipeline, TextStreamer } from \"@huggingface/transformers\";\r\n\r\n// Create a text generation pipeline\r\nconst generator = await pipeline(\r\n  \"text-generation\",\r\n  \"onnx-community/LFM2-350M-ONNX\",\r\n  { dtype: \"q4\" },\r\n);\r\n\r\n// Define the list of messages\r\nconst messages = [\r\n  { role: \"system\", content: \"You are a helpful assistant.\" },\r\n  { role: \"user\", content: \"What is the capital of France?\" },\r\n];\r\n\r\n// Generate a response\r\nconst output = await generator(messages, {\r\n    max_new_tokens: 512,\r\n    do_sample: false,\r\n    streamer: new TextStreamer(generator.tokenizer, { skip_prompt: true, skip_special_tokens: true }),\r\n});\r\nconsole.log(output[0].generated_text.at(-1).content);\r\n// The capital of France is Paris. It is a vibrant city known for its historical landmarks, art, fashion, and gastronomy.\r\n```\r\n\r\nAdded in https://github.com/huggingface/transformers.js/pull/1367 and https://github.com/huggingface/transformers.js/pull/1369.\r\n\r\n\r\n<h3 id=\"new-models-modernbert-decoder\">ModernBERT Decoder</h2>\r\n\r\nThese models form part of the Ettin suite: the first collection of paired encoder-only and decoder-only models trained with identical data, architecture, and training recipes. Ettin enables fair comparisons between encoder and decoder architectures across multiple scales, providing state-of-the-art performance for open-data models in their respective size categories.\r\n\r\nThe list of supported models can be found [here](https://huggingface.co/models?library=transformers.js&other=modernbert-decoder&sort=trending).\r\n\r\n```js\r\nimport { pipeline, TextStreamer } from \"@huggingface/transformers\";\r\n\r\n// Create a text generation pipeline\r\nconst generator = await pipeline(\r\n  \"text-generation\",\r\n  \"onnx-community/ettin-decoder-150m-ONNX\",\r\n  { dtype: \"fp32\" },\r\n);\r\n\r\n// Generate a response\r\nconst text = \"Q: What is the capital of France?\\nA:\";\r\nconst output = await generator(text, {\r\n  max_new_tokens: 128,\r\n  streamer: new TextStreamer(generator.tokenizer, { skip_prompt: true, skip_special_tokens: true }),\r\n});\r\nconsole.log(output[0].generated_text);\r\n```\r\n\r\nAdded in https://github.com/huggingface/transformers.js/pull/1371.\r\n\r\n\r\n##  🛠️ Other improvements\r\n\r\n* Add special tokens in text-generation pipeline if tokenizer requires in https://github.com/huggingface/transformers.js/pull/1370\r\n\r\n\r\n**Full Changelog**: https://github.com/huggingface/transformers.js/compare/3.6.3...3.7.0","publishedAt":"2025-07-23T03:12:34.000Z","fetchedAt":"2026-04-07T17:29:35.479Z","url":"https://github.com/huggingface/transformers.js/releases/tag/3.7.0","media":[],"coverageCount":0},{"id":"rel_srT-1BIgfPJVzBjPhPbBg","version":"3.6.3","type":"feature","title":"3.6.3","summary":"What's new? Bump @huggingface/jinja to version 0.5.1 for new chat template functionality in https://github.com/huggingface/transformers.js/pull/1364 Full Changelog: https://github.com/huggingface/transformers.js/compare/3.6.2...3.6.3","titleGenerated":null,"titleShort":null,"breaking":"unknown","importance":null,"content":"## What's new?\r\n* Bump `@huggingface/jinja` to version 0.5.1 for new chat template functionality in https://github.com/huggingface/transformers.js/pull/1364\r\n\r\n\r\n**Full Changelog**: https://github.com/huggingface/transformers.js/compare/3.6.2...3.6.3","publishedAt":"2025-07-11T20:11:55.000Z","fetchedAt":"2026-04-07T17:29:35.504Z","url":"https://github.com/huggingface/transformers.js/releases/tag/3.6.3","media":[],"coverageCount":0},{"id":"rel_YAMqHvN28JGvF5SAfL4Qh","version":"3.6.2","type":"feature","title":"3.6.2","summary":"What's new? Add support for SmolLM3 in https://github.com/huggingface/transformers.js/pull/1359 SmolLM3 is a 3B parameter language model designed to push the boundaries of small models. It supports 6 languages, advanced reasoning and long context. SmolLM3 is a fully open model…","titleGenerated":null,"titleShort":null,"breaking":"unknown","importance":null,"content":"## What's new?\r\n* Add support for SmolLM3 in https://github.com/huggingface/transformers.js/pull/1359\r\n\r\n    SmolLM3 is a 3B parameter language model designed to push the boundaries of small models. It supports 6 languages, advanced reasoning and long context. SmolLM3 is a fully open model that offers strong performance at the 3B–4B scale.\r\n\r\n\r\n    <img src=\"https://cdn-uploads.huggingface.co/production/uploads/61c141342aac764ce1654e43/zy0dqTCCt5IHmuzwoqtJ9.png\" />\r\n     \r\n    **Example:**\r\n    ```js\r\n    import { pipeline, TextStreamer } from \"@huggingface/transformers\";\r\n    \r\n    // Create a text generation pipeline\r\n    const generator = await pipeline(\r\n      \"text-generation\",\r\n      \"HuggingFaceTB/SmolLM3-3B-ONNX\",\r\n      { dtype: \"q4f16\" },\r\n    );\r\n    \r\n    // Define the list of messages\r\n    const messages = [\r\n      { role: \"system\", content: \"You are SmolLM, a language model created by Hugging Face. If asked by the user, here is some information about you: SmolLM has 3 billion parameters and can converse in 6 languages: English, Spanish, German, French, Italian, and Portuguese. SmolLM is a fully open model and was trained on a diverse mix of public datasets./think\" },\r\n      { role: \"user\", content: \"Solve the equation x^2 - 3x + 2 = 0\" },\r\n    ];\r\n    \r\n    // Generate a response\r\n    const output = await generator(messages, {\r\n        max_new_tokens: 1024,\r\n        do_sample: false,\r\n        streamer: new TextStreamer(generator.tokenizer, { skip_prompt: true, skip_special_tokens: true }),\r\n    });\r\n    console.log(output[0].generated_text.at(-1).content);\r\n    ```\r\n\r\n* Add support for ERNIE-4.5 in https://github.com/huggingface/transformers.js/pull/1354\r\n    **Example:**\r\n    ```js\r\n    import { pipeline, TextStreamer } from \"@huggingface/transformers\";\r\n    \r\n    // Create a text generation pipeline\r\n    const generator = await pipeline(\r\n      \"text-generation\",\r\n      \"onnx-community/ERNIE-4.5-0.3B-ONNX\",\r\n      { dtype: \"fp32\" }, // Options: \"fp32\", \"fp16\", \"q8\", \"q4\", \"q4f16\"\r\n    );\r\n    \r\n    // Define the list of messages\r\n    const messages = [\r\n      { role: \"system\", content: \"You are a helpful assistant.\" },\r\n      { role: \"user\", content: \"What is the capital of France?\" },\r\n    ];\r\n    \r\n    // Generate a response\r\n    const output = await generator(messages, {\r\n        max_new_tokens: 512,\r\n        do_sample: false,\r\n        streamer: new TextStreamer(generator.tokenizer, { skip_prompt: true, skip_special_tokens: true }),\r\n    });\r\n    console.log(output[0].generated_text.at(-1).content);\r\n    // The capital of France is Paris.\r\n    ```\r\n\r\n\r\n\r\n**Full Changelog**: https://github.com/huggingface/transformers.js/compare/3.6.1...3.6.2","publishedAt":"2025-07-08T17:46:17.000Z","fetchedAt":"2026-04-07T17:29:35.504Z","url":"https://github.com/huggingface/transformers.js/releases/tag/3.6.2","media":[],"coverageCount":0},{"id":"rel_LOu9N5Boz49cKmKU7IQLH","version":"3.6.1","type":"feature","title":"3.6.1","summary":"What's new? Add support for NeoBERT in https://github.com/huggingface/transformers.js/pull/1350 Improve webworker detection to support ServiceWorker and SharedWorker by @aungKhantPaing in https://github.com/huggingface/transformers.js/pull/1346 Pin numpy version for scripts by…","titleGenerated":null,"titleShort":null,"breaking":"unknown","importance":null,"content":"## What's new?\r\n* Add support for NeoBERT in https://github.com/huggingface/transformers.js/pull/1350\r\n    \r\n    ```js\r\n    import { pipeline } from \"@huggingface/transformers\";\r\n    \r\n    // Create feature extraction pipeline\r\n    const extractor = await pipeline(\"feature-extraction\", \"onnx-community/NeoBERT-ONNX\");\r\n    \r\n    // Compute embeddings\r\n    const text = \"NeoBERT is the most efficient model of its kind!\";\r\n    const embedding = await extractor(text, { pooling: \"cls\" });\r\n    console.log(embedding.dims); // [1, 768]\r\n    ```\r\n\r\n* Improve webworker detection to support ServiceWorker and SharedWorker by @aungKhantPaing in https://github.com/huggingface/transformers.js/pull/1346\r\n* Pin numpy version for scripts by @fidoriel in https://github.com/huggingface/transformers.js/pull/1351\r\n* Fix optional `from_pretrained` types in https://github.com/huggingface/transformers.js/pull/1352\r\n\r\n## New Contributors\r\n* @aungKhantPaing made their first contribution in https://github.com/huggingface/transformers.js/pull/1346\r\n* @fidoriel made their first contribution in https://github.com/huggingface/transformers.js/pull/1351\r\n\r\n**Full Changelog**: https://github.com/huggingface/transformers.js/compare/3.6.0...3.6.1","publishedAt":"2025-07-02T05:20:41.000Z","fetchedAt":"2026-04-07T17:29:35.504Z","url":"https://github.com/huggingface/transformers.js/releases/tag/3.6.1","media":[],"coverageCount":0},{"id":"rel_u52_l6aPDGg5jtwj1Qwy3","version":"3.6.0","type":"feature","title":"3.6.0","summary":"🚀 Transformers.js v3.6 — Gemma 3n, Qwen3-Embedding, Llava-Qwen2 🤖 New models Gemma 3n Qwen3-Embedding Llava-Qwen2 🛠️ Other improvements <h2 id=\"new-models\">🤖 New models</h2> <h3 id=\"new-models-gemma3n\">Gemma 3n</h2> Gemma 3n, which was announced as a _preview_ during Google…","titleGenerated":null,"titleShort":null,"breaking":"unknown","importance":null,"content":"# 🚀 Transformers.js v3.6 — Gemma 3n, Qwen3-Embedding, Llava-Qwen2\r\n\r\n- [🤖 New models](#new-models)\r\n    - [Gemma 3n](#new-models-gemma3n)\r\n    - [Qwen3-Embedding](#new-models-qwen3-embedding)\r\n    - [Llava-Qwen2](#new-models-llava-qwen2)\r\n\r\n- [🛠️ Other improvements](#other-improvements)\r\n\r\n<h2 id=\"new-models\">🤖 New models</h2>\r\n\r\n<h3 id=\"new-models-gemma3n\">Gemma 3n</h2>\r\n\r\nGemma 3n, which was announced as a _preview_ during Google I/O, is a model that is designed from the ground up to **run locally** on your hardware. On top of that, it's natively **multimodal**, supporting image, text, audio, and video inputs 🤯\r\n\r\nGemma 3n models have multiple architecture innovations:\r\n* They are available in two sizes based on [effective parameters](https://ai.google.dev/gemma/docs/gemma-3n#parameters). While the raw parameter count of this model is 6B, the architecture design allows the model to be run with a memory footprint comparable to a traditional 2B model by offloading low-utilization matrices from the accelerator.\r\n* They use a MatFormer architecture that allows nesting sub-models within the [E4B model](https://huggingface.co/google/gemma-3n-E4B-it). We provide one sub-model (this model repository), or you can access a spectrum of custom-sized models using the [Mix-and-Match method](https://goo.gle/gemma3n-matformer-lab).\r\n\r\nLearn more about these techniques in the [technical blog post](https://developers.googleblog.com/en/introducing-gemma-3n-developer-guide) and the [Gemma documentation](https://ai.google.dev/gemma/docs/gemma-3n). \r\n\r\n\r\nAs part of the release, we are releasing ONNX weights for the `gemma-3n-E2B-it` variant ([link](https://huggingface.co/onnx-community/gemma-3n-E2B-it-ONNX)), making it compatible with Transformers.js:\r\n\r\n> [!WARNING]  \r\n> Due to the model's large size, we currently only support Node.js, Deno, and Bun execution.\r\n> In-browser WebGPU support is actively being worked on, so stay tuned for an update!\r\n\r\n**Example:** Caption an image\r\n\r\n```js\r\nimport {\r\n  AutoProcessor,\r\n  AutoModelForImageTextToText,\r\n  load_image,\r\n  TextStreamer,\r\n} from \"@huggingface/transformers\";\r\n\r\n// Load processor and model\r\nconst model_id = \"onnx-community/gemma-3n-E2B-it-ONNX\";\r\nconst processor = await AutoProcessor.from_pretrained(model_id);\r\nconst model = await AutoModelForImageTextToText.from_pretrained(model_id, {\r\n  dtype: {\r\n    embed_tokens: \"q8\",\r\n    audio_encoder: \"q8\",\r\n    vision_encoder: \"fp16\",\r\n    decoder_model_merged: \"q4\",\r\n  },\r\n  device: \"cpu\", // NOTE: WebGPU support coming soon!\r\n});\r\n\r\n// Prepare prompt\r\nconst messages = [\r\n  {\r\n    role: \"user\",\r\n    content: [\r\n      { type: \"image\" },\r\n      { type: \"text\", text: \"Describe this image in detail.\" },\r\n    ],\r\n  },\r\n];\r\nconst prompt = processor.apply_chat_template(messages, {\r\n  add_generation_prompt: true,\r\n});\r\n\r\n// Prepare inputs\r\nconst url = \"https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/bee.jpg\";\r\nconst image = await load_image(url);\r\nconst audio = null;\r\nconst inputs = await processor(prompt, image, audio, {\r\n  add_special_tokens: false,\r\n});\r\n\r\n// Generate output\r\nconst outputs = await model.generate({\r\n  ...inputs,\r\n  max_new_tokens: 512,\r\n  do_sample: false,\r\n  streamer: new TextStreamer(processor.tokenizer, {\r\n    skip_prompt: true,\r\n    skip_special_tokens: false,\r\n    // callback_function: (text) => { /* Do something with the streamed output */ },\r\n  }),\r\n});\r\n\r\n// Decode output\r\nconst decoded = processor.batch_decode(\r\n  outputs.slice(null, [inputs.input_ids.dims.at(-1), null]),\r\n  { skip_special_tokens: true },\r\n);\r\nconsole.log(decoded[0]);\r\n```\r\n\r\n<details>\r\n\r\n<summary>See example output</summary>\r\n\r\n```\r\nThe image is a close-up, slightly macro shot of a cluster of vibrant pink cosmos flowers in full bloom. The flowers are the focal point, with their delicate, slightly ruffled petals radiating outwards. They have a soft, almost pastel pink hue, and their edges are subtly veined. \r\n\r\nA small, dark-colored bee is actively visiting one of the pink flowers, its body positioned near the center of the bloom. The bee appears to be collecting pollen or nectar. \r\n\r\nThe flowers are attached to slender, brownish-green stems, and some of the surrounding foliage is visible in a blurred background, suggesting a natural outdoor setting. There are also hints of other flowers in the background, including some red ones, adding a touch of contrast to the pink. \r\n\r\nThe lighting in the image seems to be natural daylight, casting soft shadows and highlighting the textures of the petals and the bee. The overall impression is one of delicate beauty and the gentle activity of nature.\r\n```\r\n\r\n</details>\r\n\r\n**Example:** Transcribe audio\r\n\r\n```js\r\nimport {\r\n  AutoProcessor,\r\n  AutoModelForImageTextToText,\r\n  TextStreamer,\r\n} from \"@huggingface/transformers\";\r\nimport wavefile from \"wavefile\";\r\n\r\n// Load processor and model\r\nconst model_id = \"onnx-community/gemma-3n-E2B-it-ONNX\";\r\nconst processor = await AutoProcessor.from_pretrained(model_id);\r\nconst model = await AutoModelForImageTextToText.from_pretrained(model_id, {\r\n  dtype: {\r\n    embed_tokens: \"q8\",\r\n    audio_encoder: \"q4\",\r\n    vision_encoder: \"fp16\",\r\n    decoder_model_merged: \"q4\",\r\n  },\r\n  device: \"cpu\", // NOTE: WebGPU support coming soon!\r\n});\r\n\r\n// Prepare prompt\r\nconst messages = [\r\n  {\r\n    role: \"user\",\r\n    content: [\r\n      { type: \"audio\" },\r\n      { type: \"text\", text: \"Transcribe this audio verbatim.\" },\r\n    ],\r\n  },\r\n];\r\nconst prompt = processor.apply_chat_template(messages, {\r\n  add_generation_prompt: true,\r\n});\r\n\r\n// Prepare inputs\r\nconst url = \"https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/jfk.wav\";\r\nconst buffer = Buffer.from(await fetch(url).then((x) => x.arrayBuffer()));\r\nconst wav = new wavefile.WaveFile(buffer);\r\nwav.toBitDepth(\"32f\"); // Pipeline expects input as a Float32Array\r\nwav.toSampleRate(processor.feature_extractor.config.sampling_rate);\r\nlet audioData = wav.getSamples();\r\nif (Array.isArray(audioData)) {\r\n  if (audioData.length > 1) {\r\n    for (let i = 0; i < audioData[0].length; ++i) {\r\n      audioData[0][i] = (Math.sqrt(2) * (audioData[0][i] + audioData[1][i])) / 2;\r\n    }\r\n  }\r\n  audioData = audioData[0];\r\n}\r\n\r\nconst image = null;\r\nconst audio = audioData;\r\nconst inputs = await processor(prompt, image, audio, {\r\n  add_special_tokens: false,\r\n});\r\n\r\n// Generate output\r\nconst outputs = await model.generate({\r\n  ...inputs,\r\n  max_new_tokens: 512,\r\n  do_sample: false,\r\n  streamer: new TextStreamer(processor.tokenizer, {\r\n    skip_prompt: true,\r\n    skip_special_tokens: false,\r\n    // callback_function: (text) => { /* Do something with the streamed output */ },\r\n  }),\r\n});\r\n\r\n// Decode output\r\nconst decoded = processor.batch_decode(\r\n  outputs.slice(null, [inputs.input_ids.dims.at(-1), null]),\r\n  { skip_special_tokens: true },\r\n);\r\nconsole.log(decoded[0]);\r\n```\r\n\r\n<details>\r\n\r\n<summary>See example output</summary>\r\n\r\n```\r\nAnd so, my fellow Americans, ask not what your country can do for you. Ask what you can do for your country.\r\n```\r\n\r\n</details>\r\n\r\n\r\n\r\n<h3 id=\"new-models-qwen3-embed\">Qwen3-Embedding</h2>\r\n\r\nThe Qwen3 Embedding model series is the latest proprietary model of the Qwen family, specifically designed for text embedding and ranking tasks. Building upon the dense foundational models of the Qwen3 series, it provides a comprehensive range of text embeddings and reranking models in various sizes (0.6B, 4B, and 8B). This series inherits the exceptional multilingual capabilities, long-text understanding, and reasoning skills of its foundational model.\r\n\r\nYou can run it with Transformers.js as follows:\r\n\r\n```js\r\nimport { pipeline, matmul } from \"@huggingface/transformers\";\r\n\r\n// Create a feature extraction pipeline\r\nconst extractor = await pipeline(\r\n  \"feature-extraction\",\r\n  \"onnx-community/Qwen3-Embedding-0.6B-ONNX\",\r\n  {\r\n    dtype: \"fp32\", // Options: \"fp32\", \"fp16\", \"q8\"\r\n    // device: \"webgpu\",\r\n  },\r\n);\r\n\r\nfunction get_detailed_instruct(task_description, query) {\r\n  return `Instruct: ${task_description}\\nQuery:${query}`;\r\n}\r\n\r\n// Each query must come with a one-sentence instruction that describes the task\r\nconst task = \"Given a web search query, retrieve relevant passages that answer the query\";\r\nconst queries = [\r\n  get_detailed_instruct(task, \"What is the capital of China?\"),\r\n  get_detailed_instruct(task, \"Explain gravity\"),\r\n];\r\n\r\n// No need to add instruction for retrieval documents\r\nconst documents = [\r\n  \"The capital of China is Beijing.\",\r\n  \"Gravity is a force that attracts two bodies towards each other. It gives weight to physical objects and is responsible for the movement of planets around the sun.\",\r\n];\r\nconst input_texts = [...queries, ...documents];\r\n\r\n// Extract embeddings for queries and documents\r\nconst output = await extractor(input_texts, {\r\n  pooling: \"last_token\",\r\n  normalize: true,\r\n});\r\nconst scores = await matmul(\r\n  output.slice([0, queries.length]), // Query embeddings\r\n  output.slice([queries.length, null]).transpose(1, 0), // Document embeddings\r\n);\r\nconsole.log(scores.tolist());\r\n// [\r\n//   [ 0.7645590305328369, 0.14142560958862305 ],\r\n//   [ 0.13549776375293732, 0.599955141544342 ]\r\n// ]\r\n```\r\n\r\n\r\n<h3 id=\"new-models-llava-qwen2\">Llava-Qwen2</h2>\r\n\r\nFinally, we also added support for Llava models with a Qwen2 text backbone:\r\n\r\n```js\r\nimport {\r\n  AutoProcessor,\r\n  AutoModelForImageTextToText,\r\n  load_image,\r\n  TextStreamer,\r\n} from \"@huggingface/transformers\";\r\n\r\n// Load processor and model\r\nconst model_id = \"onnx-community/FastVLM-0.5B-ONNX\";\r\nconst processor = await AutoProcessor.from_pretrained(model_id);\r\nconst model = await AutoModelForImageTextToText.from_pretrained(model_id, {\r\n  dtype: {\r\n    embed_tokens: \"fp16\",\r\n    vision_encoder: \"q4\",\r\n    decoder_model_merged: \"q4\",\r\n  },\r\n});\r\n\r\n// Prepare prompt\r\nconst messages = [\r\n  {\r\n    role: \"user\",\r\n    content: \"<image>Describe this image in detail.\",\r\n  },\r\n];\r\nconst prompt = processor.apply_chat_template(messages, {\r\n  add_generation_prompt: true,\r\n});\r\n\r\n// Prepare inputs\r\nconst url = \"https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/bee.jpg\";\r\nconst image = await load_image(url);\r\nconst inputs = await processor(image, prompt, {\r\n  add_special_tokens: false,\r\n});\r\n\r\n// Generate output\r\nconst outputs = await model.generate({\r\n  ...inputs,\r\n  max_new_tokens: 512,\r\n  do_sample: false,\r\n  streamer: new TextStreamer(processor.tokenizer, {\r\n    skip_prompt: true,\r\n    skip_special_tokens: false,\r\n    // callback_function: (text) => { /* Do something with the streamed output */ },\r\n  }),\r\n});\r\n\r\n// Decode output\r\nconst decoded = processor.batch_decode(\r\n  outputs.slice(null, [inputs.input_ids.dims.at(-1), null]),\r\n  { skip_special_tokens: true },\r\n);\r\nconsole.log(decoded[0]);\r\n```\r\n\r\n<details>\r\n\r\n<summary>See here for example output</summary>\r\n\r\n```\r\nThe image depicts a vibrant and colorful scene featuring a variety of flowers and plants. The main focus is on a striking pink flower with a dark center, which appears to be a type of petunia. The petals are a rich, deep pink, and the flower has a classic, slightly ruffled appearance. The dark center of the flower is a contrasting color, likely a deep purple or black, which adds to the flower's visual appeal.\r\n\r\nIn the background, there are several other flowers and plants, each with their unique colors and shapes. To the left, there is a red flower with a bright, vivid hue, which stands out against the pink flower. The red flower has a more rounded shape and a lighter center, with petals that are a lighter shade of red compared to the pink flower.\r\n\r\nTo the right of the pink flower, there is a plant with red flowers, which are smaller and more densely packed. The red flowers are a deep, rich red color, and they have a more compact shape compared to the pink flower.\r\n\r\nIn the foreground, there is a green plant with a few leaves and a few small flowers. The leaves are a bright green color, and the flowers are a lighter shade of green, with a few petals that are slightly open.\r\n\r\nOverall, the image is a beautiful representation of a garden or natural setting, with a variety of flowers and plants that are in full bloom. The colors are vibrant and the composition is well-balanced, with the pink flower in the center drawing the viewer's attention.\r\n```\r\n\r\n</details>\r\n\r\n<h2 id=\"other-improvements\">🛠️ Other improvements</h2>\r\n\r\n* Improve detection & usage of deno/bun in https://github.com/huggingface/transformers.js/pull/1333\r\n* Add eos/last_token pooling in https://github.com/huggingface/transformers.js/pull/1335\r\n\r\n\r\n**Full Changelog**: https://github.com/huggingface/transformers.js/compare/3.5.2...3.6.0","publishedAt":"2025-06-26T15:48:28.000Z","fetchedAt":"2026-04-07T17:29:35.504Z","url":"https://github.com/huggingface/transformers.js/releases/tag/3.6.0","media":[],"coverageCount":0}],"pagination":{"nextCursor":"2025-06-26T15:48:28.000Z|2026-04-07T17:29:35.504Z|rel_u52_l6aPDGg5jtwj1Qwy3","limit":20},"summaries":{"rolling":{"windowDays":90,"summary":"Transformers.js shipped v4 with a ground-up rewrite of its WebGPU backend in C++, developed in partnership with the ONNX Runtime team. The new runtime expands operator support across roughly 200 existing model architectures plus new v4-exclusive designs, and enables the same transformers.js code to run across diverse JavaScript environments including browsers and beyond.","releaseCount":1,"generatedAt":"2026-04-07T17:29:40.319Z"},"monthly":[{"year":2026,"month":3,"summary":"Transformers.js reached v4.0.0 with a complete rewrite of its WebGPU runtime in C++, built in collaboration with the ONNX Runtime team. The new backend expanded operator support across ~200 existing model architectures plus new v4-exclusive ones, enabling the same code to run across diverse JavaScript environments.","releaseCount":1,"generatedAt":"2026-04-07T17:29:42.154Z"}]}}