File size: 6,338 Bytes
22314d8 eba13da 22314d8 aff7c81 22314d8 aff7c81 22314d8 dd0fe26 22314d8 402e59e 22314d8 402e59e 22314d8 c7e825d 22314d8 c7e825d 402e59e 22314d8 e07be9d 22314d8 e07be9d 22314d8 | 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 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://huggingface.co/software-mansion/react-native-executorch-spec/resolve/main/config.schema.json",
"title": "react-native-executorch model config",
"description": "Per-backend config.json published alongside .pte files in software-mansion/react-native-executorch-* repositories.",
"type": "object",
"required": [
"$schema",
"model",
"family",
"capabilities",
"backend",
"license",
"variants"
],
"additionalProperties": false,
"properties": {
"$schema": {
"type": "string",
"format": "uri"
},
"model": {
"type": "string",
"pattern": "^[a-z0-9_]+$",
"description": "Model token used in file names; lowercase, underscore-separated."
},
"family": {
"type": "string",
"pattern": "^[a-z0-9_]+$",
"description": "Loose grouping (llama, qwen, whisper, yolo, style_transfer, ...)."
},
"size": {
"type": "string",
"pattern": "^[a-z0-9_]+$",
"description": "Optional size token. Omit when the model has no size variants."
},
"capabilities": {
"type": "array",
"minItems": 1,
"uniqueItems": true,
"items": {
"enum": [
"text-generation",
"vision",
"speech-to-text",
"text-to-speech",
"classification",
"object-detection",
"semantic-segmentation",
"instance-segmentation",
"style-transfer",
"text-embedding",
"image-embedding",
"image-generation",
"voice-activity-detection",
"text-detection",
"text-recognition"
]
}
},
"backend": {
"enum": ["xnnpack", "coreml", "vulkan", "qnn", "mlx"]
},
"license": {
"type": "string",
"minLength": 1
},
"tokenizer": {
"type": "string",
"description": "Relative path to tokenizer.json, when applicable."
},
"tokenizer_config": {
"type": "string",
"description": "Relative path to tokenizer_config.json, when applicable."
},
"variants": {
"type": "array",
"minItems": 1,
"items": { "$ref": "#/$defs/variant" }
}
},
"$defs": {
"variant": {
"type": "object",
"required": ["precision"],
"additionalProperties": false,
"properties": {
"file": {
"type": ["string", "null"],
"description": "Single-file variants set this. Multi-component variants set this to null and populate `components`."
},
"components": {
"type": "object",
"minProperties": 1,
"additionalProperties": { "type": "string" },
"description": "For multi-component models (e.g. encoder/decoder, scheduler/text_encoder/unet/vae)."
},
"precision": {
"type": "string",
"pattern": "^[a-z0-9_]+$",
"description": "Precision token. precisions.json is the authoritative quantized/non-quantized partition; a variant is quantized iff its token is listed there under `quantized`."
},
"size_bytes": {
"type": "integer",
"minimum": 0
},
"methods": {
"type": "object",
"minProperties": 1,
"additionalProperties": {
"oneOf": [
{ "$ref": "#/$defs/methodSignature" },
{ "$ref": "#/$defs/componentMethods" }
]
},
"description": "Single-file variants key this by method name. Multi-component variants key it by component name, matching `components`, and nest that component's methods inside."
}
},
"oneOf": [
{
"required": ["file"],
"properties": { "file": { "type": "string", "minLength": 1 } }
},
{ "required": ["components"] }
]
},
"methodSignature": {
"type": "object",
"required": ["inputs", "outputs"],
"additionalProperties": false,
"properties": {
"inputs": {
"type": "array",
"items": { "$ref": "#/$defs/tensorSpec" }
},
"outputs": {
"type": "array",
"items": { "$ref": "#/$defs/tensorSpec" }
}
}
},
"componentMethods": {
"type": "object",
"minProperties": 1,
"additionalProperties": { "$ref": "#/$defs/methodSignature" },
"description": "One component's methods, keyed by method name. Used under `methods` when a variant sets `components`, so that components sharing a method name (several `forward`s in one pipeline) stay distinct."
},
"precisions": {
"type": "object",
"required": ["quantized", "non_quantized"],
"additionalProperties": false,
"properties": {
"$schema": { "type": "string" },
"description": { "type": "string" },
"quantized": {
"type": "array",
"minItems": 1,
"uniqueItems": true,
"items": { "type": "string", "pattern": "^[a-z0-9_]+$" }
},
"non_quantized": {
"type": "array",
"minItems": 1,
"uniqueItems": true,
"items": { "type": "string", "pattern": "^[a-z0-9_]+$" }
}
},
"description": "Shape of precisions.json, which every precision token must appear in exactly once."
},
"tensorSpec": {
"type": "object",
"required": ["shape", "dtype"],
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"minLength": 1,
"description": "Optional. Executorch .pte files do not carry user-meaningful tensor names; introspected configs use positional `input_N`/`output_N` keys via the array order instead and omit `name`. Set this when a hand-curated semantic name is available."
},
"shape": {
"type": "array",
"items": { "type": "integer" },
"description": "Use -1 for dynamic dimensions."
},
"dtype": {
"enum": [
"bool",
"int8",
"int16",
"int32",
"int64",
"uint8",
"float16",
"float32",
"float64",
"bfloat16"
]
}
}
}
}
}
|