VSydorskyi
commited on
Commit
•
a95e066
1
Parent(s):
6d0ec1a
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Model Card for Respeecher/ukrainian-data2vec
|
2 |
+
|
3 |
+
This model can be used as Feature Extractor model for Ukrainian language audio data
|
4 |
+
|
5 |
+
It can also be used as Backbone for downstream tasks, like ASR, Audio Classification, etc.
|
6 |
+
|
7 |
+
### How to Get Started with the Model
|
8 |
+
|
9 |
+
```python
|
10 |
+
from transformers import AutoProcessor, Data2VecAudioModel
|
11 |
+
import torch
|
12 |
+
from datasets import load_dataset, Audio
|
13 |
+
|
14 |
+
dataset = load_dataset("mozilla-foundation/common_voice_11_0", "uk", split="validation")
|
15 |
+
# Resample
|
16 |
+
dataset = dataset.cast_column("audio", Audio(sampling_rate=16_000))
|
17 |
+
|
18 |
+
processor = AutoProcessor.from_pretrained("Respeecher/ukrainian-data2vec")
|
19 |
+
model = Data2VecAudioModel.from_pretrained("Respeecher/ukrainian-data2vec")
|
20 |
+
|
21 |
+
# audio file is decoded on the fly
|
22 |
+
inputs = processor(dataset[0]["audio"]["array"], sampling_rate=sampling_rate, return_tensors="pt")
|
23 |
+
with torch.no_grad():
|
24 |
+
outputs = model(**inputs)
|
25 |
+
|
26 |
+
last_hidden_states = outputs.last_hidden_state
|
27 |
+
list(last_hidden_states.shape)
|
28 |
+
```
|