Runs in the browser · Text generation
Run Bonsai-1.7B in your browser
Bonsai-1.7B downloads 1.04 GB over WebGPU (q4), or 1.87 GB over WebAssembly (q8), to generate text entirely in the tab with Transformers.js. No install, no server.
Text generation · onnx-community/Bonsai-1.7B-ONNX
- Parameters
- 1.72B
- Pipeline task
- text-generation
Reading
Only q4 and q8 are usable measurements here; the repo's fp32 bucket bundles unrelated experimental 1-bit/2-bit files and is excluded. This is a multi-gigabyte download. Between the file size and current browser memory limits, it is impractical to run on most machines today.
Will it run in your browser?
Checking for WebGPU support…
All measured variants
| Variant | Size |
|---|---|
| q4 WebGPU pick | 1.04 GB |
| q8 WASM pick | 1.87 GB |
Sizes measured from the HuggingFace API file tree for onnx-community/Bonsai-1.7B-ONNX, not estimated.
Use it with Transformers.js
import { pipeline } from "@huggingface/transformers";
const pipe = await pipeline("text-generation", "onnx-community/Bonsai-1.7B-ONNX", {
device: "webgpu", // usually falls back to "wasm"; wrap in try/catch for production
dtype: "q4", // use "q8" for the WASM build
});
const result = await pipe(/* your input */);
Requires npm install @huggingface/transformers (or the CDN build).
Sources
Same job, different size
FAQ
WebGPU or WASM for Bonsai-1.7B, in practice?
Chrome, Edge, and Safari 26+ run the WebGPU build (q4) on the GPU. Firefox has WebGPU on Windows and Apple Silicon Macs but not everywhere yet. Any browser without a WebGPU adapter falls back automatically to the WebAssembly build (q8) on CPU: same model, slower to load, slower to run.
What does q4 mean for Bonsai-1.7B?
The WebGPU build here uses q4: 4-bit weights: a big size cut with a small, usually hard-to-notice quality trade. The WASM fallback uses q8: 8-bit integers: about a quarter the size of fp32, with a smaller quality trade than 4-bit.
Sizes measured 2026-08-01 from the HuggingFace API. Last validated 2026-08-03. See all browser models or the methodology.