Add files using upload-large-folder tool
Browse files- .gitattributes +1 -0
- README.md +34 -47
- onnx/decoder_model_merged.onnx +2 -2
- onnx/decoder_model_merged_dyn.onnx +3 -0
- onnx/decoder_model_merged_fp16.onnx +2 -2
- onnx/decoder_model_merged_fp16_dyn.onnx +3 -0
- onnx/decoder_model_merged_int8.onnx +2 -2
- onnx/decoder_model_merged_int8.onnx_data +2 -2
- onnx/decoder_model_merged_int8_dyn.onnx +3 -0
- onnx/decoder_model_merged_q4.onnx +2 -2
- onnx/decoder_model_merged_q4_dyn.onnx +3 -0
- onnx/decoder_model_merged_q4f16.onnx +2 -2
- onnx/decoder_model_merged_q4f16_dyn.onnx +3 -0
- onnx/encoder_model.onnx +2 -2
- onnx/encoder_model_fp16.onnx +2 -2
- onnx/encoder_model_int8.onnx +2 -2
- onnx/encoder_model_int8.onnx_data +2 -2
- onnx/encoder_model_int8.onnx_data_1 +3 -0
- onnx/encoder_model_q4.onnx +2 -2
- onnx/encoder_model_q4f16.onnx +2 -2
.gitattributes
CHANGED
|
@@ -50,3 +50,4 @@ onnx/encoder_model_fp16.onnx_data filter=lfs diff=lfs merge=lfs -text
|
|
| 50 |
onnx/encoder_model_q4f16.onnx_data filter=lfs diff=lfs merge=lfs -text
|
| 51 |
onnx/encoder_model.onnx_data_3 filter=lfs diff=lfs merge=lfs -text
|
| 52 |
onnx/decoder_model_merged_q4f16.onnx_data filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 50 |
onnx/encoder_model_q4f16.onnx_data filter=lfs diff=lfs merge=lfs -text
|
| 51 |
onnx/encoder_model.onnx_data_3 filter=lfs diff=lfs merge=lfs -text
|
| 52 |
onnx/decoder_model_merged_q4f16.onnx_data filter=lfs diff=lfs merge=lfs -text
|
| 53 |
+
onnx/encoder_model_int8.onnx_data_1 filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -26,67 +26,54 @@ base_model:
|
|
| 26 |
- CohereLabs/cohere-transcribe-03-2026
|
| 27 |
---
|
| 28 |
|
| 29 |
-
# Cohere Transcribe 03-2026 — DirectML-safe,
|
| 30 |
|
| 31 |
ONNX export of [CohereLabs/cohere-transcribe-03-2026](https://huggingface.co/CohereLabs/cohere-transcribe-03-2026)
|
| 32 |
-
restructured
|
| 33 |
-
|
| 34 |
[onnx-community/cohere-transcribe-03-2026-ONNX](https://huggingface.co/onnx-community/cohere-transcribe-03-2026-ONNX);
|
| 35 |
-
|
| 36 |
-
|
| 37 |
|
| 38 |
-
## Why the stock export can't run on DirectML
|
| 39 |
|
| 40 |
-
|
| 41 |
-
|
|
|
|
|
|
|
| 42 |
|
| 43 |
-
|
| 44 |
-
the 4-D K/V into its PastKey/PastValue slots and builds a `DML_MULTIHEAD_ATTENTION_OPERATOR_DESC`
|
| 45 |
-
with null Key/Value tensors, which DirectML rejects → `E_INVALIDARG` crash.
|
| 46 |
-
- **`GroupQueryAttention`** (self-attention): the DML kernel **silently ignores the `attention_bias`
|
| 47 |
-
input** and never reads `past_key/past_value` (it assumes shared max-length buffers), so a
|
| 48 |
-
concat-style KV cache decodes garbage with no error.
|
| 49 |
-
- Both are gated by two `If` nodes; control-flow ops have no DML kernel (CPU-only), forcing a
|
| 50 |
-
GPU↔CPU round-trip of all 16 cross-KV tensors every decoded token.
|
| 51 |
|
| 52 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
|
| 54 |
-
|
| 55 |
-
`MultiHeadAttention` / `GroupQueryAttention` node rewritten to plain
|
| 56 |
-
Reshape/Transpose/MatMul/Mul/Add/Softmax/Concat with an explicit causal mask (GQA applies it
|
| 57 |
-
internally; the exported `attention_bias` input is only the padding mask). The two cross-attn
|
| 58 |
-
`If` nodes are flattened away.
|
| 59 |
-
2. **Loop-invariant cross-KV hoisted into the encoder**: the cross-attention K/V projections (and
|
| 60 |
-
the pre-transposed keys) depend only on the encoder output, so they now run ONCE per utterance
|
| 61 |
-
inside `encoder_model*.onnx` (extra `cross_attn.*` outputs) instead of on EVERY decoded token
|
| 62 |
-
inside the decoder (which cost ~100× the decoder's real per-token compute). The decoder consumes
|
| 63 |
-
them as same-named `cross_attn.*` inputs; `present.*.encoder.*` outputs are gone. Decoder proto
|
| 64 |
-
metadata carries `winstt_hoisted_cross_kv=1`.
|
| 65 |
|
| 66 |
-
|
| 67 |
-
|
|
|
|
|
|
|
| 68 |
|
| 69 |
-
|
|
|
|
| 70 |
|
| 71 |
-
|
| 72 |
-
|---|---|---|
|
| 73 |
-
| fused (onnx-community) | crash | 21–33 s |
|
| 74 |
-
| decomposed only | 25.2 s | 20.8 s |
|
| 75 |
-
| decomposed + branchless | 14.0 s | 28.7 s |
|
| 76 |
-
| **this repo (hoisted)** | **2.7 s**¹ | ~7.4 s² |
|
| 77 |
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
~
|
| 81 |
-
² all-CPU: encoder 6.1 s + decode 1.3 s.
|
| 82 |
|
| 83 |
-
Produced by WinSTT
|
| 84 |
|
| 85 |
## Files
|
| 86 |
|
| 87 |
-
- `onnx/encoder_model[_fp16|_int8|_q4|_q4f16
|
| 88 |
-
|
| 89 |
-
the proto).
|
| 90 |
-
- `onnx/decoder_model_merged[_fp16|_int8|_q4|_q4f16|_quantized].onnx` (+ external data) —
|
| 91 |
-
decomposed, branchless, cross-KV-free decoders (consume `cross_attn.*` inputs).
|
| 92 |
- Tokenizer / configs — unchanged.
|
|
|
|
| 26 |
- CohereLabs/cohere-transcribe-03-2026
|
| 27 |
---
|
| 28 |
|
| 29 |
+
# Cohere Transcribe 03-2026 — DirectML-safe, fully-static ONNX
|
| 30 |
|
| 31 |
ONNX export of [CohereLabs/cohere-transcribe-03-2026](https://huggingface.co/CohereLabs/cohere-transcribe-03-2026)
|
| 32 |
+
restructured to run **correctly and fast on the ONNX Runtime DirectML EP** (and every other EP).
|
| 33 |
+
Weight bytes are identical to
|
| 34 |
[onnx-community/cohere-transcribe-03-2026-ONNX](https://huggingface.co/onnx-community/cohere-transcribe-03-2026-ONNX);
|
| 35 |
+
the encoder proto additionally embeds the cross-attention projection weights hoisted out of the
|
| 36 |
+
decoder (see below).
|
| 37 |
|
| 38 |
+
## Why the stock export can't run well on DirectML
|
| 39 |
|
| 40 |
+
- The fused decoder attention (`com.microsoft.MultiHeadAttention` cross-attn + `GroupQueryAttention`
|
| 41 |
+
self-attn) **crashes / mis-computes** on the DML EP (ORT ≤ 1.24, unfixed).
|
| 42 |
+
- Even after decomposing to plain ops, the DML EP **re-fuses its graph on every autoregressive
|
| 43 |
+
shape change** (~34 ms/token fixed), so naïve GPU decode loses to CPU.
|
| 44 |
|
| 45 |
+
## What changed (three passes, `tools/onnx/cohere_decompose_attention.py`)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
+
1. **Attention decomposed** to Reshape/Transpose/MatMul/Softmax/… with an explicit causal mask; the
|
| 48 |
+
two cross-attn `If` nodes flattened away.
|
| 49 |
+
2. **Loop-invariant cross-KV hoisted into the encoder** — the cross-attention K/V (which depend only
|
| 50 |
+
on the audio) are computed once per utterance in `encoder_model*.onnx` (extra `cross_attn.*`
|
| 51 |
+
outputs) instead of on every decoded token.
|
| 52 |
+
3. **Fully static decode** — the self-KV cache is a fixed-length buffer updated by a masked write,
|
| 53 |
+
the cross-KV are padded to a fixed length with a `cross_bias` mask, and every per-step shape is
|
| 54 |
+
constant. The DML EP now compiles the decoder **once** and reuses it, so per-token cost is
|
| 55 |
+
**constant ~4 ms regardless of audio length**, entirely on the GPU.
|
| 56 |
|
| 57 |
+
Two decoders are shipped per precision:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
|
| 59 |
+
- `decoder_model_merged*.onnx` — **fully static** (fixed self- + cross-KV). Fastest on DirectML
|
| 60 |
+
(metadata `winstt_static_kv`).
|
| 61 |
+
- `decoder_model_merged*_dyn.onnx` — **growing self-KV** (cross still fixed). Faster on the CPU EP,
|
| 62 |
+
which doesn't benefit from static shapes. WinSTT loads this one when the decoder is CPU-bound.
|
| 63 |
|
| 64 |
+
Both are numerically identical to the fused graph on CPU (autoregressive logits parity: bit-exact
|
| 65 |
+
for fp32/int8/q4; fp16-rounding-level for fp16/q4f16). One padded encoder feeds both.
|
| 66 |
|
| 67 |
+
Measured decode per-token (fp32, ORT 1.24, RTX 3080 Ti), 3.4–4.4× faster than the prior hybrid:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
|
| 69 |
+
| | DirectML (static) | CPU (dynamic) |
|
| 70 |
+
|---|---|---|
|
| 71 |
+
| any length (5 s … 66 s) | **~4 ms/token** | ~12 ms/token |
|
|
|
|
| 72 |
|
| 73 |
+
Produced by [WinSTT](https://github.com/dahshury/WinSTT).
|
| 74 |
|
| 75 |
## Files
|
| 76 |
|
| 77 |
+
- `onnx/encoder_model[_fp16|_int8|_q4|_q4f16].onnx` (+ external data) — hoisted, cross-padded encoder.
|
| 78 |
+
- `onnx/decoder_model_merged[_fp16|_int8|_q4|_q4f16].onnx` (+ `_dyn`) — static / dynamic decoders.
|
|
|
|
|
|
|
|
|
|
| 79 |
- Tokenizer / configs — unchanged.
|
onnx/decoder_model_merged.onnx
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:27b1d14ada637e195cf342b2697cf1577e7e45ac89fa158beac7e7ae37f7ebb8
|
| 3 |
+
size 86993
|
onnx/decoder_model_merged_dyn.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:636bdfd6df17145167f7ef485396eb89be04bced97193c92a2f1ba300b8df052
|
| 3 |
+
size 92153
|
onnx/decoder_model_merged_fp16.onnx
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:54ed4cbbeb3c62fb4c0372a4c0ebe75d3fffbdf38492f1e2682afd584eed183a
|
| 3 |
+
size 87988
|
onnx/decoder_model_merged_fp16_dyn.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9b80a9edb9eb7b5859c6bc6dabdcfb280581df0f2de7150cc36153a2ab966808
|
| 3 |
+
size 93137
|
onnx/decoder_model_merged_int8.onnx
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f8bc38b9dfb63a604a92c89011c36aae772144cdd74386df3766a2a80f14537c
|
| 3 |
+
size 124678
|
onnx/decoder_model_merged_int8.onnx_data
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:84d949b4b89d2b2b4e9ba201b28344f2c517fe03bd50a6b92be1756942f9d40b
|
| 3 |
+
size 195903488
|
onnx/decoder_model_merged_int8_dyn.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:733a29d122ee18e096d7eff9f6daebe532f5e6f01c021ecd403a9877bf7c309f
|
| 3 |
+
size 129838
|
onnx/decoder_model_merged_q4.onnx
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f37f499b15f11d47415bcde5d8f98acb7dffcc759614b74f958f8d6ea81c7964
|
| 3 |
+
size 123697
|
onnx/decoder_model_merged_q4_dyn.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0357b92b2b4134c1a47db267e237f2f5920fe330f7cc164ddb996b03a35660ea
|
| 3 |
+
size 128857
|
onnx/decoder_model_merged_q4f16.onnx
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:42ae84f0b5248a1144fa7a1ee92013997f43ba39fce6a33b964d02dd76a0c694
|
| 3 |
+
size 124715
|
onnx/decoder_model_merged_q4f16_dyn.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5d5201d34ad353b0ca1fe1718cdd243bd71691c6a7628319d4fdb8c397cec8cd
|
| 3 |
+
size 129864
|
onnx/encoder_model.onnx
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:90ae8ddbc00da09f30f7114fe130e71005cacef0d136fb22f7183b2c3eca3dc5
|
| 3 |
+
size 68033797
|
onnx/encoder_model_fp16.onnx
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6133d2ad4bf50e0576872d18526e76564dd61a1712a23bbc4bd6c5fd3ef4b89d
|
| 3 |
+
size 34458099
|
onnx/encoder_model_int8.onnx
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f6af2d163fecc7b36ca3a2050c66238c5865befceea4a1f2ca0937eb5b9d4445
|
| 3 |
+
size 20554104
|
onnx/encoder_model_int8.onnx_data
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8733a14ed4e365cacaa8f1af8764e31b7f728fc4db79d8e8d4836e59d396ccea
|
| 3 |
+
size 2096573952
|
onnx/encoder_model_int8.onnx_data_1
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a86b005d5c77583389f0f0dcf558ebe4ed615fad96f3473303eaaf7d9990a7ae
|
| 3 |
+
size 774430720
|
onnx/encoder_model_q4.onnx
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e6e433e9587d761ccd47eb210f417ba0c315d2b80fd851348d07688d5bb0b993
|
| 3 |
+
size 11897011
|
onnx/encoder_model_q4f16.onnx
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:07fe72cabe3d23f59f79ffb12f5340e345db6cfec033e6070efe840a08a95030
|
| 3 |
+
size 10826472
|