Accent Identication Models
Collection
3 items โข Updated
Run walston/whisaid-medium-grl on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Use HF Jobs to fine-tune https://huggingface.co/walston/whisaid-medium-grl. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Use HF Jobs to run batch inference with https://huggingface.co/walston/whisaid-medium-grl on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
How to use walston/whisaid-medium-grl with Transformers:
# pip install -U transformers accelerate
# Load model directly
from transformers import WhisAIDForAccentClassification
model = WhisAIDForAccentClassification.from_pretrained("walston/whisaid-medium-grl", device_map="auto")WhisAID Mandarin accent classifier and accent encoder based on Whisper Medium. This checkpoint was trained with a gradient reversal layer (GRL, lambda 0.05) for 10 epochs. The released checkpoint is epoch 9.
Install the WhisAID source package and its dependencies, then load the model:
import torch
from transformers import AutoModel
from whisper import load_audio, log_mel_spectrogram, pad_or_trim
from whisAID import WhisAIDConfig
repo_id = "walston/whisaid-medium-grl"
model = AutoModel.from_config(
WhisAIDConfig.from_pretrained(repo_id)
).cuda().eval()
audio = torch.from_numpy(load_audio("/path/to/audio.wav"))
mel = log_mel_spectrogram(
pad_or_trim(audio), n_mels=model.config.n_mels
).unsqueeze(0).cuda()
with torch.no_grad():
output = model(input_ids=mel)
accent_embedding = output.features[0].cpu().numpy()
accent_id = output.logits.argmax(dim=-1).item()
The model repository stores the Lightning checkpoint. Model integration code is provided by the WhisAID project rather than through remote Hub code.