--- license: agpl-3.0 pipeline_tag: image-segmentation library_name: executorch --- # fast-sam This repository hosts the **fast-sam** models exported for the [React Native ExecuTorch](https://www.npmjs.com/package/react-native-executorch) library as ExecuTorch `.pte` programs, ready to run on device. Upstream model: [FastSAM](https://docs.ultralytics.com/models/fast-sam/) ## Variants | Path | Backend | Precision | | --- | --- | --- | | `s/coreml/fast_sam_s_coreml_fp16.pte` | coreml | fp16 | | `s/vulkan/fast_sam_s_vulkan_fp16.pte` | vulkan | fp16 | | `s/xnnpack/fast_sam_s_xnnpack_fp32.pte` | xnnpack | fp32 | | `s/xnnpack/fast_sam_s_xnnpack_int8.pte` | xnnpack | int8 | | `x/coreml/fast_sam_x_coreml_fp16.pte` | coreml | fp16 | | `x/vulkan/fast_sam_x_vulkan_fp16.pte` | vulkan | fp16 | | `x/xnnpack/fast_sam_x_xnnpack_fp32.pte` | xnnpack | fp32 | | `x/xnnpack/fast_sam_x_xnnpack_int8.pte` | xnnpack | int8 | ## XNNPACK int8 The `xnnpack/*_int8.pte` files are static int8 (PT2E, per-channel weights) with the first convolution and the Segment head kept fp32, except the mask prototype branch. Class-agnostic COCO AR@100 on the first 500 val2017 images (all categories merged, box NMS at IoU 0.9 as in the library): | | box AR@100 | mask AR@100 | | --- | --- | --- | | s fp32 | 41.65 | 36.25 | | s int8 | 41.81 | 36.13 | | x fp32 | 46.07 | 40.93 | | x int8 | 46.09 | 41.04 | ## Unshipped backends A backend directory carrying a `NOTES.md` and no `.pte` was exported and not published. Its note records what went wrong. - `s/mlx` ([why](https://huggingface.co/software-mansion/react-native-executorch-fast-sam/blob/main/s/mlx/NOTES.md)) - `x/mlx` ([why](https://huggingface.co/software-mansion/react-native-executorch-fast-sam/blob/main/x/mlx/NOTES.md)) ## Repository structure ``` config.json 30 B s/coreml/config.json 1.2 kB s/coreml/fast_sam_s_coreml_fp16.pte 23.1 MB s/mlx/NOTES.md 2.0 kB s/vulkan/config.json 1.3 kB s/vulkan/fast_sam_s_vulkan_fp16.pte 22.6 MB s/xnnpack/config.json 2.1 kB s/xnnpack/fast_sam_s_xnnpack_fp32.pte 45.2 MB s/xnnpack/fast_sam_s_xnnpack_int8.pte 18.5 MB x/coreml/config.json 1.2 kB x/coreml/fast_sam_x_coreml_fp16.pte 139 MB x/mlx/NOTES.md 2.0 kB x/vulkan/config.json 1.3 kB x/vulkan/fast_sam_x_vulkan_fp16.pte 138 MB x/xnnpack/config.json 2.1 kB x/xnnpack/fast_sam_x_xnnpack_fp32.pte 276 MB x/xnnpack/fast_sam_x_xnnpack_int8.pte 99.6 MB ``` ## Compatibility These files are published for the **ExecuTorch v1.4.1** runtime. ExecuTorch gives no forward compatibility guarantee, so an older runtime may fail to load them. To use them in React Native ExecuTorch, pass the model constant shipped in the library's model registry to the corresponding task pipeline. See the [documentation](https://docs.swmansion.com/react-native-executorch/docs/fundamentals/downloading-models). To load these files in your own ExecuTorch runtime, read the [compatibility note](https://github.com/pytorch/executorch/blob/main/runtime/COMPATIBILITY.md) first.