aufklarer commited on
Commit
3a76ff7
·
verified ·
1 Parent(s): 70ab797

qwen3-asr: replace encoder with chunked block-attention export

Browse files

The previous encoder ran unmasked global self-attention over the
zero-padded mel input — padding-derived tokens contaminated real
audio embeddings and triggered the text decoder to emit <|im_end|>
right after the first sentence-final period. WER on LibriSpeech
test-clean: 24.88%.

The new encoder mirrors upstream Qwen3OmniMoeAudioEncoder's chunked
block attention (100-frame chunks -> 13 tokens, 800-frame attention
windows via cu_seqlens). Switches to a single fixed [1, 128, 3000]
mel shape (drops EnumeratedShapes) and adds a mel_length int32
input + output_length int32 output so consumers can slice to the
real un-padded audio-token count.

New interface:
inputs: mel [1, 128, 3000] float32, mel_length [1] int32
outputs: audio_embeddings [1, 390, 1024] float16,
output_length [1] int32

LibriSpeech test-clean n=200 (Apple M5 Pro, INT8 palettized):
WER 24.88% -> 3.02% (matches MLX 0.6B 4-bit baseline 2.20%).
Encoder is also ~4.7x faster (24ms vs 113ms per call).

Compiled encoder.mlmodelc + uncompiled encoder_int8.mlpackage
replaced; new encoder_fp16.mlpackage added as a higher-precision
variant. Decoder + embedding + decoder config unchanged.

encoder_int8.mlpackage/Data/com.apple.CoreML/model.mlmodel CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:cd256176dfff7a294825cad6f5367ae267aaccc2fbd8082511b4825c3c798b50
3
- size 202755
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:682e5417c7509fb7b843e50db1a2a1ee6f6320398b87a2d931e359fa27d1635d
3
+ size 372275
encoder_int8.mlpackage/Data/com.apple.CoreML/weights/weight.bin CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:a29c0c23156c1eb705648b5f6238934a4932dcfcdce5df59ec4e1f3a04bf422d
3
- size 188022528
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e935d3ce19a529ef560b2e3be4c0180a571e74975f7db80d91ad13226748d250
3
+ size 186844416
encoder_int8.mlpackage/Manifest.json CHANGED
@@ -1,18 +1,18 @@
1
  {
2
  "fileFormatVersion": "1.0.0",
3
  "itemInfoEntries": {
4
- "0A0138ED-E33C-4397-B987-3487CDD280BE": {
5
  "author": "com.apple.CoreML",
6
  "description": "CoreML Model Specification",
7
  "name": "model.mlmodel",
8
  "path": "com.apple.CoreML/model.mlmodel"
9
  },
10
- "8BAD63D4-3E07-45DA-8BDD-862611F1B156": {
11
  "author": "com.apple.CoreML",
12
  "description": "CoreML Model Weights",
13
  "name": "weights",
14
  "path": "com.apple.CoreML/weights"
15
  }
16
  },
17
- "rootModelIdentifier": "0A0138ED-E33C-4397-B987-3487CDD280BE"
18
  }
 
1
  {
2
  "fileFormatVersion": "1.0.0",
3
  "itemInfoEntries": {
4
+ "3CBD87CF-CD11-4101-AF72-A78BA9FA260B": {
5
  "author": "com.apple.CoreML",
6
  "description": "CoreML Model Specification",
7
  "name": "model.mlmodel",
8
  "path": "com.apple.CoreML/model.mlmodel"
9
  },
10
+ "D2259FD6-72DD-4C12-B80A-ECB35B014416": {
11
  "author": "com.apple.CoreML",
12
  "description": "CoreML Model Weights",
13
  "name": "weights",
14
  "path": "com.apple.CoreML/weights"
15
  }
16
  },
17
+ "rootModelIdentifier": "3CBD87CF-CD11-4101-AF72-A78BA9FA260B"
18
  }