claroche1 commited on
Commit
6f795ba
·
verified ·
1 Parent(s): 05fbabf

upload LiSenNet checkpoint + ONNX (fp32, int8 dyn/static)

Browse files
Files changed (7) hide show
  1. .gitattributes +1 -0
  2. README.md +99 -0
  3. config.json +36 -0
  4. g_best +3 -0
  5. g_best_fp32.onnx +3 -0
  6. g_best_int8_dyn.onnx +3 -0
  7. g_best_int8_static.onnx +3 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ g_best filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -1,3 +1,102 @@
1
  ---
2
  license: mit
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: mit
3
+ library_name: pytorch
4
+ tags:
5
+ - speech-enhancement
6
+ - audio
7
+ - denoising
8
+ - onnx
9
+ - causal
10
+ - streaming
11
+ - real-time
12
+ datasets:
13
+ - JacobLinCool/VoiceBank-DEMAND-16k
14
  ---
15
+
16
+ # LiSenNet
17
+
18
+ An ultra-compact (~37 K-param), causal, real-time speech enhancer trained on
19
+ VoiceBank-DEMAND-16k. Sub-band U-Net with a dual-path-recurrent bottleneck and a
20
+ magnitude-only mask; phase is recovered with a 2-iteration Griffin-Lim (offline)
21
+ or reused from the noisy phase (real-time).
22
+
23
+ Faithful port of **Yan, Zhou, Chen & Lu, _LiSenNet: Lightweight Sub-band and
24
+ Dual-Path Modeling for Real-Time Speech Enhancement_,
25
+ [arXiv:2409.13285](https://arxiv.org/abs/2409.13285)** (authors' MIT reference:
26
+ [hyyan2k/LiSenNet](https://github.com/hyyan2k/LiSenNet)).
27
+
28
+ Training / export / quantization code and the full write-up:
29
+ [https://github.com/LarocheC/eco8-neaixt](https://github.com/LarocheC/eco8-neaixt) — see
30
+ [RESULTS_LISENNET.md](https://github.com/LarocheC/eco8-neaixt/blob/main/RESULTS_LISENNET.md).
31
+
32
+ ## Headline numbers
33
+
34
+ PESQ is wideband, on the full 824-utterance VoiceBank-DEMAND test split.
35
+
36
+ | metric | value |
37
+ | --------------------------------------- | --------: |
38
+ | params | 36,783 |
39
+ | FP32 PESQ (torch / ONNX, Griffin-Lim) | **3.006** |
40
+ | dynamic-int8 PESQ (Griffin-Lim) | 2.995 |
41
+ | **real-time PESQ (int8 + noisy phase)** | **2.982** |
42
+ | static-int8 PESQ (Griffin-Lim) | 2.897 |
43
+ | RTF (1 thread CPU) | 0.15 |
44
+
45
+ The ONNX export is loss-free; dynamic weight-only int8 costs ~0.012 PESQ. The
46
+ reproduction lands within ~0.06 of the paper's reported ~3.07.
47
+
48
+ ## Files
49
+
50
+ | file | what it is |
51
+ | ------------------------- | --- |
52
+ | `g_best` | PyTorch checkpoint (`{"generator": state_dict}`) |
53
+ | `g_best_fp32.onnx` | FP32 ONNX of the mask sub-network: `feat (B,3,T,F)` -> `est_mag (B,T,F)`, dynamic batch/time |
54
+ | `g_best_int8_dyn.onnx` | Dynamic weight-only int8 (robust, near loss-free) — **recommended** |
55
+ | `g_best_int8_static.onnx` | Static full int8 (QDQ, per-tensor, percentile calibration; QAT-grade) |
56
+ | `config.json` | Training + architecture config (STFT, channels, blocks) |
57
+
58
+ The ONNX graphs cover only the mask sub-network (the pure tensor-op core). The
59
+ STFT, the 3-channel feature extraction
60
+ (`[compressed_mag, group_delay/pi, instantaneous_freq_diff/pi]`), the magnitude
61
+ combination, and the phase recovery (Griffin-Lim offline / noisy phase for
62
+ real-time) live outside the graph — see the source repo's
63
+ `lisennet/streaming.py` and `lisennet/eval_deploy.py`.
64
+
65
+ ## Loading
66
+
67
+ PyTorch:
68
+
69
+ ```python
70
+ import json, torch
71
+ from huggingface_hub import hf_hub_download
72
+ from common.env import AttrDict
73
+ from lisennet.model import build_lisennet
74
+
75
+ REPO = "claroche1/LiSenNet"
76
+ cfg = json.load(open(hf_hub_download(REPO, "config.json")))
77
+ ckpt = torch.load(hf_hub_download(REPO, "g_best"),
78
+ map_location="cpu", weights_only=True)
79
+ model = build_lisennet(AttrDict(cfg)).eval()
80
+ model.load_state_dict(ckpt["generator"])
81
+ # end-to-end waveform -> waveform: model(noisy_wav)["est"]
82
+ ```
83
+
84
+ ONNX (FP32 or int8) — the mask sub-network:
85
+
86
+ ```python
87
+ import numpy as np, onnxruntime as ort
88
+ from huggingface_hub import hf_hub_download
89
+
90
+ REPO = "claroche1/LiSenNet"
91
+ sess = ort.InferenceSession(
92
+ hf_hub_download(REPO, "g_best_int8_dyn.onnx"), # or _fp32 / _int8_static
93
+ providers=["CPUExecutionProvider"],
94
+ )
95
+ # input feat: (B, 3, T, F=257) = [compressed_mag, group_delay/pi, ifd/pi]
96
+ # output est_mag: (B, T, F) -> pair with the noisy phase + iSTFT for audio
97
+ est_mag = sess.run(["est_mag"], {"feat": np.zeros((1, 3, 100, 257), np.float32)})[0]
98
+ ```
99
+
100
+ ## License
101
+
102
+ MIT. See the [source repository](https://github.com/LarocheC/eco8-neaixt) for training code and full attribution.
config.json ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_comment": "LiSenNet (arXiv:2409.13285, hyyan2k/LiSenNet, MIT) ported into this framework. Hyperparameters follow the upstream config.yaml: VoiceBank-DEMAND, n_fft=512/hop=256, 2 s segments, AdamW lr 5e-4 betas [0.8,0.99], StepLR gamma 0.98/epoch, CMGAN losses (complex 0.1, mag 0.9, adv 0.05). num_channels=16, n_blocks=2 -> ~37k-param generator. Phase via Griffin-Lim (no phase loss). batch_size is 16 (not the paper's 4): the model is tiny (0.77 GB at batch 16) but each step pays a fixed CPU-PESQ + Griffin-Lim cost, so batch 4 is needlessly slow (~32 min/epoch vs ~4.3 at batch 16); per-sample norms make MetricGAN batch-robust.",
3
+
4
+ "num_gpus": 0,
5
+ "batch_size": 16,
6
+ "learning_rate": 0.0005,
7
+ "adam_b1": 0.8,
8
+ "adam_b2": 0.99,
9
+ "lr_decay": 0.98,
10
+ "seed": 1234,
11
+
12
+ "sampling_rate": 16000,
13
+ "segment_size": 32000,
14
+
15
+ "n_fft": 512,
16
+ "hop_size": 256,
17
+ "win_size": 512,
18
+
19
+ "num_channels": 16,
20
+ "n_blocks": 2,
21
+ "compress_factor": 0.3,
22
+ "gradient_clip": 5.0,
23
+
24
+ "loss": {
25
+ "complex": 0.1,
26
+ "mag": 0.9,
27
+ "adv": 0.05
28
+ },
29
+
30
+ "num_workers": 4,
31
+ "dist_config": {
32
+ "dist_backend": "nccl",
33
+ "dist_url": "tcp://localhost:54321",
34
+ "world_size": 1
35
+ }
36
+ }
g_best ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f983e79d7018ec7e0df6d5cb457b2178d78c019c759f266cc5bb83f463e0b8d5
3
+ size 177557
g_best_fp32.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0b381ddff78913380499711a49e2b6b5b2bb31129bcc65c9971b09119197a13a
3
+ size 286688
g_best_int8_dyn.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4cfdb82a597c5bcee3466dc731b6f2e5260237255d95e16d80bcdd117ced305b
3
+ size 330599
g_best_int8_static.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8a2e23114faa0bc56afce246a2b46b684d08967553f19a431f2a139235bb5b21
3
+ size 453595