Note: The model may sometimes confuse closely related dialects.
Inference
# load the modelimport torch
from transformers import AutoModelForAudioClassification
from transformers import AutoFeatureExtractor
import librosa
ckpt = "Respair/Arabic_Vocal_Dialect_Classifier"
feature_extractor = AutoFeatureExtractor.from_pretrained(ckpt)
model = AutoModelForAudioClassification.from_pretrained(ckpt).to('cuda').to(torch.bfloat16) # if your hardware supports it# inference functiondefclassify_dialect(audio):
wav = librosa.load(audio, sr=16_000)[0]
inputs = feature_extractor(wav, sampling_rate=16_000, return_tensors="pt").to(torch.bfloat16).to('cuda')
with torch.no_grad():
logits = model(**inputs).logits
predicted_class_ids = torch.argmax(logits).item()
predicted_class_id = predicted_class_ids.item() ifhasattr(predicted_class_ids, 'item') elseint(predicted_class_ids)
predicted_label = model.config.id2label[predicted_class_id]
return predicted_label
# run the function
classify_dialect("path/to/audio.mp3") # output something like -> "egyptian"
Runs of Respair Arabic_Vocal_Dialect_Classifier on huggingface.co
7
Total runs
0
24-hour runs
0
3-day runs
0
7-day runs
0
30-day runs
More Information About Arabic_Vocal_Dialect_Classifier huggingface.co Model
Arabic_Vocal_Dialect_Classifier huggingface.co
Arabic_Vocal_Dialect_Classifier huggingface.co is an AI model on huggingface.co that provides Arabic_Vocal_Dialect_Classifier's model effect (), which can be used instantly with this Respair Arabic_Vocal_Dialect_Classifier model. huggingface.co supports a free trial of the Arabic_Vocal_Dialect_Classifier model, and also provides paid use of the Arabic_Vocal_Dialect_Classifier. Support call Arabic_Vocal_Dialect_Classifier model through api, including Node.js, Python, http.
Arabic_Vocal_Dialect_Classifier huggingface.co is an online trial and call api platform, which integrates Arabic_Vocal_Dialect_Classifier's modeling effects, including api services, and provides a free online trial of Arabic_Vocal_Dialect_Classifier, you can try Arabic_Vocal_Dialect_Classifier online for free by clicking the link below.
Respair Arabic_Vocal_Dialect_Classifier online free url in huggingface.co:
Arabic_Vocal_Dialect_Classifier is an open source model from GitHub that offers a free installation service, and any user can find Arabic_Vocal_Dialect_Classifier on GitHub to install. At the same time, huggingface.co provides the effect of Arabic_Vocal_Dialect_Classifier install, users can directly use Arabic_Vocal_Dialect_Classifier installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
Arabic_Vocal_Dialect_Classifier install url in huggingface.co: