LiteRT

E2A2 clean_speech codec for compressionkit

E2A2 (Encoding Efficient Asymmetric Autoencoders) clean_speech is a speech codec for 16 kHz mono audio. This repository holds its weights in the layout that compressionkit v0.3 reads, with an encoder half and a decoder half that load separately.

Source and permission

The weights are redistributed from their original public release, danjacobellis/E2A2, subfolder clean_speech/, revision aafe5975, with the permission of the author, Dan Jacobellis. Ambiq did not train this codec. Its description, development and evaluation are documented at the original source and on the codec's page, https://danjacobellis.net/compressors/E2A2_clean_speech. The entropy coder is GGDLPC (https://danjacobellis.net/GGDLPC/).

Every tensor here equals the tensor of the same name at that revision; this repository divides them into the encoder and decoder halves listed below and adds the files compressionkit uses.

Files

  • encoder/config.json, encoder/weights.safetensors (the merged.{op}.encoders.* tensors) and encoder/entropy.json (the GGDLPC tables): everything needed to encode.
  • decoder/config.json, decoder/weights.safetensors (the merged.{op}.decoder.* tensors): everything needed to decode. Each config.json is the full source configuration, so each half constructs alone.
  • rd.json: the rate–distortion curve of the original release, byte-identical to it. Each validation item was zero-meaned and peak-normalized over its whole length before coding, a scaling a real-time encoder cannot compute within its block latency, so the curve is not a measurement of a configuration deployable in real time.
  • calibrations/<dataset>.json (ami, libritts): fixed input maps, published by Ambiq for compressionkit.calibrate.load, that turn int16 codes of a dataset into the codec's input with two constants (an offset and a scale).
  • web/: the decoder of each operating point that the compressionkit browser demo offers, as LiteRT files (section below). The compressionkit loaders do not download web/.
file bytes SHA-256
calibrations/ami.json 7,431 c9883f687dac195b429d1db5e58a2f07d5c62f9034c73ffdab2fd8a0da5da7c6
calibrations/libritts.json 7,255 dcfaa5f73d2e4fab9b16b7a32c0c872bb955612be72071c6bd3c0c593cb336c8
decoder/config.json 1,779 a296ee0d0d0d2348ca7c8053f92cbe3bcc577550f3abafdd00d7f86a0d96c920
decoder/weights.safetensors 3,232,205,908 ed0ba505d87e811b1726a6c1eff334981b258b9299e996f1f3f767028d2d69b8
encoder/config.json 1,779 a296ee0d0d0d2348ca7c8053f92cbe3bcc577550f3abafdd00d7f86a0d96c920
encoder/entropy.json 10,746 5e6ebbe8ea9e7d8bfb789481cf3485f3e615e06511c139a20cd4bfbeebc2e365
encoder/weights.safetensors 53,224 263ce1a7d8708f6418edca9398082adb276cc056e28bbbf349b1c392d5c4127e
rd.json 821 b59f73240b697cfaa9ac13e331597bcaa789165f71e5974f4b76fc3d5ba4231b

Input, output and operating points

Input: float32 (1, L) samples in [−1, 1] at 16 kHz. Output: a reconstruction in the same form. Operating points (cumulative latent channels): [4, 12, 20, 32, 40]. The stream of a lower operating point is a literal bit-prefix of the stream of the highest, and the rates are entropy-coded bits. compressionkit converts nothing: each codec states its input type and range.

Using it with compressionkit

compressionkit v0.3 is in pre-release; these loaders are part of it.

from compressionkit.e2a2 import hub

# both halves
config, weights, coder, ops = hub.load_split_from_hub('clean_speech')
model = hub.load_codec(config=config, weights=weights, n_ch=ops[-1])

# one half (encode-only shown; half='decoder' for decode-only)
cfg, w, coder, ops = hub.load_split_from_hub('clean_speech', half='encoder')
encoder = hub.build_partial(cfg, w, ops[-1])
from compressionkit import calibrate
cal = calibrate.load('clean_speech', 'ami')   # the published map for that dataset

Status and limitations

  • A reference codec for evaluation and development with compressionkit, redistributed as released; not a production model, and not qualified for any product or regulated use.
  • Its quality on data unlike the data of its original release is not characterized here; measure it on your own data (compressionkit.calibrate fits an input map on your training split).
  • Maintainer for compressionkit: Dan Jacobellis (Ambiq). Questions about the codec itself: the original source.

Browser decoders (web/)

For each operating point the compressionkit browser demo offers, its decoder as a LiteRT .tflite window decoder, which runs in a web browser on LiteRT.js (CPU), with a .json beside it that gives its shapes and windowing. A window decodes chunk output samples (pixels along each side for the image codec) with margin of context on each side; the latent grid is cut into overlapping windows and the outputs joined. The PSNR column is the largest difference between the PSNR of the joined output, decoded in LiteRT.js in Chromium, and that of the full-size PyTorch decode, over the example recordings of the demo. The compressionkit loaders do not download web/.

file operating point chunk margin bytes PSNR difference (dB, rows) decoder weights (SHA-256)
web/clean_speech_op4_chunk8192_m2048.tflite 4 8192 samples 2048 404,017,292 1.5e-06 (3) ed0ba505d87e
web/clean_speech_op12_chunk8192_m2048.tflite 12 8192 samples 2048 404,115,596 4.8e-07 (3) ed0ba505d87e
web/clean_speech_op20_chunk8192_m2048.tflite 20 8192 samples 2048 807,675,644 2.3e-06 (3) ed0ba505d87e
web/clean_speech_op32_chunk8192_m2048.tflite 32 8192 samples 2048 808,265,468 1.9e-07 (3) ed0ba505d87e
web/clean_speech_op40_chunk8192_m2048.tflite 40 8192 samples 2048 809,051,900 8.7e-07 (3) ed0ba505d87e

Weights fp32, converted from decoder/weights.safetensors with litert-torch 0.10.0. The last column gives the start of the SHA-256 of the decoder/weights.safetensors it was converted from, which is this repository's.

Downloads last month
35
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support