--- license: apache-2.0 library_name: transformers.js base_model: facebook/sam2.1-hiera-tiny pipeline_tag: mask-generation tags: - onnx - sam2 - segmentation - transformers.js - onnxruntime-web --- # SAM 2.1 Hiera Tiny (ONNX, fp16) Segment Anything 2.1 (Hiera Tiny) as ONNX for [Transformers.js](https://github.com/huggingface/transformers.js), at every precision the source has. [Card Anvil](https://github.com/Card-Anvil) uses it in the browser to select the object under a click or inside a box. These are unchanged copies of the files in [`onnx-community/sam2.1-hiera-tiny-ONNX`](https://huggingface.co/onnx-community/sam2.1-hiera-tiny-ONNX) at commit [`814a066`](https://huggingface.co/onnx-community/sam2.1-hiera-tiny-ONNX/tree/814a066640debee5a91e70aa401fb8e17e030503), at the same paths, kept here so the app loads files that can't change under it. Card Anvil loads the three config files and the **fp16** encoder and decoder (`onnx/*_fp16.onnx` and their `.onnx_data`), 78 MB. The other precisions are kept for later: | Precision | Files in `onnx/` | Encoder + decoder | | --- | --- | --- | | fp32 | `vision_encoder`, `prompt_encoder_mask_decoder` | 155 MB | | fp16 (loaded) | `*_fp16` | 78 MB | | int8 / uint8 / quantized | `*_int8`, `*_uint8`, `*_quantized` | 61 MB | | q4 | `*_q4` | 51 MB | | bnb4 | `*_bnb4` | 49 MB | | q4f16 | `*_q4f16` | 33 MB | ## Credits and licence - Model: [SAM 2](https://github.com/facebookresearch/sam2) by Meta AI ([`facebook/sam2.1-hiera-tiny`](https://huggingface.co/facebook/sam2.1-hiera-tiny)), from *SAM 2: Segment Anything in Images and Videos* (2024). - ONNX conversion: [ONNX Community](https://huggingface.co/onnx-community). Licensed under the Apache License 2.0, as the original model is. See [`LICENSE`](LICENSE).