Core ML: replace the int8 variant with fp16
Browse filesThe int8 build applied weight-only quantization on top of compute_precision=FLOAT32. That combination took the accuracy cost of quantization and none of the benefit: fp32 compute is the one precision the Apple Neural Engine refuses, so the model was locked onto CPU/GPU.
Measured on an iPhone 16, ExecuTorch 1.4.1, Release, 3 warmup plus 15 timed runs, median:
fp16 is 1.6x (50.3 ms -> 31.0 ms) faster than int8.
int8 was also measurably less accurate: its confident detections (score > 0.3) agreed with fp16 on only 4.3% of confident boxes at IoU 0.9. fp16 is the higher precision build, so the divergence is int8 degrading rather than fp16.
Cost: file size roughly doubles (31.6 -> 62.3 MB). int8 is removed rather than kept as a smaller option, because slower and visibly different is not a trade worth offering.
v0.9.0 and below are untouched.
|
@@ -1,18 +1,17 @@
|
|
| 1 |
{
|
| 2 |
"$schema": "https://huggingface.co/software-mansion/react-native-executorch-spec/resolve/main/config.schema.json",
|
| 3 |
-
"model": "
|
| 4 |
"family": "rfdetr",
|
| 5 |
"capabilities": [
|
| 6 |
-
"object-detection",
|
| 7 |
"instance-segmentation"
|
| 8 |
],
|
| 9 |
"backend": "coreml",
|
| 10 |
"license": "apache-2.0",
|
| 11 |
"variants": [
|
| 12 |
{
|
| 13 |
-
"file": "
|
| 14 |
-
"precision": "
|
| 15 |
-
"quantized":
|
| 16 |
"default": true,
|
| 17 |
"methods": {
|
| 18 |
"forward": {
|
|
@@ -30,7 +29,6 @@
|
|
| 30 |
"outputs": [
|
| 31 |
{
|
| 32 |
"shape": [
|
| 33 |
-
1,
|
| 34 |
100,
|
| 35 |
4
|
| 36 |
],
|
|
@@ -38,15 +36,18 @@
|
|
| 38 |
},
|
| 39 |
{
|
| 40 |
"shape": [
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
],
|
| 45 |
"dtype": "float32"
|
| 46 |
},
|
| 47 |
{
|
| 48 |
"shape": [
|
| 49 |
-
1,
|
| 50 |
100,
|
| 51 |
78,
|
| 52 |
78
|
|
|
|
| 1 |
{
|
| 2 |
"$schema": "https://huggingface.co/software-mansion/react-native-executorch-spec/resolve/main/config.schema.json",
|
| 3 |
+
"model": "rfdetr_nano_segmentation",
|
| 4 |
"family": "rfdetr",
|
| 5 |
"capabilities": [
|
|
|
|
| 6 |
"instance-segmentation"
|
| 7 |
],
|
| 8 |
"backend": "coreml",
|
| 9 |
"license": "apache-2.0",
|
| 10 |
"variants": [
|
| 11 |
{
|
| 12 |
+
"file": "rfdetr_nano_coreml_fp16.pte",
|
| 13 |
+
"precision": "fp16",
|
| 14 |
+
"quantized": false,
|
| 15 |
"default": true,
|
| 16 |
"methods": {
|
| 17 |
"forward": {
|
|
|
|
| 29 |
"outputs": [
|
| 30 |
{
|
| 31 |
"shape": [
|
|
|
|
| 32 |
100,
|
| 33 |
4
|
| 34 |
],
|
|
|
|
| 36 |
},
|
| 37 |
{
|
| 38 |
"shape": [
|
| 39 |
+
100
|
| 40 |
+
],
|
| 41 |
+
"dtype": "float32"
|
| 42 |
+
},
|
| 43 |
+
{
|
| 44 |
+
"shape": [
|
| 45 |
+
100
|
| 46 |
],
|
| 47 |
"dtype": "float32"
|
| 48 |
},
|
| 49 |
{
|
| 50 |
"shape": [
|
|
|
|
| 51 |
100,
|
| 52 |
78,
|
| 53 |
78
|
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5882a3124832a8e09c63c5395d0e855a9d7acb23c56309efdddc2f1a8ed3d62c
|
| 3 |
+
size 62341694
|