Runs in the browser · Vision + language
Run Florence-2-base-ft in your browser
Florence-2-base-ft downloads 213.1 MB over WebGPU (q4f16), or 262.2 MB over WebAssembly (uint8), to caption, detect, or segment an image using task-prompt tokens entirely in the tab with Transformers.js. No install, no server.
Vision + language · onnx-community/Florence-2-base-ft
- Parameters
- 231.6M
- Pipeline task
- custom
Reading
Florence-2 uses task-prompt tokens (for example <OD>, <CAPTION>) via Florence2ForConditionalGeneration and AutoProcessor, not a pipeline() call.
The second-smallest vision + language download in the catalog (213.1 MB).
0.92 MB/M params against a 0.72 MB/M vision + language median: dense for its parameter count.
The quant ladder spans 4.9x: 213.1 MB (q4f16) to 1.01 GB (fp32).
Will it run in your browser?
Checking for WebGPU support…
All measured variants
| Variant | Size |
|---|---|
| q4f16 WebGPU pick | 213.1 MB |
| uint8 WASM pick | 262.2 MB |
| bnb4 | 304.5 MB |
| q4 | 317.8 MB |
| fp16 | 518.8 MB |
| q8 | 524.5 MB |
| fp32 | 1.01 GB |
Sizes measured from the HuggingFace API file tree for onnx-community/Florence-2-base-ft, not estimated.
Use it with Transformers.js
import { Florence2ForConditionalGeneration, AutoProcessor, AutoTokenizer } from "@huggingface/transformers";
const model = await Florence2ForConditionalGeneration.from_pretrained("onnx-community/Florence-2-base-ft", {
device: "webgpu",
// Per-module dtype map: keep the language-model parts in fp16/fp32 for
// quality, quantize the (much larger) vision encoder/decoder to q4.
dtype: {
embed_tokens: "fp16", // or "fp32" where WebGPU fp16 (shader-f16) isn't supported
vision_encoder: "fp16", // or "fp32" where WebGPU fp16 isn't supported
encoder_model: "q4",
decoder_model_merged: "q4",
},
});
const processor = await AutoProcessor.from_pretrained("onnx-community/Florence-2-base-ft");
const tokenizer = await AutoTokenizer.from_pretrained("onnx-community/Florence-2-base-ft");
const prompt = "<MORE_DETAILED_CAPTION>"; // task-prompt token, not free text
// const inputs = await processor(image, prompt);
// const generated = await model.generate({ ...inputs, max_new_tokens: 100 });
// const result = processor.batch_decode(generated, { skip_special_tokens: false });
Requires npm install @huggingface/transformers (or the CDN build). This model needs the lower-level API shown above, not pipeline() (see the Reading panel above).
Sources
Same job, different size
FAQ
WebGPU or WASM for Florence-2-base-ft, in practice?
Chrome, Edge, and Safari 26+ run the WebGPU build (q4f16) 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 (uint8) on CPU: same model, slower to load, slower to run.
What does q4f16 mean for Florence-2-base-ft?
The WebGPU build here uses q4f16: 4-bit weights with some layers kept at 16-bit for stability: WebGPU's usual smallest clean build. The WASM fallback uses uint8: 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.