Lucas Gelfond • Segment Anything 2, in WebGPU
I was talking with Diego Rodriguez a few weeks ago, who encouraged me to hack together a Segment Anything 2 implementation fulling using WebGPU. That's this! It runs completely client-side, no data is sent to the server! You can read the source code here or try a demo at http://webgpu-sam2.lucasgelfond.online/. I've been curious about some of the lower-level browser APIs (WebAssembly and WebGPU) since I started doing frontend, but haven't gotten much of a chance to play with them! The new model seemed like a great excuse to learn. I started off looking a bit into the model, and trying to find some examples of people who'd gotten things working. Segment Anything 2 only came out a week or so ago, so most of the examples were for SAM-1. In web-sam and SAM-in-Browser others had used a small model called MobileSAM to do inference in the browser; it certianly seemed possible! The common approach to running models in the browser is to use Transformers.js, essentially a JS port of the famous H
I was talking with Diego Rodriguez a few weeks ago, who encouraged me to hack together a Segment Anything 2 implementation fulling using WebGPU. That's this! It runs completely client-side, no data is sent to the server! You can read the source code here or try a demo at http://webgpu-sam2.lucasgelfond.online/. Background I've been curious about some of the lower-level browser APIs (WebAssembly and WebGPU) since I started doing frontend, but haven't gotten much of a chance to play with them! The new model seemed like a great excuse to learn. I started off looking a bit into the model,…
saved by
related reading
- MLC | WebLLM: A High-Performance In-Browser LLM Inference Engineblog.mlc.ai
- Together AI | The AI Native Cloudtogether.ai
- rsmsrsms.me
- segment-geospatialsamgeo.gishub.org
- Modal: High-performance AI infrastructuremodal.com
- Wayback Machinecohost.org
- dawn - Git at Googledawn.googlesource.com
- Shadersshaders.com
- WebLLM | Homemlc.ai
- Simon Willison’s Weblogsimonwillison.net
- Replicate - Run AI with an APIreplicate.com
- Fine-tune Segment-Anything model. Tips & caveats | by Rustem Glue | Jun, 2023 | Medium | Mediummedium.com