Downloads · 30 days
30
32% of all-time downloads
mgndxb/whisper-base.en-timestamped-onnx
whisper-base.en-timestamped-onnx is a automatic speech recognition model from mgndxb. Use it when you need speech turned into text. It is set up for transformers.js. The card lists the license as apache-2.0.
An ONNX conversion of openai/whisper-base.en for Transformers.js, exported so that the decoder emits cross-attention outputs, which is what word-level timestamps (returntimestamps: 'word') are computed from in the bro…
Downloads · 30 days
30
32% of all-time downloads
All-time downloads
93
Public
Repo size
397 MB
Likes
0
Public
Click a slice to open those files.
.onnx397 MB · 99%
From the Hugging Face model README
An ONNX conversion of openai/whisper-base.en
for Transformers.js, exported so that the
decoder emits cross-attention outputs, which is what word-level timestamps
(return_timestamps: 'word') are computed from in the browser.
This repository contains no new model weights. The weights are OpenAI's, converted to the ONNX graph format and repackaged. All modelling credit belongs to OpenAI; see Attribution below.
A stock Optimum export of Whisper does not declare the decoder's attention
tensors as graph outputs. Transformers.js reads word timings out of
cross_attentions.* in
WhisperForConditionalGeneration._extract_token_timestamps, so with a stock
export it fails with:
Model outputs must contain cross attentions
This export declares cross_attentions.{0..5} (plus decoder_attentions.* and
encoder_attentions.*) and traces the model with output_attentions=True so
those outputs are actually written, not merely declared.
import { pipeline } from '@huggingface/transformers';
const transcriber = await pipeline(
'automatic-speech-recognition',
'mgndxb/whisper-base.en-timestamped-onnx',
{
revision: '<pin an immutable commit sha>',
dtype: { encoder_model: 'fp32', decoder_model_merged: 'fp32' },
},
);
const out = await transcriber(audio, {
return_timestamps: 'word',
chunk_length_s: 30,
stride_length_s: 5,
});
generation_config.json carries the alignment_heads this checkpoint needs —
[[3, 3], [4, 7], [5, 1], [5, 5], [5, 7]] — taken unmodified from the upstream
repository. Word timestamps are unavailable without them.
fp32 only. Nothing here is quantized.
| File | Bytes | SHA-256 |
|---|---|---|
onnx/encoder_model.onnx | 82,427,162 | 7bba878a5cf2faaa17b5e2d0b1a53cc086fd425e5e89e18ea8402c4356f73293 |
onnx/decoder_model_merged.onnx | 314,560,221 | e2657d40db662b2c0a25a4e51b83bbe3cc4dede58e255245a9bc4b516f4a4435 |
config.json | 1,273 | f150ffdf49b5a438d036aa6fed357dfd5403507d0521f7639a05756d0e362ee3 |
generation_config.json | 1,526 | 7eb6f9dca9df06ca5ae8ed43ee5b05b200af22fedbb3fe7e0f10ea354e44b641 |
preprocessor_config.json | 356 | 994838f1fa6462c8b9b3c90edada831f11f3dd8b4664634e18f4694d005c9dbf |
tokenizer.json | 3,855,707 | 287537d5be89a39bd18e7e3875ad9900faa668493fb759392b8f52a492eca5db |
tokenizer_config.json | 282,692 | 7498445adabf4fd836db90b0f0d979ca9dc0b543528e5d9f1912430a5879e212 |
special_tokens_map.json | 2,173 | 98bdf3ec5b32e31575b02f64b0a32bde7c0449075d34484a7df9bdd3cdeb9fb9 |
added_tokens.json | 34,604 | 560be47bea388757f8d4cc185c5d82067426cbb6361e38016dd90ddc01ab203a |
vocab.json | 798,156 | 3ba3c3109ff33976c4bd966589c11ee14fcaa1f4c9e5e154c2ed7f99d80709e7 |
merges.txt | 456,318 | 1ce1664773c50f3e0cc8842619a93edc4624525b728b188a9e0be33b7726adc5 |
normalizer.json | 52,666 | bf1c507dc8724ca9cf9903640dacfb69dae2f00edee4f21ceba106a7392f26dd |
MANIFEST.json in this repository records the same hashes alongside the exact
tool versions used, and is generated by the conversion script rather than
written by hand.
Upstream model: openai/whisper-base.en
Upstream revision: 911407f4214e0e1d82085af863093ec0b66f9cd6
Upstream licence: Apache-2.0
Every file here derives from that revision. Nothing was copied from any third-party ONNX conversion.
Toolchain
| Python | 3.12.13 |
torch | 2.13.0 |
transformers | 4.57.6 |
optimum | 2.1.0 |
optimum-onnx | 0.1.0 |
onnx | 1.22.0 |
onnxruntime | 1.28.0 |
Procedure
optimum.exporters.onnx.main_export with task
automatic-speech-recognition-with-past, model_kwargs={"output_attentions": True},
and a WhisperOnnxConfig subclass that adds the attention graph outputs. The
three submodel configs use Optimum's own behaviour split — encoder;
decoder (use_past=True, use_past_in_inputs=False); decoder-with-past
(use_past=True, use_past_in_inputs=True) — after which Optimum merges the two
decoders into decoder_model_merged.onnx. Unmerged intermediates are discarded.
The custom-config approach follows scripts/extra/whisper.py from
Transformers.js v2.17.2 (Apache-2.0), re-implemented against a current Optimum.
The conversion script, the structural verifier, and a pinned requirements file are published alongside the application that uses this model.
Checked before publication:
cross_attentions.* outputs are present in
decoder_model_merged.onnx, populated by an ONNX Runtime run with shape
(batch, 8 heads, decoder_len, 1500), and each row sums to 1 as a softmax
should — a declared-but-never-written output would pass a name check and fail
in production.alignment_heads entry indexes a layer and head that exist.@huggingface/transformers, on both the
WebGPU and the WASM backend, against 15–30s of real English speech: the
pipeline loads, return_timestamps: 'word' succeeds with no cross-attention
error, and word timestamps are monotonic and inside the clip.whisper-base.en is an English-only checkpoint. It does not
transcribe or translate other languages, and will emit confident nonsense if
given them.base is the small end of the family. Expect noticeably worse accuracy
than small/medium on accented speech, overlapping speakers, and noise.Missing required scale ... DequantizeLinear). Add them only behind their
own parity run.Licensed under Apache-2.0, the licence of the upstream model this is converted from.
The weights are the work of OpenAI, published as
openai/whisper-base.en under
Apache-2.0. This repository claims no ownership of the model or its weights. It
is a format conversion and packaging of that model: the same parameters, in
ONNX, with attention outputs exposed. CreatorMission's contribution is the
conversion configuration and packaging, offered under the same licence.
Whisper is described in Robust Speech Recognition via Large-Scale Weak Supervision (Radford et al., 2022).
@misc{radford2022whisper,
title = {Robust Speech Recognition via Large-Scale Weak Supervision},
author = {Alec Radford and Jong Wook Kim and Tao Xu and Greg Brockman
and Christine McLeavey and Ilya Sutskever},
year = {2022},
eprint = {2212.04356},
archivePrefix = {arXiv}
}
See NOTICE for the attribution notice required by Apache-2.0 §4(d).