Skip to content

hangngdata/music_genre_classifier

Repository files navigation

Wav2Vec2 Finetuning for Music Genre Classification

A small, end-to-end project that finetunes a Hugging Face Wav2Vec2 model on the classic GTZAN dataset to classify music genres.

Highlights

  • Self-supervised Wav2Vec2 finetuned for 10 GTZAN genres
  • Best validation accuracy: 87%
  • Training with transformers.Trainer (HF)
  • Gradio web UI to upload an audio file and get predictions

Quickstart: Inference with the Hub

from transformers import pipeline

model_id = "hangnguyen25/wav2vec2-base-finetuned-gtzan"
pipe = pipeline(
    "audio-classification",
    model=model_id
    )

preds = pipe("path/to/your/audio.wav")
print(preds)

Acknowledgements

  • Dataset: GTZAN
  • Libraries: Hugging Face transformers, datasets, evaluate, accelerate; librosa; gradio; PyTorch

About

A finetuned version of Wav2Vec2 for music genre classification

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published