--- license: apache-2.0 library_name: executorch pipeline_tag: image-segmentation tags: - executorch - webgpu - on-device - browser --- # MODNet portrait matting for ExecuTorch WebGPU This repository contains an [ExecuTorch](https://github.com/pytorch/executorch) conversion of https://github.com/ZHKKKe/MODNet for the ExecuTorch **WebGPU** backend, so the model runs entirely in a web browser on the visitor's GPU. It powers the corresponding demo in the ExecuTorch WebGPU Playground (launching soon on [executorch.ai](https://executorch.ai)). - **Base model:** https://github.com/ZHKKKe/MODNet - **Format:** ExecuTorch `.pte` programs delegated to the WebGPU backend - **Quantization:** fp32 (as exported) - **Total size:** 24.9 MB ## Files | File | Size | SHA-256 | |---|---|---| | `modnet_webgpu.pte` | 24.9 MB | `0c2ff92e26087e98…` | Full checksums are in `manifest.json`. The playground verifies them after download. ## Running it These programs need the ExecuTorch WebGPU runtime compiled to WebAssembly ([backends/webgpu](https://github.com/pytorch/executorch/tree/main/backends/webgpu)). The easiest way to try the model is the ExecuTorch WebGPU Playground (launching soon on [executorch.ai](https://executorch.ai)), which downloads these files once, caches them in the browser, and runs everything locally. ## Provenance - **Weights:** `boopathiraj/MODNet` @ `a967175f8fd63de67a1c161d8daac966d2b57e3a`, file `modnet/pretrained/modnet_photographic_portrait_matting.ckpt`, sha256 `7c22235f0925deba15d4d63e53afcb654c47055bbcd98f56e393ab2584007ed8` (from a community mirror of the official release) - **Exported with:** executorch 1.5.1+cpu, torch 2.14.1+cpu, torchao 0.18.0+cpu, transformers 5.19.0 (executorch git `3b6068392324`) - **Reproduce:** `python recipes/modnet.py --out out/modnet` (recipe in `export/`) - Re-running the recipe produces byte-identical files. ## License This is a derivative of the upstream model and is distributed under the same terms (`apache-2.0`); see `LICENSE`. Modifications (conversion to the ExecuTorch format and quantization) by Meta Platforms, Inc.