File size: 3,874 Bytes
a051114
 
 
 
 
 
 
 
 
 
78f861a
a051114
 
 
 
 
 
 
 
 
 
78f861a
a051114
bef4a2e
 
 
 
 
 
 
 
 
 
a051114
 
bef4a2e
 
 
 
 
 
 
a051114
78f861a
30228c8
78f861a
30228c8
a051114
 
 
 
 
 
 
bef4a2e
a051114
bef4a2e
a051114
 
 
78f861a
a051114
 
 
30228c8
 
bef4a2e
 
93b2702
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
---
license: apache-2.0
tags:
- executorch
- xnnpack
- pte
- on-device
- image-to-image
- inpainting
---
# lama_512 β€” ExecuTorch

- **Source**: advimman/lama + smartywu/big-lama weights
- **License**: Apache-2.0
- **Input**: [[1, 3, 512, 512], [1, 1, 512, 512]] β€” image RGB 0-1 [1,3,512,512] + mask [1,1,512,512] where 1 marks the region to fill
- **Output**: inpainted image [1,3,512,512] RGB 0-1, already composited with the untouched region

## Variants

All variants take and return fp32 tensors β€” swap the `.pte` file, keep your app code.

| build | file | size (MB) | parity vs fp32 eager (worst corr) | Mac median (ms)* |
|-----------|------|-----------|------------------------------------|------------------|
| fp32 | `lama_512_xnnpack_fp32.pte` | 205.0 | 1.000000 | 816.0 |
| Core ML (fp16, iOS) | `lama_512_coreml_all.pte` | 105.3 | 0.999553 | 59.2 |


The Core ML build is the same graph lowered to Apple's Neural Engine instead of
XNNPACK, which is CPU-only. Measured on an iPhone 17 Pro across seven models, it
runs **3.5x to 13.9x faster (median 12x)** at roughly half the file size β€” for
example Depth-Anything-V2-Small at 500.8 ms against 42.7 ms, and MODNet at 81.7 ms
against 5.9 ms. It computes in fp16 and is iOS-only; the XNNPACK files stay the
portable option and are what runs on Android.

\*Mac arm64, single process, median of 10 β€” a reference point for relative cost
only, not a device number (torch eager fp32 on the same machine: 526.7 ms).

### Checked in the task's own units

Correlation is a first filter. These are the numbers that decide:

- **Core ML (fp16, iOS)** β€” measured in the units that matter for this model β€” PSNR vs the fp32 .pte (dB): median 36.8776 over 5 real images, worst 36.6448.

### Builds that did not earn a slot

- **int8 is not shipped**: measured in the units that matter for this model β€” PSNR vs the fp32 .pte (dB): median 22.4666 over 5 real images, worst 21.3621.

## Verification (executorch 1.4.0, torch 2.13.0)

Parity is measured against the fp32 eager model on real image input; `corr` is
the correlation over all elements of each output tensor.

| output | shape | max_abs_diff | corr |
|--------|-------|--------------|------|
| 0 | [1, 3, 512, 512] | 7.629e-06 | 1.000000 |

XNNPACK delegate coverage (fp32): 57.4% (2884/5028 ops); ops left on the portable kernels: `aten.expand_copy.default` x576, `aten.abs.default` x460, `aten.sub.Tensor` x460, `aten.arange.start_step` x230, `aten.index.Tensor` x230, `dim_order_ops._to_dim_order_copy.default` x116, `aten.select_copy.int` x72

## Conversion

torch.export -> to_edge_transform_and_lower(partitioner) -> .pte
(conversion scripts: [executorch-models](https://github.com/john-rocky/executorch-models))

**Notes**: The inverse FFT inside every FourierUnit is replaced with the real matmul form from convert/fft_ops.py; ExecuTorch cannot lower torch.fft.irfftn. Spatial size is fixed because those matrices are built per size.

**Notes (int8)**: The inverse FFT inside every FourierUnit is replaced with the real matmul form from convert/fft_ops.py; ExecuTorch cannot lower torch.fft.irfftn. Spatial size is fixed because those matrices are built per size.

**Notes (coreml_all)**: The inverse FFT inside every FourierUnit is replaced with the real matmul form from convert/fft_ops.py; ExecuTorch cannot lower torch.fft.irfftn. Spatial size is fixed because those matrices are built per size.

<!-- funnel:v1 -->

---

**More models in this format:** [ExecuTorch Model Zoo](https://huggingface.co/collections/mlboydaisuke/executorch-model-zoo-6a7ff328390b63075ffeae5e) β€” 31 models, each with the recipe that produced it.

**Want a different model on-device?** [Open a request](https://github.com/john-rocky/on-device-requests) β€” free, open weights only; the export and its measured numbers get published publicly.

<!-- /funnel:v1 -->