Initial spec: config.schema.json, precisions.json, README
Browse files- README.md +33 -0
- config.schema.json +166 -0
- precisions.json +17 -0
README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
tags:
|
| 4 |
+
- react-native-executorch
|
| 5 |
+
- spec
|
| 6 |
+
---
|
| 7 |
+
|
| 8 |
+
# react-native-executorch Spec
|
| 9 |
+
|
| 10 |
+
Machine-readable specifications for
|
| 11 |
+
[`react-native-executorch`](https://github.com/software-mansion/react-native-executorch)
|
| 12 |
+
model repositories under
|
| 13 |
+
[`software-mansion`](https://huggingface.co/software-mansion).
|
| 14 |
+
|
| 15 |
+
## Contents
|
| 16 |
+
|
| 17 |
+
| File | Purpose |
|
| 18 |
+
| -------------------- | ----------------------------------------------------------------------------------------- |
|
| 19 |
+
| `config.schema.json` | JSON Schema for the per-backend `config.json` files shipped alongside each `.pte`. |
|
| 20 |
+
| `precisions.json` | Authoritative quantized / non-quantized partition for precision tokens used in file names. |
|
| 21 |
+
| `README.md` | This file. |
|
| 22 |
+
|
| 23 |
+
## Source of truth
|
| 24 |
+
|
| 25 |
+
The human-readable spec lives at
|
| 26 |
+
[`software-mansion/react-native-executorch:MODEL_SPEC.md`](https://github.com/software-mansion/react-native-executorch/blob/main/MODEL_SPEC.md).
|
| 27 |
+
Edit that document first; the artifacts here are derived from it.
|
| 28 |
+
|
| 29 |
+
## Versioning
|
| 30 |
+
|
| 31 |
+
The schema is referenced by `$schema` from every `config.json` in the
|
| 32 |
+
ecosystem. Breaking changes get a new `$id` URL and the old one stays
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
| 3 |
+
"$id": "https://huggingface.co/software-mansion/react-native-executorch-spec/resolve/main/config.schema.json",
|
| 4 |
+
"title": "react-native-executorch model config",
|
| 5 |
+
"description": "Per-backend config.json published alongside .pte files in software-mansion/react-native-executorch-* repositories. See https://github.com/software-mansion/react-native-executorch/blob/main/MODEL_SPEC.md for the full convention.",
|
| 6 |
+
"type": "object",
|
| 7 |
+
"required": [
|
| 8 |
+
"$schema",
|
| 9 |
+
"model",
|
| 10 |
+
"family",
|
| 11 |
+
"capabilities",
|
| 12 |
+
"backend",
|
| 13 |
+
"license",
|
| 14 |
+
"variants"
|
| 15 |
+
],
|
| 16 |
+
"additionalProperties": false,
|
| 17 |
+
"properties": {
|
| 18 |
+
"$schema": {
|
| 19 |
+
"type": "string",
|
| 20 |
+
"format": "uri"
|
| 21 |
+
},
|
| 22 |
+
"model": {
|
| 23 |
+
"type": "string",
|
| 24 |
+
"pattern": "^[a-z0-9_]+$",
|
| 25 |
+
"description": "Model token used in file names; lowercase, underscore-separated."
|
| 26 |
+
},
|
| 27 |
+
"family": {
|
| 28 |
+
"type": "string",
|
| 29 |
+
"pattern": "^[a-z0-9_]+$",
|
| 30 |
+
"description": "Loose grouping (llama, qwen, whisper, yolo, style_transfer, ...)."
|
| 31 |
+
},
|
| 32 |
+
"size": {
|
| 33 |
+
"type": "string",
|
| 34 |
+
"pattern": "^[a-z0-9_]+$",
|
| 35 |
+
"description": "Optional size token. Omit when the model has no size variants."
|
| 36 |
+
},
|
| 37 |
+
"capabilities": {
|
| 38 |
+
"type": "array",
|
| 39 |
+
"minItems": 1,
|
| 40 |
+
"uniqueItems": true,
|
| 41 |
+
"items": {
|
| 42 |
+
"enum": [
|
| 43 |
+
"text-generation",
|
| 44 |
+
"vision",
|
| 45 |
+
"speech-to-text",
|
| 46 |
+
"classification",
|
| 47 |
+
"object-detection",
|
| 48 |
+
"semantic-segmentation",
|
| 49 |
+
"instance-segmentation",
|
| 50 |
+
"style-transfer",
|
| 51 |
+
"text-embedding",
|
| 52 |
+
"image-embedding",
|
| 53 |
+
"image-generation",
|
| 54 |
+
"voice-activity-detection"
|
| 55 |
+
]
|
| 56 |
+
}
|
| 57 |
+
},
|
| 58 |
+
"backend": {
|
| 59 |
+
"enum": ["xnnpack", "coreml", "vulkan", "qnn"]
|
| 60 |
+
},
|
| 61 |
+
"license": {
|
| 62 |
+
"type": "string",
|
| 63 |
+
"minLength": 1
|
| 64 |
+
},
|
| 65 |
+
"tokenizer": {
|
| 66 |
+
"type": "string",
|
| 67 |
+
"description": "Relative path to tokenizer.json, when applicable."
|
| 68 |
+
},
|
| 69 |
+
"tokenizer_config": {
|
| 70 |
+
"type": "string",
|
| 71 |
+
"description": "Relative path to tokenizer_config.json, when applicable."
|
| 72 |
+
},
|
| 73 |
+
"variants": {
|
| 74 |
+
"type": "array",
|
| 75 |
+
"minItems": 1,
|
| 76 |
+
"items": { "$ref": "#/$defs/variant" }
|
| 77 |
+
}
|
| 78 |
+
},
|
| 79 |
+
"$defs": {
|
| 80 |
+
"variant": {
|
| 81 |
+
"type": "object",
|
| 82 |
+
"required": ["precision", "quantized", "default", "methods"],
|
| 83 |
+
"additionalProperties": false,
|
| 84 |
+
"properties": {
|
| 85 |
+
"file": {
|
| 86 |
+
"type": ["string", "null"],
|
| 87 |
+
"description": "Single-file variants set this. Multi-component variants set this to null and populate `components`."
|
| 88 |
+
},
|
| 89 |
+
"components": {
|
| 90 |
+
"type": "object",
|
| 91 |
+
"minProperties": 1,
|
| 92 |
+
"additionalProperties": { "type": "string" },
|
| 93 |
+
"description": "For multi-component models (e.g. encoder/decoder, scheduler/text_encoder/unet/vae)."
|
| 94 |
+
},
|
| 95 |
+
"precision": {
|
| 96 |
+
"type": "string",
|
| 97 |
+
"pattern": "^[a-z0-9_]+$",
|
| 98 |
+
"description": "Precision token; see precisions.json for the authoritative quantized/non-quantized partition."
|
| 99 |
+
},
|
| 100 |
+
"quantized": { "type": "boolean" },
|
| 101 |
+
"default": {
|
| 102 |
+
"type": "boolean",
|
| 103 |
+
"description": "Exactly one variant per (quantized: true) group and one per (quantized: false) group must be default: true."
|
| 104 |
+
},
|
| 105 |
+
"size_bytes": {
|
| 106 |
+
"type": "integer",
|
| 107 |
+
"minimum": 0
|
| 108 |
+
},
|
| 109 |
+
"methods": {
|
| 110 |
+
"type": "object",
|
| 111 |
+
"minProperties": 1,
|
| 112 |
+
"additionalProperties": { "$ref": "#/$defs/methodSignature" }
|
| 113 |
+
}
|
| 114 |
+
},
|
| 115 |
+
"oneOf": [
|
| 116 |
+
{
|
| 117 |
+
"required": ["file"],
|
| 118 |
+
"properties": { "file": { "type": "string", "minLength": 1 } }
|
| 119 |
+
},
|
| 120 |
+
{ "required": ["components"] }
|
| 121 |
+
]
|
| 122 |
+
},
|
| 123 |
+
"methodSignature": {
|
| 124 |
+
"type": "object",
|
| 125 |
+
"required": ["inputs", "outputs"],
|
| 126 |
+
"additionalProperties": false,
|
| 127 |
+
"properties": {
|
| 128 |
+
"inputs": {
|
| 129 |
+
"type": "array",
|
| 130 |
+
"items": { "$ref": "#/$defs/tensorSpec" }
|
| 131 |
+
},
|
| 132 |
+
"outputs": {
|
| 133 |
+
"type": "array",
|
| 134 |
+
"items": { "$ref": "#/$defs/tensorSpec" }
|
| 135 |
+
}
|
| 136 |
+
}
|
| 137 |
+
},
|
| 138 |
+
"tensorSpec": {
|
| 139 |
+
"type": "object",
|
| 140 |
+
"required": ["name", "shape", "dtype"],
|
| 141 |
+
"additionalProperties": false,
|
| 142 |
+
"properties": {
|
| 143 |
+
"name": { "type": "string", "minLength": 1 },
|
| 144 |
+
"shape": {
|
| 145 |
+
"type": "array",
|
| 146 |
+
"items": { "type": "integer" },
|
| 147 |
+
"description": "Use -1 for dynamic dimensions."
|
| 148 |
+
},
|
| 149 |
+
"dtype": {
|
| 150 |
+
"enum": [
|
| 151 |
+
"bool",
|
| 152 |
+
"int8",
|
| 153 |
+
"int16",
|
| 154 |
+
"int32",
|
| 155 |
+
"int64",
|
| 156 |
+
"uint8",
|
| 157 |
+
"float16",
|
| 158 |
+
"float32",
|
| 159 |
+
"float64",
|
| 160 |
+
"bfloat16"
|
| 161 |
+
]
|
| 162 |
+
}
|
| 163 |
+
}
|
| 164 |
+
}
|
| 165 |
+
}
|
| 166 |
+
}
|
precisions.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"$schema": "https://huggingface.co/software-mansion/react-native-executorch-spec/resolve/main/config.schema.json#/$defs/precisions",
|
| 3 |
+
"description": "Authoritative partition of precision tokens used in react-native-executorch model file names. A variant is quantized iff its precision token is in `quantized`.",
|
| 4 |
+
"quantized": [
|
| 5 |
+
"int8",
|
| 6 |
+
"4w",
|
| 7 |
+
"a8w8",
|
| 8 |
+
"8da4w",
|
| 9 |
+
"spinquant",
|
| 10 |
+
"qat_lora"
|
| 11 |
+
],
|
| 12 |
+
"non_quantized": [
|
| 13 |
+
"fp32",
|
| 14 |
+
"fp16",
|
| 15 |
+
"bf16"
|
| 16 |
+
]
|
| 17 |
+
}
|