Transformers.js
A JavaScript version of the Transformers library developed by Hugging Face. It relies on ONNX Runtime Web for model inference and supports WebAssembly or WebGPU backends for running AI models in the browser.
Core Facts
Timeline (last 90 days)
Listing Lab is a product-copy generation tool that runs entirely in the browser, based on the open-weight SmolLM2-360M-Instruct model, loaded via Transformers.js, and does not depend on any backend inference API.
The WASM build of llama.cpp generally offers better inference performance and more flexible quantization options than Transformers.js in pure text generation scenarios.
The tests used Transformers.js 4.2.0 to run three models on WebGPU with 4-bit weights: SmolLM2 360M Instruct, Qwen2.5 0.5B Instruct, and Llama 3.2 1B Instruct (q4f16).
The Transformers.js source code comments explicitly state that for decoder-only models, the tokens considered by repetition_penalty include the prompt.
When Transformers.js counts n-gram history, it includes the entire input_ids (including the prompt), so 3-grams that appeared in the prompt are permanently banned during the generation stage.
The rule of no_repeat_ngram_size: 3 is to prohibit generating any 3-token sequence that has already appeared, and in the Transformers.js implementation it sets the scores of these tokens to negative infinity.
BEINGS项目使用Worker + Transformers.js + WebGPU架构在浏览器中运行LLM,核心代码约90行JavaScript。
Transformers.js将模型文件存储在浏览器的Cache Storage中,第二次访问无需额外缓存代码即可快速加载。
在Next.js 16 + Turbopack项目中使用标准TypeScript worker写法会导致worker不被执行且构建无报错,需将worker手写为JavaScript放在/public目录并从CDN加载Transformers.js。
Transformers.js底层使用ONNX Runtime Web,模型需要转为ONNX格式并量化,4-bit量化的1B模型大小约1.2GB而非5GB。
16 more timeline events
All Facts (20)
Transformers.js is a JavaScript library developed by Hugging Face that, based on WebAssembly and WebGPU technology, ports Transformer model inference to browser environments.
70%UnverifiedListing Lab is a product-copy generation tool that runs entirely in the browser, based on the open-weight SmolLM2-360M-Instruct model, loaded via Transformers.js, and does not depend on any backend inference API.
50%UnverifiedThe WASM build of llama.cpp generally offers better inference performance and more flexible quantization options than Transformers.js in pure text generation scenarios.
50%UnverifiedThe Transformers.js source code comments explicitly state that for decoder-only models, the tokens considered by repetition_penalty include the prompt.
50%UnverifiedThe tests used Transformers.js 4.2.0 to run three models on WebGPU with 4-bit weights: SmolLM2 360M Instruct, Qwen2.5 0.5B Instruct, and Llama 3.2 1B Instruct (q4f16).
50%UnverifiedThe rule of no_repeat_ngram_size: 3 is to prohibit generating any 3-token sequence that has already appeared, and in the Transformers.js implementation it sets the scores of these tokens to negative infinity.
50%UnverifiedWhen Transformers.js counts n-gram history, it includes the entire input_ids (including the prompt), so 3-grams that appeared in the prompt are permanently banned during the generation stage.
50%Unverified在Next.js 16 + Turbopack项目中使用标准TypeScript worker写法会导致worker不被执行且构建无报错,需将worker手写为JavaScript放在/public目录并从CDN加载Transformers.js。
50%UnverifiedTransformers.js将模型文件存储在浏览器的Cache Storage中,第二次访问无需额外缓存代码即可快速加载。
50%UnverifiedBEINGS项目使用Worker + Transformers.js + WebGPU架构在浏览器中运行LLM,核心代码约90行JavaScript。
50%UnverifiedTransformers.js底层使用ONNX Runtime Web,模型需要转为ONNX格式并量化,4-bit量化的1B模型大小约1.2GB而非5GB。
50%UnverifiedTaskProof's optional AI component uses the FLAN-T5 Small model, running inside a browser Web Worker via Transformers.js and ONNX Runtime Web, and its role is limited to summarizing possible deliverables, asking one question for the buyer, and drafting one opening line.
50%UnverifiedTransformers.js 4.3.1 by default (when WebGPU is available or the Safari version is >= 26) chooses the asyncify build (ort-wasm-simd-threaded.asyncify.{mjs,wasm}) to load ONNX Runtime Web.
50%UnverifiedTransformers.js 4.3.1 paired with onnxruntime-web 1.31.0-dev.20260914 automatically uses the regular (non-asyncify) WebAssembly build only when the Safari version is below 26 and there is no WebGPU.
50%UnverifiedYou should use env.backends.onnx.versions.web rather than a hardcoded version number to construct the onnxruntime-web wasm file URL, to ensure the .wasm binary and .mjs glue code versions are strictly consistent and avoid runtime errors caused by ABI mismatch.
50%UnverifiedTransformers.js version 4.3.1 can be used to run AI model inference directly in the browser.
50%UnverifiedGrassToucher's AI model pipeline is designed to run open-weight models such as Google Gemma 2 and can be adapted for local execution via Ollama or Transformers.js.
50%UnverifiedBy compiling a machine learning inference engine (such as ONNX Runtime Web or Transformers.js) into a Wasm module and loading quantized model weights, image inference can be completed locally on the user's device, with photos never leaving the local device.
50%UnverifiedOpen-source frameworks such as MLC-LLM and Transformers.js are specifically optimized for browser-side inference scenarios, capable of loading model weights in ONNX, GGUF, and other formats into browser memory and executing inference.
50%UnverifiedTransformers.js v4 restructured the GitHub repository, added a packages directory, and introduced the Transformers Structured Output package.
50%