wq2012 commited on
Commit
04a47a2
·
0 Parent(s):

Initial release of vanilla_seq2seq_multi_interfering pretrained checkpoint, TFLite model, and Model Card

Browse files
.gitattributes ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ *.data-00000-of-00001 filter=lfs diff=lfs merge=lfs -text
2
+ *.meta filter=lfs diff=lfs merge=lfs -text
3
+ *.tflite filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ library_name: lingvo
4
+ tags:
5
+ - audio
6
+ - speech-enhancement
7
+ - echo-cancellation
8
+ - textual-echo-cancellation
9
+ - tensorflow
10
+ - tflite
11
+ datasets:
12
+ - libritts
13
+ - vctk
14
+ metrics:
15
+ - wer
16
+ - mcd
17
+ arxiv: 2008.06006
18
+ ---
19
+
20
+ # Vanilla-Seq2seq Baseline (No Side Input) — Multiple Interfering Voices (`NoSideInputMultiInterfering`)
21
+
22
+ Single-source sequence-to-sequence speech enhancement baseline (`Vanilla-Seq2seq` / `NoSideInput`) trained on 24 kHz **LibriTTS** user speech mixed at 0 dB SNR with reverberant **CSTR VCTK** without any side input.
23
+
24
+ - **GitHub Repository**: [https://github.com/wq2012/tec](https://github.com/wq2012/tec)
25
+ - **PyPI Package**: [`textual-echo-cancellation`](https://pypi.org/project/textual-echo-cancellation/)
26
+ - **Paper**: [Textual Echo Cancellation (IEEE SLT 2021, arXiv:2008.06006v4)](https://arxiv.org/pdf/2008.06006)
27
+ - **Audio Demo Page**: [https://google.github.io/speaker-id/publications/TEC/](https://google.github.io/speaker-id/publications/TEC/)
28
+
29
+ > **Open-Source Reproduction Notice**: This pretrained model was trained using the standalone open-source reproduction library ([`wq2012/tec`](https://github.com/wq2012/tec)) built on [`lingvo`](https://github.com/tensorflow/lingvo) and `tensorflow`. It does not use Google's proprietary internal codebase or internal training data infrastructure.
30
+
31
+ ---
32
+
33
+ ## Model Performance
34
+
35
+ ### 1. Open-Source Reproduction Evaluation (`NoSideInputMultiInterfering`)
36
+
37
+ Evaluated on 24 kHz **LibriTTS** (`test-clean`, `test-other`) mixed at 0 dB SNR with synthetic room impulse responses (RT60 = 0.25 s) under the **Multiple interfering voices (LibriTTS + VCTK)** condition, using `Qwen3-ASR-0.6B-F16` via `audio.cpp` for ASR WER scoring and 13-MFCC Dynamic Time Warping for MCD:
38
+
39
+ | Metric | `test-clean` | `test-other` |Paper Reference (`Vanilla-Seq2seq`) |
40
+ | :--- | :---: | :---: | :---: |
41
+ | **WER (%) ↓** | **31.16%** (62/199) | **42.39%** (103/243) | 19.7% / 38.7% |
42
+ | **MCD (dB) ↓** | **7.93 dB** | **8.72 dB** | 7.53 dB / 8.87 dB |
43
+ | **Side Input Size (KB) ↓** | **0.000 KB** | **0.000 KB** | 0 KB |
44
+ | **Computational Complexity ↓** | **6.32 GFLOPS** | **6.32 GFLOPS** | 6.32 GFLOPS |
45
+
46
+ ### 2. Full Comparison Across All Pretrained Models & Baselines
47
+
48
+ | Condition | Method | Hugging Face Model | WER (%) test-clean ↓ | WER (%) test-other ↓ | MCD (dB) test-clean ↓ | MCD (dB) test-other ↓ | Side Input test-clean (KB) ↓ |
49
+ | :--- | :--- | :--- | :---: | :---: | :---: | :---: | :---: |
50
+ | **Single interfering voice** *(LibriTTS + LJSpeech)* | `GroundTruth` | — | 3.52 | 6.78 | 0.00 | 0.00 | 0.000 |
51
+ | | `MicrophoneSignal` | — | 90.45 | 114.12 | 12.86 | 14.61 | 0.000 |
52
+ | | `NlmsAec` (AEC-NLMS) | — | 88.44 | 107.34 | 12.80 | 14.48 | 243.465 |
53
+ | | `NoSideInputSingleInterfering` | [`wq2012/vanilla_seq2seq_single_interfering`](https://huggingface.co/wq2012/vanilla_seq2seq_single_interfering) | 45.23 | 91.53 | 9.58 | 11.34 | 0.000 |
54
+ | | `AecSingleInterfering` | [`wq2012/aec_single_interfering`](https://huggingface.co/wq2012/aec_single_interfering) | 12.06 | 23.16 | 8.85 | 9.86 | 243.465 |
55
+ | | **`TecSingleInterfering`** | **[`wq2012/tec_single_interfering`](https://huggingface.co/wq2012/tec_single_interfering)** | **21.61** | **46.89** | **8.24** | **9.28** | **0.076** |
56
+ | **Multiple interfering voices** *(LibriTTS + VCTK)* | `GroundTruth` | — | 5.03 | 7.82 | 0.00 | 0.00 | 0.000 |
57
+ | | `MicrophoneSignal` | — | 34.17 | 48.97 | 7.67 | 7.70 | 0.000 |
58
+ | | `NlmsAec` (AEC-NLMS) | — | 28.64 | 34.98 | 7.92 | 8.40 | 186.922 |
59
+ | | `NoSideInputMultiInterfering` | [`wq2012/vanilla_seq2seq_multi_interfering`](https://huggingface.co/wq2012/vanilla_seq2seq_multi_interfering) | 31.16 | 42.39 | 7.93 | 8.72 | 0.000 |
60
+ | | `AecMultiInterfering` | [`wq2012/aec_multi_interfering`](https://huggingface.co/wq2012/aec_multi_interfering) | 8.54 | 22.22 | 7.80 | 7.88 | 186.922 |
61
+ | | **`TecMultiInterfering`** | **[`wq2012/tec_multi_interfering`](https://huggingface.co/wq2012/tec_multi_interfering)** | **26.63** | **45.27** | **7.96** | **8.40** | **0.037** |
62
+
63
+ ---
64
+
65
+ ## Files in This Repository
66
+
67
+ - `best.ckpt.data-00000-of-00001`, `best.ckpt.index`, `best.ckpt.meta`, `checkpoint`: TensorFlow / Lingvo checkpoint for `NoSideInputMultiInterfering`.
68
+ - `model.tflite`: Dynamic-range quantized TensorFlow Lite (`.tflite`) FlatBuffer model for on-device inference.
69
+ - `evaluation_metrics.json`: Verified evaluation results (`test-clean` and `test-other`) for `NoSideInputMultiInterfering`.
70
+
71
+ ---
72
+
73
+ ## How to Use
74
+
75
+ ### 1. Install `textual-echo-cancellation`
76
+
77
+ ```bash
78
+ pip3 install textual-echo-cancellation huggingface_hub
79
+ ```
80
+
81
+ ### 2. Download the Model from Hugging Face
82
+
83
+ ```python
84
+ from huggingface_hub import snapshot_download
85
+
86
+ model_dir = snapshot_download(repo_id="wq2012/vanilla_seq2seq_multi_interfering")
87
+ print("Downloaded model to:", model_dir)
88
+ ```
89
+
90
+ ### 3. Run Inference via CLI (`scripts/inference.py`)
91
+
92
+ ```bash
93
+ python3 -m scripts.inference \
94
+ --model NoSideInputMultiInterfering \
95
+ --checkpoint_path "${MODEL_DIR}/best.ckpt" \
96
+ --mixed_wav /path/to/mixed_input.wav \
97
+ # No side input required for Vanilla-Seq2seq \
98
+ --output_wav /tmp/enhanced_clean.wav
99
+ ```
100
+
101
+ ### 4. Run Inference via Python API
102
+
103
+ ```python
104
+ import os
105
+ from huggingface_hub import snapshot_download
106
+ from tec import inference
107
+
108
+ model_dir = snapshot_download(repo_id="wq2012/vanilla_seq2seq_multi_interfering")
109
+ ckpt_path = os.path.join(model_dir, "best.ckpt")
110
+
111
+ result = inference.run_inference_on_wav(
112
+ model_name="NoSideInputMultiInterfering",
113
+ mixed_wav_path="/path/to/mixed_input.wav",
114
+ interfering_text="currently in mountain view it is 72 degrees",
115
+ checkpoint_path=ckpt_path,
116
+ output_wav_path="/tmp/enhanced_clean.wav",
117
+ )
118
+ print("Enhanced log-Mel spectrogram shape:", result["predicted_mel"].shape)
119
+ ```
120
+
121
+ ### 5. On-Device Inference with Quantized TFLite (`model.tflite`)
122
+
123
+ ```python
124
+ import os
125
+ import numpy as np
126
+ import tensorflow as tf
127
+ from huggingface_hub import snapshot_download
128
+
129
+ model_dir = snapshot_download(repo_id="wq2012/vanilla_seq2seq_multi_interfering")
130
+ tflite_path = os.path.join(model_dir, "model.tflite")
131
+
132
+ interpreter = tf.lite.Interpreter(model_path=tflite_path)
133
+ interpreter.allocate_tensors()
134
+
135
+ for detail in interpreter.get_input_details():
136
+ interpreter.set_tensor(
137
+ detail["index"], np.zeros(detail["shape"], dtype=detail["dtype"])
138
+ )
139
+
140
+ interpreter.invoke()
141
+ output_details = interpreter.get_output_details()
142
+ enhanced_mel = interpreter.get_tensor(output_details[0]["index"])
143
+ print("TFLite predicted log-Mel shape:", enhanced_mel.shape)
144
+ ```
145
+
146
+ ---
147
+
148
+ ## Citation
149
+
150
+ If you use this model or the `textual-echo-cancellation` library in your research, please cite the original paper:
151
+
152
+ ```bibtex
153
+ @inproceedings{ding2021textual,
154
+ title={Textual Echo Cancellation},
155
+ author={Ding, Shaojin and Jia, Ye and Hu, Ke and Wang, Quan},
156
+ booktitle={2021 IEEE Spoken Language Technology Workshop (SLT)},
157
+ pages={666--673},
158
+ year={2021},
159
+ organization={IEEE}
160
+ }
161
+ ```
best.ckpt.data-00000-of-00001 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:03bd97f03236d84ef4a143b86d7b5523c22e75a376b014aec8d8536d9c066c4e
3
+ size 150145632
best.ckpt.index ADDED
Binary file (6.51 kB). View file
 
best.ckpt.meta ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:02b444f9b19ef613d3d3588fe316dd9a27b8367634952e656894045c9e96b8b8
3
+ size 3960008
checkpoint ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ model_checkpoint_path: "best.ckpt"
2
+ all_model_checkpoint_paths: "best.ckpt"
evaluation_metrics.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model": "NoSideInputMultiInterfering",
3
+ "condition": "Multiple interfering voices (LibriTTS + VCTK)",
4
+ "test_clean": {
5
+ "method": "NoSideInputMultiInterfering",
6
+ "num_evaluated": 20,
7
+ "mcd_db": 7.929501243065199,
8
+ "side_input_kb": 0.0,
9
+ "wer": {
10
+ "wer": 31.155778894472363,
11
+ "word_errors": 62,
12
+ "total_words": 199
13
+ }
14
+ },
15
+ "test_other": {
16
+ "method": "NoSideInputMultiInterfering",
17
+ "num_evaluated": 20,
18
+ "mcd_db": 8.716394763946974,
19
+ "side_input_kb": 0.0,
20
+ "wer": {
21
+ "wer": 42.38683127572016,
22
+ "word_errors": 103,
23
+ "total_words": 243
24
+ }
25
+ }
26
+ }
model.tflite ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:abf40b8fd8e5995d78416918a80859c5a455a4cbca783b360c954ab97c62d477
3
+ size 12820608