File size: 5,237 Bytes
22314d8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
aff7c81
22314d8
 
 
 
 
 
 
 
aff7c81
 
 
22314d8
 
 
 
dd0fe26
22314d8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7260084
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
{
  "$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"
          ]
        }
      }
    }
  }
}