Audio Classification
Transformers
Safetensors
Chinese
genaid
feature-extraction
accent-recognition
speaker-disentanglement
wav2vec2
custom_code
Instructions to use walston/GenAID with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use walston/GenAID with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("audio-classification", model="walston/GenAID", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("walston/GenAID", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Add GenAID vs WhisAID architecture comparison
Browse files
README.md
CHANGED
|
@@ -14,6 +14,46 @@ tags:
|
|
| 14 |
|
| 15 |
GenAID is a Chinese accent encoder based on `facebook/wav2vec2-large-xlsr-53`. It produces a 64-dimensional accent embedding designed to reduce speaker information. The model recognizes nine labels: north, Sichuan, Guangdong, south, Henan, Shanghai, Wuhan, Tianjin, and Singapore.
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
## Usage
|
| 18 |
|
| 19 |
```python
|
|
|
|
| 14 |
|
| 15 |
GenAID is a Chinese accent encoder based on `facebook/wav2vec2-large-xlsr-53`. It produces a 64-dimensional accent embedding designed to reduce speaker information. The model recognizes nine labels: north, Sichuan, Guangdong, south, Henan, Shanghai, Wuhan, Tianjin, and Singapore.
|
| 16 |
|
| 17 |
+
## GenAID and WhisAID Medium side by side
|
| 18 |
+
|
| 19 |
+
The comparison excludes Whisper's text decoder because accent identification uses only its audio encoder.
|
| 20 |
+
|
| 21 |
+
| Component | GenAID (this model) | WhisAID Medium |
|
| 22 |
+
|---|---|---|
|
| 23 |
+
| Model-native input | Raw 16 kHz waveform `[B, T]` | 80-bin Whisper log-Mel `[B, 80, 3000]` |
|
| 24 |
+
| Backbone | Wav2Vec2 XLSR-53 Large | Whisper Medium audio encoder |
|
| 25 |
+
| Audio frontend | 7 convolution layers, combined stride 320 | 2 convolution layers, second layer stride 2 |
|
| 26 |
+
| Frontend output | `[B, Tβ², 512]` | `[B, 1500, 1024]` |
|
| 27 |
+
| Feature projection | `512 β 1024` | None after the CNN |
|
| 28 |
+
| Transformer blocks | 24 | 24 |
|
| 29 |
+
| Transformer width | 1024 | 1024 |
|
| 30 |
+
| Attention heads | 16 Γ 64 dimensions | 16 Γ 64 dimensions |
|
| 31 |
+
| FFN per block | `1024 β 4096 β 1024` | `1024 β 4096 β 1024` |
|
| 32 |
+
| Transformer output | `[B, Tβ², 1024]` | `[B, 1500, 1024]` |
|
| 33 |
+
| Pooling | Attention-mask-aware temporal mean | Temporal mean |
|
| 34 |
+
| Accent embedding | `1024 β 64 β 64` | `1024 β 256` |
|
| 35 |
+
| Accent output | `64 β 9` | `256 β 9` |
|
| 36 |
+
| Speaker disentanglement | `64 β 336`; uniform-distribution adversarial MSE | GRL + speaker-token attention, `256 β 336` |
|
| 37 |
+
| Task-relevant parameters | **315,530,560** | 306,473,897, excluding text decoder |
|
| 38 |
+
| Frozen parameters | 4,210,176 (7-layer XLSR CNN) | Audio encoder is evaluated under `torch.no_grad()` in the compared recipe |
|
| 39 |
+
| Effectively updated parameters | **311,320,384** | 444,249 |
|
| 40 |
+
|
| 41 |
+
`Tβ²` is the downsampled XLSR sequence length. For a 10-second, 16 kHz waveform, `T=160,000` and `Tβ²β499`.
|
| 42 |
+
|
| 43 |
+
### GenAID module details
|
| 44 |
+
|
| 45 |
+
| Module | Layers | Input β output | Parameters | Training behavior |
|
| 46 |
+
|---|---:|---|---:|---|
|
| 47 |
+
| XLSR feature extractor | 7 CNN layers | `[B,T] β [B,Tβ²,512]` | 4,210,176 | Frozen |
|
| 48 |
+
| Feature projection + XLSR encoder | Projection + 24 Transformer blocks | `[B,Tβ²,512] β [B,Tβ²,1024]` | 311,228,544 | Updated |
|
| 49 |
+
| Masked mean pooling | 1 | `[B,Tβ²,1024] β [B,1024]` | 0 | No parameters |
|
| 50 |
+
| Information bottleneck | 2 Γ Linear + GELU | `1024 β 64 β 64` | 69,760 | Updated |
|
| 51 |
+
| Accent classifier | Linear, no bias | `64 β 9` | 576 | Updated |
|
| 52 |
+
| Speaker adversarial classifier | Linear, no bias | `64 β 336` | 21,504 | Updated during training |
|
| 53 |
+
| **Total** | | | **315,530,560** | |
|
| 54 |
+
|
| 55 |
+
The 64-dimensional output of the second GELU is the reusable accent embedding. The speaker classifier is a training-only probe: its predicted speaker distribution is optimized toward a uniform distribution, discouraging the bottleneck from retaining speaker identity. The speaker branch is not required when extracting embeddings.
|
| 56 |
+
|
| 57 |
## Usage
|
| 58 |
|
| 59 |
```python
|