Instructions to use sem-xarala/sem with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- speechbrain
How to use sem-xarala/sem with speechbrain:
# interface not specified in config.json
- Notebooks
- Google Colab
- Kaggle
Upload 2 files
Browse files- Sem Xarala .py +23 -0
- Sem Xarala README.md +47 -0
Sem Xarala .py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Misaal bu gàtt: jëfandikoo sem-xarala/sem ak dataset-u WAXAL Wolof."""
|
| 2 |
+
import torch
|
| 3 |
+
import torchaudio
|
| 4 |
+
from datasets import load_dataset
|
| 5 |
+
from speechbrain.inference.classifiers import EncoderClassifier
|
| 6 |
+
|
| 7 |
+
MODEL_ID = "sem-xarala/sem"
|
| 8 |
+
TARGET_SR = 16_000
|
| 9 |
+
|
| 10 |
+
model = EncoderClassifier.from_hparams(source=MODEL_ID, savedir="pretrained_sem")
|
| 11 |
+
|
| 12 |
+
ds = load_dataset("perrynelson/waxal-wolof", split="test", streaming=True)
|
| 13 |
+
sample = next(iter(ds))
|
| 14 |
+
|
| 15 |
+
wav = torch.tensor(sample["audio"]["array"], dtype=torch.float32)
|
| 16 |
+
sr = sample["audio"]["sampling_rate"]
|
| 17 |
+
if sr != TARGET_SR:
|
| 18 |
+
wav = torchaudio.functional.resample(wav, sr, TARGET_SR)
|
| 19 |
+
|
| 20 |
+
with torch.no_grad():
|
| 21 |
+
emb = model.encode_batch(wav.unsqueeze(0))
|
| 22 |
+
|
| 23 |
+
print("Embedding:", tuple(emb.shape))
|
Sem Xarala README.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: wo
|
| 3 |
+
license: apache-2.0
|
| 4 |
+
library_name: speechbrain
|
| 5 |
+
base_model: HRB25/embeddinggemma-2-sem-audio
|
| 6 |
+
datasets:
|
| 7 |
+
- perrynelson/waxal-wolof
|
| 8 |
+
tags:
|
| 9 |
+
- wolof
|
| 10 |
+
- audio
|
| 11 |
+
- speechbrain
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# sem-xarala/sem
|
| 15 |
+
|
| 16 |
+
Model bu Wolof bu ñu defar ngir jëfandikoo ak baat (audio). Dafa sukkandiku ci
|
| 17 |
+
[HRB25/embeddinggemma-2-sem-audio](https://huggingface.co/HRB25/embeddinggemma-2-sem-audio),
|
| 18 |
+
ñu jàngal ko ci dataset-u
|
| 19 |
+
[perrynelson/waxal-wolof](https://huggingface.co/datasets/perrynelson/waxal-wolof),
|
| 20 |
+
te dafay jëfandikoo [SpeechBrain](https://speechbrain.github.io/).
|
| 21 |
+
|
| 22 |
+
## Setal
|
| 23 |
+
|
| 24 |
+
```bash
|
| 25 |
+
pip install speechbrain datasets torch torchaudio
|
| 26 |
+
```
|
| 27 |
+
|
| 28 |
+
## Jëfandikoo
|
| 29 |
+
|
| 30 |
+
```python
|
| 31 |
+
from speechbrain.inference.classifiers import EncoderClassifier
|
| 32 |
+
|
| 33 |
+
model = EncoderClassifier.from_hparams(source="sem-xarala/sem", savedir="pretrained_sem")
|
| 34 |
+
emb = model.encode_batch(model.load_audio("baat.wav").unsqueeze(0))
|
| 35 |
+
print(emb.shape)
|
| 36 |
+
```
|
| 37 |
+
|
| 38 |
+
Gis `example.py` ngir misaal bu mat ak dataset-u WAXAL.
|
| 39 |
+
|
| 40 |
+
## Cëslaay
|
| 41 |
+
|
| 42 |
+
- Baat yi war nañu nekk 16 kHz, mono (dafay soppiku ci kod bi).
|
| 43 |
+
- Model bi defarees na ko ngir Wolof rekk.
|
| 44 |
+
|
| 45 |
+
## Lisaas
|
| 46 |
+
|
| 47 |
+
Apache-2.0 (soppi ko su ko wuyoo ak lisaas bu model bi ak dataset bi).
|