Instructions to use jzmzhong/accent-id-genaid with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- speechbrain
How to use jzmzhong/accent-id-genaid with speechbrain:
# interface not specified in config.json
- Notebooks
- Google Colab
- Kaggle
GenAID: Generalisable Accent Identification Across Speakers
English Accent Classifier with XLSR model (13 accents)
GenAID is a Generalisable accent identification (AID) model across speakers, introduced as part of the AccentBox paper (ICASSP 2025). It achieves state-of-the-art accent identification on unseen speakers (0.56 accuracy on 13-accent classification).
This repository provides all the necessary tools to perform accent identification from speech recordings with SpeechBrain. The system is trained on a speaker-based resplit of the CommonAccent dataset in English (Common Voice Corpus 17.0, 13 accents), so that validation/testing speakers do not overlap with training speakers.
The provided system can recognize the following 13 accents of English from short speech recordings:
- us
- canadian
- australian
- southasian
- english
- southernafrican
- irish
- scottish
- filipino
- singaporean
- hongkong
- malaysian
- newzealand
Github repository link: https://github.com/jzmzhong/GenAID
NOTE: due to incompatibility with the model and the current SpeechBrain interfaces, we cannot offer the Inference API. Please, follow the steps in "Perform Accent Identification from Speech Recordings" to use this model.
Pipeline description
This system is composed of a fine-tuned XLSR model (facebook/wav2vec2-large-xlsr-53) coupled with statistical pooling and a pre-output MLP that produces 64-dimensional accent embeddings. A classifier, trained with NLL loss, is applied on top of that.
The system is trained with recordings sampled at 16kHz (single channel). The code will automatically normalize your audio (i.e., resampling + mono channel selection) when calling classify_file if needed. Make sure your input tensor is compliant with the expected sampling rate if you use encode_batch and classify_batch.
Install SpeechBrain
This model was trained with SpeechBrain v0.5.16 (old speechbrain.pretrained / speechbrain.lobes.models.huggingface_wav2vec interfaces). Please install the version pinned by the GenAID repository:
git clone https://github.com/jzmzhong/GenAID.git
cd GenAID
pip install -r requirements.txt
pip install --editable .
Perform Accent Identification from Speech Recordings
from speechbrain.pretrained.interfaces import foreign_class
classifier = foreign_class(
source="jzmzhong/accent-id-genaid",
pymodule_file="custom_interface.py",
classname="CustomEncoderWav2vec2Classifier",
)
# Classification
out_prob, score, index, text_lab = classifier.classify_file("example.wav")
print(text_lab)
# Accent embeddings extraction (utterance-level, 64-dim)
import torchaudio
signal, fs = torchaudio.load("example.wav") # must be 16 kHz, mono
embeddings = classifier.encode_batch(signal)
Inference on GPU
To perform inference on the GPU, add run_opts={"device":"cuda"} when calling the foreign_class method.
Training
The model was trained with SpeechBrain. To train it from scratch, follow the steps in the GenAID repository:
git clone https://github.com/jzmzhong/GenAID.git
cd GenAID/recipes/CommonAccent
python train_GenAID.py train_GenAID_v6.yaml
Limitations
We do not provide any warranty on the performance achieved by this model when used on other datasets.
Citation
Cite our work: GenAID / AccentBox
If you find this work useful, please cite:
@inproceedings{zhong2025accentbox,
author = {Zhong, Jinzuomu and Richmond, Korin and Su, Zhiba and Sun, Siqi},
title = {{AccentBox: Towards High-Fidelity Zero-Shot Accent Generation}},
booktitle = {IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP)},
year = {2025},
pages = {1-5},
doi = {10.1109/ICASSP49660.2025.10888332}
}
Cite CommonAccent
The dataset construction and code implementation are based on CommonAccent:
@article{zuluaga2023commonaccent,
title={CommonAccent: Exploring Large Acoustic Pretrained Models for Accent Classification Based on Common Voice},
author={Zuluaga-Gomez, Juan and Ahmed, Sara and Visockas, Danielius and Subakan, Cem},
journal={Interspeech 2023},
url={https://arxiv.org/abs/2305.18283},
year={2023}
}
- Downloads last month
- 46