Downloads · 30 days
7
15% of all-time downloads
walston/whisaid-medium-grl
whisaid-medium-grl is a machine learning model from walston. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for transformers.
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.
Downloads · 30 days
7
15% of all-time downloads
All-time downloads
47
Public
Repo size
3.1 GB
Likes
0
Public
Click a slice to open those files.
.ckpt3.1 GB · 100%
From the Hugging Face model README
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.