Upload pretrained tec_multi_interfering checkpoint, TFLite model, and Model Card
Browse files- .gitattributes +2 -34
- README.md +161 -0
- best.ckpt.data-00000-of-00001 +3 -0
- best.ckpt.index +0 -0
- best.ckpt.meta +3 -0
- checkpoint +2 -0
- evaluation_metrics.json +26 -0
- model.tflite +3 -0
.gitattributes
CHANGED
|
@@ -1,35 +1,3 @@
|
|
| 1 |
-
*.
|
| 2 |
-
*.
|
| 3 |
-
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
-
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
-
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
-
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
-
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
-
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
-
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
-
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
-
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
-
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
-
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
-
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
-
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
-
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
-
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
-
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
-
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
-
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
-
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
-
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
-
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
-
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
-
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
-
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
-
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
-
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
-
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
-
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
-
*.xz 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
|
|
|
|
| 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 |
+
# Textual Echo Cancellation (TEC) — Multiple Interfering Voices (`TecMultiInterfering`)
|
| 21 |
+
|
| 22 |
+
Multi-source attention sequence-to-sequence **Textual Echo Cancellation (TEC)** model trained on 24 kHz **LibriTTS** user speech mixed at 0 dB SNR with reverberant **CSTR VCTK** (109-speaker TTS interference). Takes the noisy/reverberant microphone spectrogram (`SpeechEncoderV1`) and the lightweight TTS source transcript (`TtsEncoderV2`, < 0.1 KB side input) to reconstruct the clean user speech spectrogram.
|
| 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 (`TecMultiInterfering`)
|
| 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 (`TEC (proposed)`) |
|
| 40 |
+
| :--- | :---: | :---: | :---: |
|
| 41 |
+
| **WER (%) ↓** | **26.63%** (53/199) | **45.27%** (110/243) | 14.8% / 32.5% |
|
| 42 |
+
| **MCD (dB) ↓** | **7.96 dB** | **8.40 dB** | 6.46 dB / 7.71 dB |
|
| 43 |
+
| **Side Input Size (KB) ↓** | **0.037 KB** | **0.039 KB** | 0.06 KB |
|
| 44 |
+
| **Computational Complexity ↓** | **6.90 GFLOPS** | **6.90 GFLOPS** | 6.90 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 `TecMultiInterfering`.
|
| 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 `TecMultiInterfering`.
|
| 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/tec_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 TecMultiInterfering \
|
| 95 |
+
--checkpoint_path "${MODEL_DIR}/best.ckpt" \
|
| 96 |
+
--mixed_wav /path/to/mixed_input.wav \
|
| 97 |
+
--interfering_text "currently in mountain view it is 72 degrees" \
|
| 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/tec_multi_interfering")
|
| 109 |
+
ckpt_path = os.path.join(model_dir, "best.ckpt")
|
| 110 |
+
|
| 111 |
+
result = inference.run_inference_on_wav(
|
| 112 |
+
model_name="TecMultiInterfering",
|
| 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/tec_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:6a51d4a5d831c0f659f622907c352f493b5ce3117236b0bda536b46e603b8664
|
| 3 |
+
size 217680676
|
best.ckpt.index
ADDED
|
Binary file (8.82 kB). View file
|
|
|
best.ckpt.meta
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e723777eee826749b71d53a36819ee8ba79440a9fe6e8347ee1e92e683dc0e5d
|
| 3 |
+
size 5482185
|
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": "TecMultiInterfering",
|
| 3 |
+
"condition": "Multiple interfering voices (LibriTTS + VCTK)",
|
| 4 |
+
"test_clean": {
|
| 5 |
+
"method": "TecMultiInterfering",
|
| 6 |
+
"num_evaluated": 20,
|
| 7 |
+
"mcd_db": 7.95800121908773,
|
| 8 |
+
"side_input_kb": 0.0372,
|
| 9 |
+
"wer": {
|
| 10 |
+
"wer": 26.633165829145728,
|
| 11 |
+
"word_errors": 53,
|
| 12 |
+
"total_words": 199
|
| 13 |
+
}
|
| 14 |
+
},
|
| 15 |
+
"test_other": {
|
| 16 |
+
"method": "TecMultiInterfering",
|
| 17 |
+
"num_evaluated": 20,
|
| 18 |
+
"mcd_db": 8.397257016888547,
|
| 19 |
+
"side_input_kb": 0.039,
|
| 20 |
+
"wer": {
|
| 21 |
+
"wer": 45.267489711934154,
|
| 22 |
+
"word_errors": 110,
|
| 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:a0ecf4c192206dd7b95d1104258b63f7b172f921d5ad8cdfb8ebf028bdac7d48
|
| 3 |
+
size 72746680
|