Instructions to use HRusby/slimsam-77-uniform-chunked with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers.js
How to use HRusby/slimsam-77-uniform-chunked with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('mask-generation', 'HRusby/slimsam-77-uniform-chunked');
SlimSAM-77 (uniform), chunked global attention
A copy of Xenova/slimsam-77-uniform
(commit 5850ab45f587c112167512ffef949107115e26a0), the ONNX conversion of
nielsr/slimsam-77-uniform (SlimSAM), with
lower peak memory for in-browser use.
What changed: only the three vision encoders (onnx/vision_encoder.onnx,
onnx/vision_encoder_fp16.onnx, onnx/vision_encoder_quantized.onnx). Their four
global-attention layers (2, 5, 8, 11) compute attention for chunks of query rows (8 chunks for
fp32/fp16, 16 for the quantized model) and join the outputs, and two no-op casts are removed.
The weights and the maths are unchanged; the embeddings are identical to the original's
(max difference 0 on the CPU). The peak memory of an encode drops from 3.4β5.1 GB to ~1.1 GB
of GPU memory on a Pixel 8 (fp16), and from 2.4 GB to 0.9 GB with the quantized model on WASM.
All other files are copied unchanged.
How it was made: a script downloads the original files at the commit above, checks their hashes, rewrites the encoders' ONNX graphs and copies everything else; it reproduces these files byte for byte.
Licence: Apache-2.0, as the original.
- Downloads last month
- 161