duault
commited on
Commit
•
31d3044
1
Parent(s):
255a4f2
Update README.md
Browse files
README.md
CHANGED
@@ -3,4 +3,30 @@ datasets:
|
|
3 |
- lewtun/music_genres_small
|
4 |
base_model:
|
5 |
- facebook/wav2vec2-large
|
6 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
- lewtun/music_genres_small
|
4 |
base_model:
|
5 |
- facebook/wav2vec2-large
|
6 |
+
---
|
7 |
+
|
8 |
+
# My Music Genre Classification Model 🎶
|
9 |
+
This model classifies music genres based on audio signals. It was fine-tuned on the `music_genres_small` dataset using the Wav2Vec2 architecture.
|
10 |
+
|
11 |
+
## Metrics
|
12 |
+
- **Validation Accuracy**: 69%
|
13 |
+
- **F1 Score**: 68%
|
14 |
+
- **Validation Loss**: 1.03
|
15 |
+
|
16 |
+
## Usage
|
17 |
+
```python
|
18 |
+
from transformers import Wav2Vec2ForSequenceClassification, Wav2Vec2FeatureExtractor
|
19 |
+
import torch
|
20 |
+
|
21 |
+
# Load the model and feature extractor
|
22 |
+
model = Wav2Vec2ForSequenceClassification.from_pretrained("username/repo-name")
|
23 |
+
feature_extractor = Wav2Vec2FeatureExtractor.from_pretrained("username/repo-name")
|
24 |
+
|
25 |
+
# Prepare input
|
26 |
+
audio = ... # Your audio array
|
27 |
+
inputs = feature_extractor(audio, sampling_rate=16000, return_tensors="pt")
|
28 |
+
|
29 |
+
# Make predictions
|
30 |
+
logits = model(**inputs).logits
|
31 |
+
predicted_class = torch.argmax(logits, dim=-1).item()
|
32 |
+
print(predicted_class)
|