Mirror homr ONNX checkpoints for the client-side build
Browse files- README.md +91 -0
- decoder_pytorch_model_465-597144cab54c8f6d0f6c9619df5c5312694eadd6.onnx +3 -0
- decoder_pytorch_model_465-597144cab54c8f6d0f6c9619df5c5312694eadd6_fp16.onnx +3 -0
- encoder_pytorch_model_465-597144cab54c8f6d0f6c9619df5c5312694eadd6.onnx +3 -0
- encoder_pytorch_model_465-597144cab54c8f6d0f6c9619df5c5312694eadd6_fp16.onnx +3 -0
- segnet_308-3296ccd40960f90ca6ab9c035cca945675d30a0f.onnx +3 -0
- segnet_308-3296ccd40960f90ca6ab9c035cca945675d30a0f_fp16.onnx +3 -0
README.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# homr ONNX checkpoints
|
| 2 |
+
|
| 3 |
+
This repository is a **mirror** of the ONNX checkpoints that
|
| 4 |
+
[liebharc/homr](https://github.com/liebharc/homr) downloads at runtime, published here
|
| 5 |
+
so that client-side (browser) builds can fetch them.
|
| 6 |
+
|
| 7 |
+
It exists because the models on homr's GitHub Release tag are served without
|
| 8 |
+
`Access-Control-Allow-Origin`, which blocks a browser from downloading them. Hugging
|
| 9 |
+
Face serves these files with CORS enabled. See `HuggingFaceModels.md` in the homr
|
| 10 |
+
repository for the full rationale and workflow.
|
| 11 |
+
|
| 12 |
+
**The source of truth is the GitHub release tag**, not this repository:
|
| 13 |
+
|
| 14 |
+
```
|
| 15 |
+
https://github.com/liebharc/homr/releases/download/onnx_checkpoints/
|
| 16 |
+
```
|
| 17 |
+
|
| 18 |
+
If the two ever disagree, the GitHub release wins.
|
| 19 |
+
|
| 20 |
+
## Models
|
| 21 |
+
|
| 22 |
+
Three models, each in fp32 and fp16:
|
| 23 |
+
|
| 24 |
+
| File | Role |
|
| 25 |
+
| --- | --- |
|
| 26 |
+
| `segnet_308-3296ccd40960f90ca6ab9c035cca945675d30a0f.onnx` | Segmentation (staff lines, note heads, stems/rests, bar lines, clefs/keys) |
|
| 27 |
+
| `segnet_308-3296ccd40960f90ca6ab9c035cca945675d30a0f_fp16.onnx` | …fp16 |
|
| 28 |
+
| `encoder_pytorch_model_465-597144cab54c8f6d0f6c9619df5c5312694eadd6.onnx` | TrOMR transformer encoder (ConvNeXt) |
|
| 29 |
+
| `encoder_pytorch_model_465-597144cab54c8f6d0f6c9619df5c5312694eadd6_fp16.onnx` | …fp16 |
|
| 30 |
+
| `decoder_pytorch_model_465-597144cab54c8f6d0f6c9619df5c5312694eadd6.onnx` | TrOMR transformer decoder, with KV cache |
|
| 31 |
+
| `decoder_pytorch_model_465-597144cab54c8f6d0f6c9619df5c5312694eadd6_fp16.onnx` | …fp16 |
|
| 32 |
+
|
| 33 |
+
Exact sizes:
|
| 34 |
+
|
| 35 |
+
| File | Size |
|
| 36 |
+
| --- | --- |
|
| 37 |
+
| `segnet_308-….onnx` | 54.66 MB |
|
| 38 |
+
| `segnet_308-…_fp16.onnx` | 27.34 MB |
|
| 39 |
+
| `encoder_pytorch_model_465-….onnx` | 50.41 MB |
|
| 40 |
+
| `encoder_pytorch_model_465-…_fp16.onnx` | 25.24 MB |
|
| 41 |
+
| `decoder_pytorch_model_465-….onnx` | 45.12 MB |
|
| 42 |
+
| `decoder_pytorch_model_465-…_fp16.onnx` | 89.61 MB |
|
| 43 |
+
|
| 44 |
+
Note that **fp16 is not smaller for the decoder** (89.61 MB vs 45.12 MB). A browser
|
| 45 |
+
build targeting WebGPU should use fp16 segnet + fp16 encoder + fp32 decoder
|
| 46 |
+
(97.7 MB total) rather than all-fp16 (292.4 MB).
|
| 47 |
+
|
| 48 |
+
## Usage in a browser
|
| 49 |
+
|
| 50 |
+
```js
|
| 51 |
+
const url =
|
| 52 |
+
'https://huggingface.co/ngbcoder/Homr-onnx/resolve/main/' +
|
| 53 |
+
'segnet_308-3296ccd40960f90ca6ab9c035cca945675d30a0f_fp16.onnx';
|
| 54 |
+
|
| 55 |
+
const session = await ort.InferenceSession.create(url);
|
| 56 |
+
```
|
| 57 |
+
|
| 58 |
+
Cache the bytes (`caches.open(...)` / Cache Storage) keyed by the full URL: at ~98 MB
|
| 59 |
+
per visitor, re-downloading on every page load is not acceptable.
|
| 60 |
+
|
| 61 |
+
Prefer to pin a specific revision? Replace `main` with a commit SHA from the
|
| 62 |
+
**Files** tab of this repo.
|
| 63 |
+
|
| 64 |
+
## Intended input/output shapes
|
| 65 |
+
|
| 66 |
+
| Model | Input | Output |
|
| 67 |
+
| --- | --- | --- |
|
| 68 |
+
| segnet | `[batch, 3, 320, 320]` float32 or float16 (matches the fp16 variant) | `[batch, 6, 320, 320]` logits, `argmax` over axis 0 |
|
| 69 |
+
| encoder | `[1, 1, H, W]` float32/float16, H ≤ 256, W ≤ 1280 | `context` |
|
| 70 |
+
| decoder | `rhythms`, `pitchs`, `lifts`, `articulations`, `slurs`, `context`, `cache_len`, `cache_in0..31` | `out_rhythms`, `out_pitchs`, `out_lifts`, `out_positions`, `out_articulations`, `out_slurs`, `attention`, `cache_out0..31` |
|
| 71 |
+
|
| 72 |
+
The decoder expects `32` KV-cache tensors because it has `decoder_depth = 8` layers with
|
| 73 |
+
`4` cache tensors each.
|
| 74 |
+
|
| 75 |
+
Normalisation for the encoder input is `(pixel / 255 - 0.7931) / 0.1738`, with a single
|
| 76 |
+
channel.
|
| 77 |
+
|
| 78 |
+
## Provenance
|
| 79 |
+
|
| 80 |
+
These weights come from homr's training pipeline, which builds on:
|
| 81 |
+
|
| 82 |
+
- the segmentation models of [oemer](https://github.com/BreezeWhite/oemer)
|
| 83 |
+
- the transformer model of [Polyphonic-TrOMR](https://github.com/NetEase/Polyphonic-TrOMR)
|
| 84 |
+
|
| 85 |
+
homr itself is licensed **AGPL-3.0**. Please confirm the licensing terms of the
|
| 86 |
+
upstream model weights before redistributing them.
|
| 87 |
+
|
| 88 |
+
## Updating
|
| 89 |
+
|
| 90 |
+
Re-export from homr's training pipeline, publish to the `onnx_checkpoints` release tag,
|
| 91 |
+
then mirror here. Never change a model in only one of the two places.
|
decoder_pytorch_model_465-597144cab54c8f6d0f6c9619df5c5312694eadd6.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:18801c1e3657bdea1b031db90b10d66e15accfc1d607780f09a9e059133e886a
|
| 3 |
+
size 47309835
|
decoder_pytorch_model_465-597144cab54c8f6d0f6c9619df5c5312694eadd6_fp16.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:aaac38c4f4be13ec587325486f29a60a919924f0eb82d35b52d4a2e7126dfbe0
|
| 3 |
+
size 93966890
|
encoder_pytorch_model_465-597144cab54c8f6d0f6c9619df5c5312694eadd6.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:92bd18338dc8da3c9b00185008ab14719ff9f912efe785ca42d7b623e06e0c6b
|
| 3 |
+
size 52861122
|
encoder_pytorch_model_465-597144cab54c8f6d0f6c9619df5c5312694eadd6_fp16.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:50823c061533328f5e64df016d3ed16eb9071a9f5c5ee8621646cf9ac9c8a992
|
| 3 |
+
size 26466256
|
segnet_308-3296ccd40960f90ca6ab9c035cca945675d30a0f.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6ed36640db4ef5d223098b6d5efe4eda97c66b24a2c72faab8a018c749003a8d
|
| 3 |
+
size 57311361
|
segnet_308-3296ccd40960f90ca6ab9c035cca945675d30a0f_fp16.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:60f495496cb41473c0521d0811d8f44b9d5cff892d287974a8aebb3eaee2fa83
|
| 3 |
+
size 28667207
|