Add files using upload-large-folder tool
Browse files- README.md +42 -28
- onnx/decoder_model_merged.onnx +2 -2
- onnx/decoder_model_merged_fp16.onnx +2 -2
- onnx/decoder_model_merged_int8.onnx +2 -2
- onnx/decoder_model_merged_q4.onnx +2 -2
- onnx/decoder_model_merged_q4f16.onnx +2 -2
- onnx/decoder_model_merged_quantized.onnx +2 -2
- onnx/encoder_model.onnx +2 -2
- onnx/encoder_model_fp16.onnx +2 -2
- onnx/encoder_model_int8.onnx +2 -2
- onnx/encoder_model_q4.onnx +2 -2
- onnx/encoder_model_q4f16.onnx +2 -2
- onnx/encoder_model_quantized.onnx +2 -2
README.md
CHANGED
|
@@ -26,53 +26,67 @@ base_model:
|
|
| 26 |
- CohereLabs/cohere-transcribe-03-2026
|
| 27 |
---
|
| 28 |
|
| 29 |
-
# Cohere Transcribe 03-2026 — DirectML-safe ONNX
|
| 30 |
|
| 31 |
ONNX export of [CohereLabs/cohere-transcribe-03-2026](https://huggingface.co/CohereLabs/cohere-transcribe-03-2026)
|
| 32 |
-
|
| 33 |
-
|
| 34 |
[onnx-community/cohere-transcribe-03-2026-ONNX](https://huggingface.co/onnx-community/cohere-transcribe-03-2026-ONNX);
|
| 35 |
-
only the
|
|
|
|
| 36 |
|
| 37 |
-
## Why
|
| 38 |
|
| 39 |
The onnx-community decoders fuse attention into two `com.microsoft` contrib ops that the DirectML EP
|
| 40 |
mishandles (ORT ≤ 1.24, unfixed — the DML EP is in maintenance mode):
|
| 41 |
|
| 42 |
- **`MultiHeadAttention`** (cross-attention, 3-D query + 4-D precomputed K/V): the DML kernel routes
|
| 43 |
the 4-D K/V into its PastKey/PastValue slots and builds a `DML_MULTIHEAD_ATTENTION_OPERATOR_DESC`
|
| 44 |
-
with null Key/Value tensors, which DirectML rejects → `E_INVALIDARG` crash
|
| 45 |
-
`/model/layers.0/encoder_attn/MultiHeadAttention`.
|
| 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
|
| 48 |
-
|
| 49 |
-
- Both are gated by two `If` nodes; control-flow ops have no DML kernel
|
| 50 |
-
|
| 51 |
|
| 52 |
## What changed
|
| 53 |
|
| 54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
2. Every `MultiHeadAttention` / `GroupQueryAttention` node is decomposed into
|
| 59 |
-
Reshape/Transpose/MatMul/Mul/Add/Softmax/Concat, with an explicit causal mask (GQA applies it
|
| 60 |
-
internally; the exported `attention_bias` input is only the padding mask).
|
| 61 |
|
| 62 |
-
|
| 63 |
-
fp32/int8/q4; fp16-rounding-level for fp16/q4f16). Encoders are untouched (their self-attention MHA
|
| 64 |
-
form runs correctly on DirectML).
|
| 65 |
|
| 66 |
-
|
| 67 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
|
| 69 |
-
|
| 70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
|
| 72 |
## Files
|
| 73 |
|
| 74 |
-
- `onnx/encoder_model[_fp16|_int8|_q4|_q4f16|_quantized].onnx` (+ external data) —
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
|
|
|
| 78 |
- Tokenizer / configs — unchanged.
|
|
|
|
| 26 |
- CohereLabs/cohere-transcribe-03-2026
|
| 27 |
---
|
| 28 |
|
| 29 |
+
# Cohere Transcribe 03-2026 — DirectML-safe, decode-optimized ONNX
|
| 30 |
|
| 31 |
ONNX export of [CohereLabs/cohere-transcribe-03-2026](https://huggingface.co/CohereLabs/cohere-transcribe-03-2026)
|
| 32 |
+
restructured so the model runs **correctly and fast on the ONNX Runtime DirectML EP** (and every other
|
| 33 |
+
EP). Weight bytes are identical to
|
| 34 |
[onnx-community/cohere-transcribe-03-2026-ONNX](https://huggingface.co/onnx-community/cohere-transcribe-03-2026-ONNX);
|
| 35 |
+
only the graph protos differ (the encoder proto additionally embeds the ~67 MB of cross-attention
|
| 36 |
+
projection weights hoisted out of the decoder — see below).
|
| 37 |
|
| 38 |
+
## Why the stock export can't run on DirectML
|
| 39 |
|
| 40 |
The onnx-community decoders fuse attention into two `com.microsoft` contrib ops that the DirectML EP
|
| 41 |
mishandles (ORT ≤ 1.24, unfixed — the DML EP is in maintenance mode):
|
| 42 |
|
| 43 |
- **`MultiHeadAttention`** (cross-attention, 3-D query + 4-D precomputed K/V): the DML kernel routes
|
| 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 |
## What changed
|
| 53 |
|
| 54 |
+
1. **Attention decomposed** (`decoder_model_merged*.onnx`, all precisions): every
|
| 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 |
+
Verified numerically against the fused graphs on CPU (autoregressive logits parity: bit-exact for
|
| 67 |
+
fp32/int8/q4; fp16-rounding-level for fp16/q4f16).
|
|
|
|
|
|
|
|
|
|
| 68 |
|
| 69 |
+
Measured on a 66 s clip (fp32, ORT 1.24, RTX 3080 Ti, identical transcripts):
|
|
|
|
|
|
|
| 70 |
|
| 71 |
+
| export | DirectML | CPU |
|
| 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 |
+
¹ hybrid placement: encoder on DirectML, decoder on the CPU EP (the DML EP re-fuses its graph on
|
| 79 |
+
every autoregressive shape change, ~34 ms/token fixed; the CPU EP decodes the hoisted decoder at
|
| 80 |
+
~12 ms/token). This is how [WinSTT](https://github.com/dahshury/WinSTT) runs it.
|
| 81 |
+
² all-CPU: encoder 6.1 s + decode 1.3 s.
|
| 82 |
+
|
| 83 |
+
Produced by WinSTT's `tools/onnx/cohere_decompose_attention.py`.
|
| 84 |
|
| 85 |
## Files
|
| 86 |
|
| 87 |
+
- `onnx/encoder_model[_fp16|_int8|_q4|_q4f16|_quantized].onnx` (+ external data) — onnx-community
|
| 88 |
+
weights + the hoisted cross-KV tail (extra `cross_attn.*` outputs; projection weights embedded in
|
| 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.
|
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:9d2bc6c61625ad2e96641e76a7056440e0f70db17b7982371215ce4317385e8e
|
| 3 |
+
size 126143
|
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:84746ed4964cd92913159df8a29c49609ccdcf5f6db5fa1ab3f1a623a88b322a
|
| 3 |
+
size 127116
|
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:daecf1938f01ff7adcc2611123cccc26a4a06615dbef80519be88b1d12094ee2
|
| 3 |
+
size 206757
|
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:165e4be4ee266782ff8baae525d42c14ef54587caa05c38720010d527972a2d4
|
| 3 |
+
size 162847
|
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:48c802f4d0b82056d8764628e21a58f6159b589e9f48dd6ef44d94e1a8dcadab
|
| 3 |
+
size 163843
|
onnx/decoder_model_merged_quantized.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:03487477a68eac454194afd14aacc520169807048abc288e32295ef0915d8b99
|
| 3 |
+
size 165787
|
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:328ed95c4e99a022fc2bff2784b67c43d5513ebbc056120489e58c52d342e7fb
|
| 3 |
+
size 68375619
|
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:b85245dd273d1df75fddd8098a16067cf73595785664ac19629beac40118863c
|
| 3 |
+
size 34800172
|
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:e74076d7ff0f33df1b8f00761fa522a4ad5e2b41466448d9abf4ba7e0aebbdf6
|
| 3 |
+
size 69268785
|
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:4620d38ba212bca72ebef5148ec30ad37e102175b20661d03d819d86c0961cb6
|
| 3 |
+
size 12238833
|
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:96a3669a92755fde0f8642f1030e405ba11c33f7fdf70dd5d52b57a943688ec0
|
| 3 |
+
size 11168545
|
onnx/encoder_model_quantized.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:d13b2ea09d118bee13b4e5fdf0a130be0bd6a949a52d948c9a7a3a920c5e8b9b
|
| 3 |
+
size 20908996
|