{ "$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. See https://github.com/software-mansion/react-native-executorch/blob/main/MODEL_SPEC.md for the full convention.", "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", "quantized", "default"], "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; see precisions.json for the authoritative quantized/non-quantized partition." }, "quantized": { "type": "boolean" }, "default": { "type": "boolean", "description": "Exactly one variant per (quantized: true) group and one per (quantized: false) group must be default: true." }, "size_bytes": { "type": "integer", "minimum": 0 }, "methods": { "type": "object", "minProperties": 1, "additionalProperties": { "$ref": "#/$defs/methodSignature" } } }, "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" } } } }, "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" ] } } } } }