Saltar al contenido
ModelPublicadoExterno
Descargar

KWS Zipformer 3M CoreML INT8

Streaming, zero-shot, open-vocabulary keyword spotting for iOS / macOS / visionOS. Exported from icefall's KWS-finetuned Zipformer transducer (gigaspeech, 3.49M parameters) to CoreML with INT8 palettized weights,...

TipoOtherModelo basepkufool/keyword-spotting-modelsVersiónRevision 45929a2Bcalidad

Fuente del modelo

Tipo
Other
Tamaño del archivo
243 B–2,79 MB
Modelo base
pkufool/keyword-spotting-models
Versión
vRevision 45929a2
Actualizado
17 oct 2026
Descargas
214
Fuente
Hugging Face

Descripción de la fuente

KWS Zipformer 3M — CoreML INT8

Streaming, zero-shot, open-vocabulary keyword spotting for iOS / macOS / visionOS. Exported from icefall's KWS-finetuned Zipformer transducer (gigaspeech, 3.49M parameters) to CoreML with INT8 palettized weights, FP16 compute, and an iOS 17+ minimum deployment target.

Given an arbitrary list of English keywords at runtime (no retraining required), the model emits a match when it hears one. Runs ~26× real-time on Apple Silicon CPU + Neural Engine.

Model

ArchitectureZipformer2 encoder + stateless transducer decoder + joiner
Parameters3.49M
QuantizationINT8 k-means palettization (encoder + joiner); decoder FP16
Compute precisionFP16
Format.mlmodelc (pre-compiled, ship-ready)
Min deployment targetiOS 17 / macOS 14 / visionOS 1
Sample rate16 kHz
Feature80-dim Kaldi fbank, 25 / 10 ms
Chunk size320 ms (16 output frames × 20 ms each)
Left context64 subsampled frames (~2.5 s)
Vocab500 BPE tokens

Files

filesizedescription
encoder.mlmodelc3.3 MBZipformer2 streaming encoder (45 × 80 mel → 8 × 320 joiner-space) with 36 layer cache tensors + ConvNeXt pad + processed-lens state
decoder.mlmodelc525 KBStateless 2-token-context predictor + decoder_proj
joiner.mlmodelc160 KBoutput_linear(tanh(enc + dec)) → 500 logits
bpe.model239 KBSentencePiece BPE-500 tokenizer (icefall gigaspeech)
tokens.txt4.9 KBToken id → subword map
commands_small.txt0.2 KBExample keyword list (20 short commands)
commands_large.txt5.9 KBExample keyword list (248 commands)
config.json3.8 KBFbank params, encoder cache shapes, default KWS thresholds

Performance

Measured on Apple Silicon (CPU + Neural Engine), tuned defaults ac_threshold=0.15 context_score=0.5 num_trailing_blanks=1.

Latency (per call)

componentlatency
Encoder (45 × 80 mel → 8 × 320 joiner-space)5.4 ms / 320 ms chunk
Decoder (1 step, 2-token context)0.08 ms
Joiner (1 frame → 500 logits)0.13 ms
RTF (encoder only, streaming)0.038 (~26× real-time)

Accuracy (LibriSpeech test-clean, 12 keywords, 158 positive + 60 negative utterances)

keywordNrecall
WHICH271.00
LITTLE170.94
BEFORE181.00
GREAT190.95
LIGHT151.00
YOUNG151.00
THROUGH150.93
WORLD150.93
ALWAYS150.93
PEOPLE151.00
THOUGHT150.87
MISTER170.00
TOTAL2030.88

False positive rate: 0.27 / utterance on 60 random negative utterances. CoreML INT8 output agrees with the PyTorch FP32 reference on 99% of utterances (FP16 palettization drift is not systematic).

Note on "MISTER": SentencePiece tokenizes it as [▁MI, S, TER] (3 tokens). Stateless transducers rarely lock onto 3-token sequences in beam search. For production wake words, prefer single-token keywords.

Memory

Loaded all three .mlmodelc models: peak RSS delta ≈ 63 MB on macOS. After 218-utterance streaming workload: +127 MB total.

Usage

Python (coremltools)

import json
from pathlib import Path

import coremltools as ct
import numpy as np

model_dir = Path("./KWS-Zipformer-3M-CoreML-INT8")
config = json.loads((model_dir / "config.json").read_text())

encoder = ct.models.CompiledMLModel(str(model_dir / "encoder.mlmodelc"))
decoder = ct.models.CompiledMLModel(str(model_dir / "decoder.mlmodelc"))
joiner = ct.models.CompiledMLModel(str(model_dir / "joiner.mlmodelc"))

# Build zero state from config
state = {}
for name, shape in zip(config["encoder"]["layerStateNames"],
                       config["encoder"]["layerStateShapes"]):
    state[name] = np.zeros(shape, dtype=np.float32)
state["cached_embed_left_pad"] = np.zeros(
    config["encoder"]["cachedEmbedLeftPadShape"], dtype=np.float32)
state["processed_lens"] = np.zeros((1,), dtype=np.int32)

# Feed 45 mel frames (80-dim fbank) per chunk
x = np.zeros((1, 45, 80), dtype=np.float32)  # replace with real fbank
out = encoder.predict({"x": x, **state})
encoder_out = out["encoder_out"]                  # (1, 8, 320) in joiner space
# Stream: feed encoder_out[0, t] into decoder/joiner + beam search

Swift (speech-swift)

import SpeechSwift

let model = try await KWSZipformerModel.fromPretrained(
    "aufklarer/KWS-Zipformer-3M-CoreML-INT8"
)
let stream = model.streamingSession(keywords: ["HEY SONIQO", "STOP", "LIGHTS ON"])
try stream.feed(audio: pcm16k)
for match in stream.emissions {
    print("matched: \(match.phrase) at \(match.timestamp)")
}

Reference Python decoder

The upstream Aho-Corasick ContextGraph + boost-cancellation beam search algorithm is available as a dependency-free pure-Python reference for porting to other runtimes.

Source

Exported from icefall-kws-zipformer-gigaspeech-20240219 (Apache-2.0), specifically the exp-finetune/pretrained.pt KWS-finetuned checkpoint, published in pkufool/keyword-spotting-models v0.11.

The reference ONNX export is csukuangfj/sherpa-onnx-kws-zipformer-gigaspeech-3.3M-2024-01-01; this CoreML bundle matches its encoder / decoder / joiner outputs within FP16 tolerance (≤1e-3 on encoder, ≤1e-4 on decoder, ≤1e-3 on joiner).

Links

Fuentes

1 fuente
Hugging FacePrincipalVersión 45929a20b1d7d9332ee137952b7ff4200eeb72a8
huggingface.co/aufklarer/KWS-Zipformer-3M-CoreML-INT8/tree/45929a20b1d7d9332ee137952b7ff4200eeb72a8

Verificado 29 ago

Artefactos del modelo

9 artefactos

decoder.mlmodelc/analytics/coremldata.bin

bin · 243 B · SHA-256 e9da670c9bcb…4069 · Hugging Face

Descargar

decoder.mlmodelc/coremldata.bin

bin · 311 B · SHA-256 238b90684827…9104 · Hugging Face

Descargar

decoder.mlmodelc/weights/weight.bin

bin · 518 KB · SHA-256 d73e5d5e1cee…60ce · Hugging Face

Descargar

encoder.mlmodelc/analytics/coremldata.bin

bin · 243 B · SHA-256 ae2f7d2db71e…fa87 · Hugging Face

Descargar

encoder.mlmodelc/coremldata.bin

bin · 3,05 KB · SHA-256 6eeb1ed89a7f…5bb0 · Hugging Face

Descargar

encoder.mlmodelc/weights/weight.bin

bin · 2,79 MB · SHA-256 2de84c14f8d4…eedb · Hugging Face

Descargar

joiner.mlmodelc/analytics/coremldata.bin

bin · 243 B · SHA-256 779ec8cb7c61…4db3 · Hugging Face

Descargar

joiner.mlmodelc/coremldata.bin

bin · 345 B · SHA-256 18283b3e99d8…6dfd · Hugging Face

Descargar

joiner.mlmodelc/weights/weight.bin

bin · 158 KB · SHA-256 8dbef96b74ca…6004 · Hugging Face

Descargar

Extractos de fuentes

2 extractos

--- license: apache-2.0 language: - en tags: - audio - keyword-spotting - wake-word - kws - zipformer - transducer - coreml - on-device base_model: pkufool/keyword-spotting-models library_name: coreml pipeline_tag: audio-classification --- # KWS Zipformer 3M — CoreML INT8 Streaming, zero-shot, open-vocabulary keyword spotting for iOS / macOS / visionOS. Exported from icefall's KWS-finetuned Zipformer transducer (gigaspeech, 3.49M parameters) to CoreML with INT8 palettized weights, FP16 compute, and an iOS 17+ minimum deployment target. Given an arbitrary list of English keywords at runtime (no retraining required), the model emits a match when it hears one. Runs ~26× real-time on Apple Silicon CPU + Neural Engine. ## Model | | | |---|---| | Architecture | Zipformer2 encoder + stateless transducer decoder + joiner | | Parameters | 3.49M | | Quantization | INT8 k-means palettization (encoder + joiner); decoder FP16 | | Compute precision | FP16 | | Format | `.mlmodelc` (pre-compiled, ship-ready) | | Min deployment target | iOS 17 / macOS 14 / visionOS 1 | | Sample rate | 16 kHz | | Feature | 80-dim Kaldi fbank, 25 / 10 ms | | Chunk size | 320 ms (16 output frames × 20 ms each) | | Left context | 64 subsampled frames (~2.5 s) | | Vocab | 500 BPE tokens | ## Files | file | size | description | |---|---|---| | `encoder.mlmodelc` | 3.3 MB | Zipformer2 streaming encoder (45 × 80 mel → 8 × 320 joiner-space) with 36 layer cache tensors + ConvNeXt pad + processed-lens state | | `decoder.mlmodelc` | 525 KB | Stateless 2-token-context predictor + `decoder_proj` | | `joiner.mlmodelc` | 160 KB | `output_linear(tanh(enc + dec))` → 500 logits | | `bpe.model` | 239 KB | SentencePiece BPE-500 tokenizer (icefall gigaspeech) | | `tokens.txt` | 4.9 KB | Token id → subword map | | `commands_small.txt` | 0.2 KB | Example keyword list (20 short commands) | | `commands_large.txt` | 5.9 KB | Example keyword list (248 commands) | | `config.json` | 3.8 KB | Fbank params, encoder cache shapes, default KWS thresholds | ## Performance Measured on Apple Silicon (CPU + Neural Engine), tuned defaults `ac_threshold=0.15 context_score=0.5 num_trailing_blanks=1`. ### Latency (per call) | component | latency | |---|---| | Encoder (45 × 80 mel → 8 × 320 joiner-space) | 5.4 ms / 320 ms chunk | | Decoder (1 step, 2-token context) | 0.08 ms | | Joiner (1 frame → 500 logits) | 0.13 ms |...

Source context: 214 downloads · 1 likes · Pipeline audio-classification · Library coreml · Repo aufklarer/KWS-Zipformer-3M-CoreML-INT8