File size: 6,996 Bytes
a5764d2
 
 
37e2eab
a5764d2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37e2eab
 
 
df61939
 
37e2eab
 
 
 
 
df61939
37e2eab
 
 
 
 
a5764d2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37e2eab
a5764d2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0142ab5
a5764d2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Model card standard

Every `software-mansion/react-native-executorch-*` repository carries a
`README.md` in this shape. Five sections are **generated** from the repository
tree and its `config.json` files, so they cannot drift from what is published.
Anything a model needs beyond them is a **free section**, written by hand and
kept as-is.

Before this standard the estate had 12 distinct heading sequences, four
heading-level conventions, and five different ExecuTorch versions claimed in
prose while 28 of 54 cards claimed none.

## Front matter

Hugging Face card metadata. Required on every repository:

| key | value |
| --- | --- |
| `license` | An SPDX-style Hub identifier for the **upstream** license, not ours. Use `other` plus `license_name` and `license_link` when the upstream license has no Hub identifier. |
| `pipeline_tag` | The Hub task this model serves, so it appears in task search. |
| `library_name` | Always `executorch`. |

Optional: `base_model`, `language`, `tags`. Keep the same identifier here and in
the `license` field of every `config.json` in the repository; they are checked
against each other.

## Generated sections

### 1. Title and introduction

The `# ` title is the repository slug with the `react-native-executorch-`
prefix dropped. One paragraph naming the library, then the upstream model on
its own line:

```markdown
# <slug>

This repository hosts the **<slug>** models exported for the
[React Native ExecuTorch](https://www.npmjs.com/package/react-native-executorch)
library as ExecuTorch `.pte` programs, ready to run on device.

Upstream model: [<name>](<url>)
```

Omit the upstream line when there is no single upstream to point at, rather
than guessing a URL.

### 2. Variants

One row per published `.pte`, read from the `variants` array of every
`config.json`.

```markdown
## Variants

| Path | Backend | Precision |
| --- | --- | --- |
| `xnnpack/model_xnnpack_fp32.pte` | xnnpack | fp32 |
| `xnnpack/model_xnnpack_int8.pte` | xnnpack | int8 |
| `coreml/model_coreml_fp16.pte` | coreml | fp16 |
```

A variant that ships several `.pte` files declares them as a `components` map
of role to filename, and contributes one row per component. Those repositories
gain a `Component` column naming the role; repositories without components do
not carry the column, so the common case stays three columns wide.

```markdown
| Path | Component | Backend | Precision |
| --- | --- | --- | --- |
| `coreml/clip_image_coreml_fp16.pte` | image | coreml | fp16 |
| `coreml/clip_text_coreml_fp16.pte` | text | coreml | fp16 |
```

The precision token is the whole story: `precisions.json` is authoritative for
which tokens are quantized, so the card does not repeat that partition. Nor
does it name a default, because the library resolves one per platform and a
second answer here would only compete with it.

### 3. Unshipped backends

Omitted unless the repository has one. A backend directory carrying a
`NOTES.md` and no `.pte` was exported and not published; the note records why,
and the card links it rather than repeating it.

```markdown
## Unshipped backends

A backend directory carrying a `NOTES.md` and no `.pte` was exported and
not published. Its note records why.

- `coreml` ([why](https://huggingface.co/software-mansion/<repo>/blob/main/coreml/NOTES.md))
```

### 4. Repository structure

Every tracked file except `README.md` and dotfiles, with its size, so a reader
can see the download cost before fetching.

```markdown
## Repository structure

​```
coreml/config.json                 1 kB
coreml/model_coreml_fp16.pte       8.3 MB
xnnpack/config.json                3 kB
xnnpack/model_xnnpack_fp32.pte     31.1 MB
​```
```

Sizes render as `B`, `kB`, `MB` or `GB`.

### 5. Compatibility

Fixed text, parameterised only by the ExecuTorch runtime version. It states
the runtime the files are **published for**, and deliberately does not claim
the version each file was exported with: that is unrecorded for older exports,
and the five conflicting numbers the cards used to carry were all stale.

No react-native-executorch version appears here. Naming one would force an
edit to every card on each library release even when neither the runtime nor
the files changed, which is exactly the drift this standard exists to stop.

```markdown
## Compatibility

These files are published for the **ExecuTorch v1.4.1** runtime. ExecuTorch
gives no forward compatibility guarantee, so an older runtime may fail to load
them.

To use them in React Native ExecuTorch, pass the model constant shipped in the
library's model registry to the corresponding task pipeline. See the
[documentation](https://docs.swmansion.com/react-native-executorch/docs/fundamentals/downloading-models).

To load these files in your own ExecuTorch runtime, read the
[compatibility note](https://github.com/pytorch/executorch/blob/main/runtime/COMPATIBILITY.md)
first.
```

Bump the version here only when the runtime the files are published for
changes.

## Free sections

Everything a model needs that neither the skeleton nor the repository's JSON
can express, appended after Compatibility at `##` level and left exactly as
written.

- `Export notes`, `CoreML notes (iOS)`: export decisions and per-backend
  caveats. These live nowhere else, so the card is their home.
- `Model details`, `Languages`, `Classes (N)`: **only** when the model is
  niche or the upstream link does not already cover it. For a model with a
  well-documented upstream this duplicates a page we do not control and
  cannot keep in sync.

Do not write a free section for:

- **The I/O contract.** The `config.json` files declare it, so restating it
  here breaks rule 5. (Two shapes are in play today, the schema and the older
  one reporting only upper bounds for dims, which is a reason to converge
  them, not to re-document I/O by hand in 54 places.)
- **Latency or benchmark numbers.** They belong on the docs page, where they
  are versioned and compared across models. Nobody looks in a model card for
  them, and a stale number here is worse than none.
- **Required preprocessing.** `models.ts` declares it, and these files are
  published to be consumed through the library, so its readers already have
  the authoritative copy. A second copy here is one more thing to keep in
  sync for an audience that does not need it.

Write a free section only when the answer to "how do I call this correctly?"
follows from neither the variant table nor the JSON.

## Rules

1. Heading levels are fixed: one `#` title, everything else `##`.
2. Never hand-edit a generated section. Fix the tree or the `config.json` and
   re-render, so the card and the artifacts cannot disagree.
3. One ExecuTorch version appears in a card, in Compatibility.
4. Free sections carry the model-specific truth. Boilerplate belongs in the
   generated skeleton, where it is written once.
5. Nothing in a card restates a fact the artifacts already hold. Derive it
   instead, so the two cannot disagree.