Automatic Speech Recognition
WhisperKit
Core ML
multilingual
English
Chinese
whisper
apple-neural-engine
int8
Instructions to use madjinn/whisper-medium-coreml with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- WhisperKit
How to use madjinn/whisper-medium-coreml with WhisperKit:
# Install CLI with Homebrew on macOS device brew install whisperkit-cli # View all available inference options whisperkit-cli transcribe --help # Download and run inference using whisper base model whisperkit-cli transcribe --audio-path /path/to/audio.mp3 # Or use your preferred model variant whisperkit-cli transcribe --model "large-v3" --model-prefix "distil" --audio-path /path/to/audio.mp3 --verbose
- Notebooks
- Google Colab
- Kaggle
Whisper Medium for Core ML, 8-bit (WhisperKit format)
This is OpenAI's multilingual Whisper Medium, converted to Core ML for the Apple Neural Engine in the format of WhisperKit (Argmax), with its weights quantised to 8 bits. It is made for the dictation keyboard WhispAway, with exactly the recipe of our KB-Whisper Medium 8-bit (kb-whisper-medium-int8/), so the two share one graph and differ only in their weights.
Files
whisper-medium-int8/:
MelSpectrogram.mlmodelc: inputaudioFloat16 [480000]; outputmelspectrogram_features[1,80,1,3000].AudioEncoder.mlmodelc: outputencoder_output_embeds[1,1024,1,1500].TextDecoder.mlmodelc:- inputs:
input_ids,cache_length,key_cache/value_cache[1,24576,1,448],kv_cache_update_mask,encoder_output_embedsanddecoder_key_padding_mask; - outputs:
logits[1,1,51865],key_cache_updates,value_cache_updatesandalignment_heads_weights.
- inputs:
config.json,generation_config.jsonandtokenizer.json: OpenAI's files at the source revision, unchanged.
18 files, 775,151,649 bytes (encoder 308 MB, decoder 459 MB).
How it was made
- Source:
openai/whisper-mediumat revisionabdf7c39ab9d0397620ccaea8974cc764cd0953e. - Converter: whisperkittools at
b5c1e50eb611240025c158784ec34bbfce26de09, with argmaxtools 0.1.7, coremltools 7.1, torch 2.2.1 and transformers 4.39.1. This is Argmax's 2024 toolchain. - Command:
whisperkit-generate-model --model-version openai/whisper-medium --text-decoder-max-sequence-length 448, otherwise at its defaults: encoder attentionSplitHeadsQ, decoderCat. The conversion ran on Linux, where Core ML can't run, so the Core ML prediction steps of the tool's tests were replaced by saving the.mlpackage; the PyTorch parity tests ran unchanged. - 8 bits: coremltools 7.1
linear_quantize_weights, modelinear_symmetric(int8, per channel), on every weight of 2048 elements or more (weight_threshold=2048), inAudioEncoderandTextDecoder. The mel spectrogram stays fp16. - Compiled with
xcrun coremlcompiler(coremlc 3520.5.1).
Checks
- In PyTorch, the converted modules match Hugging Face's model: encoder 146 dB PSNR, decoder 131 dB with the same top token everywhere.
- The interface and op graph (names, types, shapes, op counts) are identical to our
kb-whisper-medium-int8/; the compiledmodel.milfiles are byte-identical to it, so only the weights differ. The interface is also Argmax'sopenai_whisper-medium's. - Transcription, greedy, with the compiled models on a Mac's CPU, driven the way WhisperKit drives them, against an fp16 conversion made the same way:
- English, the JFK sentence (11 s): identical, and exact ("And so, my fellow Americans, ask not what your country can do for you, ask what you can do for your country.");
- Chinese, four clips from the FLEURS dev set (7–18 s): identical to fp16, and to the reference apart from names and homophones that fp16 gets wrong too (科东 for 科隆, 家南 for 迦南, 成 for 称);
- Swedish, one clip (8 s): 2 of 16 words differ from fp16 ("skiljer" becomes "skilder"); for Swedish, use KB-Whisper;
- the encoder output's cosine similarity to fp16 is 0.9984–0.9988.
- Not yet measured: speed on devices.
Use with WhisperKit
The folder follows WhisperKit's layout, so pointing WhisperKit's modelRepo at this repository and its model at whisper-medium-int8 should work. We haven't tested that: WhispAway runs these files with its own Core ML pipeline.
Licence and credits
- Licence: MIT, as OpenAI released Whisper's code and model weights (openai/whisper; see
LICENSE). The Hugging Face copy of the source model is tagged Apache-2.0. - Whisper: © OpenAI.
- Converter: whisperkittools and WhisperKit by Argmax (MIT).
- This repository: a format conversion by Madjinn. The weights are OpenAI's, converted to Core ML and quantised to 8 bits; nothing was retrained.
- Downloads last month
- -
Model tree for madjinn/whisper-medium-coreml
Base model
openai/whisper-medium