huseinzolkepliscicom commited on
Commit
a6238ec
Β·
verified Β·
1 Parent(s): 46cd773

Rewrite card: shorter, plain sentences

Browse files
Files changed (1) hide show
  1. README.md +67 -91
README.md CHANGED
@@ -13,129 +13,130 @@ tags:
13
 
14
  # WideCodec β€” 44.1 kHz decoder
15
 
16
- **A SOTA 0.8 kbps, 44.1 kHz audio tokenizer.**
 
17
 
18
- **WideCodec** is a **44.1 kHz decoder finetune** of [`neuphonic/neucodec`](https://huggingface.co/neuphonic/neucodec).
 
 
 
 
 
 
19
 
20
- - **Sample rate:** 44 100 Hz Β· **hop:** 882 Β· **50 tokens/sec**
 
21
 
22
- ## Inference (self-contained)
23
 
24
- Everything needed to run inference is **in this repo** β€” the `neucodec/` package and
25
- `infer_widecodec.py`. No other source code required.
26
 
27
  ```bash
28
  pip install torch transformers huggingface_hub local-attention einops librosa soundfile
29
- huggingface-cli login # if this repo is private (or export HF_TOKEN=hf_...)
30
-
31
  huggingface-cli download Scicom-intl/WideCodec --local-dir WideCodec
32
  cd WideCodec
33
- python infer_widecodec.py --input my.wav --out-dir out # one file
34
- python infer_widecodec.py --input folder/ --out-dir out # a directory
35
  ```
36
 
37
- Or load it directly in Python:
38
-
39
  ```python
40
- import sys; sys.path.insert(0, "WideCodec") # the downloaded repo dir
41
- import torch, librosa
42
  from neucodec import NeuCodec
43
 
44
- model = NeuCodec._from_pretrained(model_id="Scicom-intl/WideCodec", decoder_depth=20).eval().cuda()
 
 
45
  wav16, _ = librosa.load("my.wav", sr=16000, mono=True) # encoder ingests 16 kHz mono
46
  x = torch.from_numpy(wav16).float().view(1, 1, -1).cuda()
47
  with torch.no_grad():
48
- codes = model.encode_code(x) # frozen FSQ codes β€” 0.8 kbps, 50 tok/s
49
- wav44 = model.decode_code(codes) # 44.1 kHz reconstruction
 
50
  ```
51
 
52
- ## Files
 
53
 
54
- | file | what |
55
- |---|---|
56
- | `pytorch_model.bin` | decoder weights for **inference** (load with `NeuCodec._from_pretrained(..., decoder_depth=20)`) |
57
- | `last.ckpt` | full PyTorch-Lightning checkpoint **with optimizer states + LR schedulers** for **resuming training** |
58
 
59
- ## How WideCodec compares (44 kHz-class, by bitrate)
60
-
61
- Offline benchmark on a **heavily multilingual 9,291-clip wideband set** (50 clips Γ— 188 clean β‰₯44.1 kHz datasets, **400+ language/dialect tags**),
62
- faster-UTMOSv2 + spectral vs ground truth.
63
 
64
  ![bitrate vs UTMOSv2](bitrate_vs_utmosv2.png)
65
 
66
- ![WideCodec release progression](widecodec_progress.png)
67
-
68
- | codec | native SR | tokens/s | codebooks | ~bitrate | UTMOSv2 | mel-L1 ↓ | HFβ‰₯11k | rolloff |
69
  |---|--:|--:|--:|--:|--:|--:|--:|--:|
70
  | ground truth | β€” | β€” | β€” | β€” | 2.822 | β€” | 0.00244 | 8263 |
71
- | nvidia nemo44k | 44.1k | ~86 | RVQ (many) | ~6–9 kbps | **2.903** | 0.379 | 0.00196 | 8372 |
72
- | **WideCodec (ours, 2026-08-16)** | 44.1k | **50** | **1** | **~0.8 kbps** | **2.919** | 0.571 | 0.00223 | 9011 |
73
- | WideCodec (previous, 2026-07-21) | 44.1k | 50 | 1 | ~0.8 kbps | 2.788 | 0.571 | 0.00223 | 9011 |
74
  | dac | 44.1k | 86 | 9 | ~8 kbps | 2.672 | **0.341** | 0.00156 | 8185 |
75
  | snac44k | 44.1k | multi-scale | 3–4 | ~2.6 kbps | 2.340 | 0.493 | 0.00158 | 8402 |
76
  | encodec48k | 48k | 150 | RVQ | 24 kbps | 2.042 | 0.458 | 0.00169 | 8800 |
77
 
78
- **Bitrate = frame-rate Γ— Ξ£ logβ‚‚(codebook size).** WideCodec's FSQ is `levels=[4]Γ—8,
79
- num_quantizers=1` β†’ 8Β·logβ‚‚4 = **16 bits/frame** Γ— 50 frames/s = **800 bps = 0.8 kbps**
80
- (vs DAC's 9 codebooks Γ— 10 bits Γ— 86 fps β‰ˆ 8 kbps).
 
 
 
 
81
 
82
- The **2026-08-16 release** reaches UTMOSv2 **2.919** on the 9,291-clip set β€” **above ground truth (2.822)
83
- and level with NVIDIA NeMo-44k (2.903), at ~1/10 of NeMo's bitrate**. It gained **+0.131 UTMOSv2** over the
84
- previous release **at unchanged content accuracy**: CV22 macro CER is **7.70%** for both (micro 7.09%), well
85
- inside the measured run-to-run spread of Β±0.25 pt.
86
 
87
- Same architecture, same losses, same 50 tokens/s and single codebook β€” **only the training corpus changed**,
88
- to clean DNSMOS-gated β‰₯44.1 kHz audio. The gain is not an artifact of the benchmark pool: on a **held-out set
89
- of 1,330 clips from 138 sources absent from training**, it scores 2.807 vs the previous release's 2.654
90
- (+0.153, paired t=+14.2), and reference-based **PESQ-WB also improves** (+0.017, t=+7.5) β€” so naturalness and
91
- fidelity moved together rather than trading off. Full report: evaluation/REPORT_44k_class_codecs.md.
92
 
93
- ## Training stages / which revision to pull
 
 
 
 
 
 
 
94
 
95
- This model is trained in two stages. `main` always points at the **latest** stage.
96
 
97
  | stage | data | how to load |
98
  |---|---|---|
99
- | **Stage 1 β€” noisy mix** (steps 0β†’1.58M, `epoch=9-step=1580000`) | 8 base corpora + `scale44k` (~6,500 h, mostly noisy crowdsourced/podcast) | pin revision **`d2c612f4319c1c1e0c65a9431a7d6db1b7955ce0`** |
100
- | **Stage 2 β€” clean finetune** (from 1.58M, clean β‰₯44.1 kHz only; in progress) | TTS-Clean44k + Clean-Podcast + clean-teacher pool + EARS/Expresso | `main` (default) |
101
 
102
  ```python
103
- # the `neucodec/` package is bundled in this repo (see 'Inference (self-contained)')
104
- from neucodec import NeuCodec
105
-
106
- # Stage 1 (first-stage noisy training) β€” pin the exact revision:
107
  model = NeuCodec._from_pretrained(
108
  model_id="Scicom-intl/WideCodec",
109
  decoder_depth=20,
110
- revision="d2c612f4319c1c1e0c65a9431a7d6db1b7955ce0",
111
  )
112
  ```
113
 
114
  ## Training data
115
 
116
- Diverse, predominantly high-sample-rate human speech (no synthetic TTS). The **scale-up group is
117
- SR-verified β‰₯ 44 kHz** (probed before inclusion); the base corpora are long-form conversational,
118
- expressive and anechoic speech. Two groups:
119
 
120
- ### Base corpora (Malaysia-AI + expressive/anechoic speech)
121
 
122
  | dataset | content |
123
  |---|---|
124
- | [`malaysia-ai/malaysian-podcast-youtube`](https://huggingface.co/datasets/malaysia-ai/malaysian-podcast-youtube) | Malay long-form conversational podcasts (~2,234 h) |
125
  | [`malaysia-ai/singaporean-podcast-youtube`](https://huggingface.co/datasets/malaysia-ai/singaporean-podcast-youtube) | Singaporean English podcasts (~1,255 h) |
126
  | [`malaysia-ai/Multilingual-TTS`](https://huggingface.co/datasets/malaysia-ai/Multilingual-TTS) | CommonVoice-sidon multilingual short clips |
127
- | [`malaysia-ai/malaysian-cartoons-youtube`](https://huggingface.co/datasets/malaysia-ai/malaysian-cartoons-youtube) | 48 kHz cartoon dialogue (subset) |
128
  | [`malaysia-ai/malaysian-movie-youtube`](https://huggingface.co/datasets/malaysia-ai/malaysian-movie-youtube) | 48 kHz Malay movie dialogue |
129
  | [`ylacombe/expresso`](https://huggingface.co/datasets/ylacombe/expresso) | 48 kHz expressive read speech |
130
  | [`nytopop/expresso-conversational`](https://huggingface.co/datasets/nytopop/expresso-conversational) | 48 kHz improvised dialogue |
131
- | EARS | 48 kHz anechoic fullband (emotional / conversational / reading) |
132
-
133
- ### Scale-up: 336 verified β‰₯ 44 kHz datasets
134
 
135
- To maximise acoustic diversity for the decoder (language-agnostic β€” the codebook is frozen),
136
- training is scaled with **336 additional datasets** (162 at 48 kHz, 174 at 44.1 kHz), mirrored as
137
- `<name>*audio.zip` in [`malaysia-ai/Multilingual-TTS`](https://huggingface.co/datasets/malaysia-ai/Multilingual-TTS)
138
- and SR-verified β‰₯ 44 kHz. Original sources:
139
 
140
  <details>
141
  <summary>Full list of 336 β‰₯ 44 kHz source datasets</summary>
@@ -479,28 +480,3 @@ and SR-verified β‰₯ 44 kHz. Original sources:
479
 
480
  </details>
481
 
482
- ## Usage
483
-
484
- See the canonical
485
- **Load from Hugging Face**
486
- section in the source repo. **`decoder_depth=20` is required** β€” the weights are a
487
- depth-20 decoder, so loading with any other depth mismatches the architecture.
488
-
489
- ```python
490
- import soundfile as sf
491
-
492
- # the `neucodec/` package is bundled in this repo (see 'Inference (self-contained)')
493
- from neucodec import NeuCodec
494
-
495
- # decoder_depth=20 MUST match this repo; pass token=... (or hf login) for access
496
- model = NeuCodec._from_pretrained(model_id="Scicom-intl/WideCodec", decoder_depth=20)
497
- model = model.eval().cuda()
498
-
499
- # encode (16 kHz path, frozen) -> codes -> decode (44.1 kHz, this finetune)
500
- codes = model.encode_code("input.wav") # [1, 1, T], identical to base NeuCodec
501
- recon_44k = model.decode_code(codes).squeeze().cpu().numpy()
502
- sf.write("recon.wav", recon_44k, model.sample_rate) # 44100
503
- ```
504
-
505
- The discrete codes are **identical to base `neuphonic/neucodec`** β€” only the reconstruction
506
- sample rate and fidelity differ.
 
13
 
14
  # WideCodec β€” 44.1 kHz decoder
15
 
16
+ A 0.8 kbps, 44.1 kHz audio tokenizer. Decoder finetune of
17
+ [`neuphonic/neucodec`](https://huggingface.co/neuphonic/neucodec).
18
 
19
+ | | |
20
+ |---|---|
21
+ | sample rate | 44,100 Hz |
22
+ | tokens/sec | 50 |
23
+ | codebooks | 1 (FSQ, `levels=[4]Γ—8`) |
24
+ | bitrate | 0.8 kbps |
25
+ | hop | 882 |
26
 
27
+ Codes are **identical to base NeuCodec**. Only the reconstruction sample rate and fidelity
28
+ differ.
29
 
30
+ ## Quickstart
31
 
32
+ Everything needed is in this repo β€” the `neucodec/` package and `infer_widecodec.py`.
 
33
 
34
  ```bash
35
  pip install torch transformers huggingface_hub local-attention einops librosa soundfile
 
 
36
  huggingface-cli download Scicom-intl/WideCodec --local-dir WideCodec
37
  cd WideCodec
38
+ python infer_widecodec.py --input my.wav --out-dir out # file or directory
 
39
  ```
40
 
 
 
41
  ```python
42
+ import sys; sys.path.insert(0, "WideCodec")
43
+ import torch, librosa, soundfile as sf
44
  from neucodec import NeuCodec
45
 
46
+ model = NeuCodec._from_pretrained(model_id="Scicom-intl/WideCodec", decoder_depth=20)
47
+ model = model.eval().cuda()
48
+
49
  wav16, _ = librosa.load("my.wav", sr=16000, mono=True) # encoder ingests 16 kHz mono
50
  x = torch.from_numpy(wav16).float().view(1, 1, -1).cuda()
51
  with torch.no_grad():
52
+ codes = model.encode_code(x) # 0.8 kbps, 50 tok/s
53
+ wav44 = model.decode_code(codes) # 44.1 kHz
54
+ sf.write("recon.wav", wav44.squeeze().cpu().numpy(), model.sample_rate)
55
  ```
56
 
57
+ **`decoder_depth=20` is required.** The weights are a depth-20 decoder; any other value
58
+ mismatches the architecture.
59
 
60
+ ## Benchmark
 
 
 
61
 
62
+ 9,291 clips β€” 50 each from 188 clean β‰₯44.1 kHz datasets, 400+ language/dialect tags.
63
+ faster-UTMOSv2 plus spectral measures against ground truth.
 
 
64
 
65
  ![bitrate vs UTMOSv2](bitrate_vs_utmosv2.png)
66
 
67
+ | codec | native SR | tokens/s | codebooks | bitrate | UTMOSv2 | mel-L1 ↓ | HFβ‰₯11k | rolloff |
 
 
68
  |---|--:|--:|--:|--:|--:|--:|--:|--:|
69
  | ground truth | β€” | β€” | β€” | β€” | 2.822 | β€” | 0.00244 | 8263 |
70
+ | nvidia nemo44k | 44.1k | ~86 | RVQ (many) | ~6–9 kbps | 2.903 | 0.379 | 0.00196 | 8372 |
71
+ | **WideCodec** (2026-08-16) | 44.1k | **50** | **1** | **~0.8 kbps** | **2.919** | 0.571 | 0.00223 | 9011 |
72
+ | WideCodec (2026-07-21) | 44.1k | 50 | 1 | ~0.8 kbps | 2.788 | 0.571 | 0.00223 | 9011 |
73
  | dac | 44.1k | 86 | 9 | ~8 kbps | 2.672 | **0.341** | 0.00156 | 8185 |
74
  | snac44k | 44.1k | multi-scale | 3–4 | ~2.6 kbps | 2.340 | 0.493 | 0.00158 | 8402 |
75
  | encodec48k | 48k | 150 | RVQ | 24 kbps | 2.042 | 0.458 | 0.00169 | 8800 |
76
 
77
+ UTMOSv2 **2.919** β€” above ground truth (2.822), level with NVIDIA NeMo-44k (2.903), at about
78
+ a tenth of its bitrate.
79
+
80
+ Bitrate = frame rate Γ— Ξ£ logβ‚‚(codebook size). Here: 8 Β· logβ‚‚4 = 16 bits/frame Γ— 50 frames/s =
81
+ **800 bps**. DAC: 9 codebooks Γ— 10 bits Γ— 86 fps β‰ˆ 8 kbps.
82
+
83
+ ![release progression](widecodec_progress.png)
84
 
85
+ The 2026-08-16 release gained **+0.131 UTMOSv2** over the previous one at unchanged content
86
+ accuracy β€” CV22 macro CER 7.70% for both, inside the Β±0.25 pt run-to-run spread. Same
87
+ architecture, same losses, same 50 tokens/s and single codebook. Only the training corpus
88
+ changed, to clean DNSMOS-gated β‰₯44.1 kHz audio.
89
 
90
+ Not a benchmark artifact: on a held-out set of 1,330 clips from 138 sources absent from
91
+ training it scores 2.807 against 2.654 (+0.153, paired t = +14.2), and PESQ-WB improves too
92
+ (+0.017, t = +7.5). Naturalness and fidelity moved together.
 
 
93
 
94
+ Full report: `evaluation/REPORT_44k_class_codecs.md`.
95
+
96
+ ## Files and revisions
97
+
98
+ | file | what |
99
+ |---|---|
100
+ | `pytorch_model.bin` | decoder weights for inference |
101
+ | `last.ckpt` | full Lightning checkpoint with optimizer states, for resuming training |
102
 
103
+ Two training stages. `main` points at the latest.
104
 
105
  | stage | data | how to load |
106
  |---|---|---|
107
+ | **1 β€” noisy mix** (steps 0β†’1.58M) | 8 base corpora + `scale44k`, ~6,500 h, mostly noisy crowdsourced/podcast | pin revision `d2c612f4319c1c1e0c65a9431a7d6db1b7955ce0` |
108
+ | **2 β€” clean finetune** (from 1.58M) | TTS-Clean44k + Clean-Podcast + clean-teacher pool + EARS/Expresso | `main` |
109
 
110
  ```python
 
 
 
 
111
  model = NeuCodec._from_pretrained(
112
  model_id="Scicom-intl/WideCodec",
113
  decoder_depth=20,
114
+ revision="d2c612f4319c1c1e0c65a9431a7d6db1b7955ce0", # stage 1
115
  )
116
  ```
117
 
118
  ## Training data
119
 
120
+ High-sample-rate human speech, no synthetic TTS. The scale-up group is SR-verified β‰₯ 44 kHz
121
+ (probed before inclusion).
 
122
 
123
+ **Base corpora:**
124
 
125
  | dataset | content |
126
  |---|---|
127
+ | [`malaysia-ai/malaysian-podcast-youtube`](https://huggingface.co/datasets/malaysia-ai/malaysian-podcast-youtube) | Malay long-form podcasts (~2,234 h) |
128
  | [`malaysia-ai/singaporean-podcast-youtube`](https://huggingface.co/datasets/malaysia-ai/singaporean-podcast-youtube) | Singaporean English podcasts (~1,255 h) |
129
  | [`malaysia-ai/Multilingual-TTS`](https://huggingface.co/datasets/malaysia-ai/Multilingual-TTS) | CommonVoice-sidon multilingual short clips |
130
+ | [`malaysia-ai/malaysian-cartoons-youtube`](https://huggingface.co/datasets/malaysia-ai/malaysian-cartoons-youtube) | 48 kHz cartoon dialogue |
131
  | [`malaysia-ai/malaysian-movie-youtube`](https://huggingface.co/datasets/malaysia-ai/malaysian-movie-youtube) | 48 kHz Malay movie dialogue |
132
  | [`ylacombe/expresso`](https://huggingface.co/datasets/ylacombe/expresso) | 48 kHz expressive read speech |
133
  | [`nytopop/expresso-conversational`](https://huggingface.co/datasets/nytopop/expresso-conversational) | 48 kHz improvised dialogue |
134
+ | EARS | 48 kHz anechoic fullband |
 
 
135
 
136
+ **Scale-up:** 336 further datasets (162 at 48 kHz, 174 at 44.1 kHz), mirrored as
137
+ `<name>*audio.zip` in
138
+ [`malaysia-ai/Multilingual-TTS`](https://huggingface.co/datasets/malaysia-ai/Multilingual-TTS).
139
+ The decoder is language-agnostic β€” the codebook is frozen β€” so this is for acoustic diversity.
140
 
141
  <details>
142
  <summary>Full list of 336 β‰₯ 44 kHz source datasets</summary>
 
480
 
481
  </details>
482