Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -2175,10 +2175,10 @@ extractor = sherpa_onnx.SpeakerEmbeddingExtractor(
|
|
| 2175 |
sherpa_onnx.SpeakerEmbeddingExtractorConfig(model=embed_path, num_threads=2, provider="cpu")
|
| 2176 |
)
|
| 2177 |
|
| 2178 |
-
# 2. this repo's tiny gender head
|
| 2179 |
head_path = hf_hub_download("AfriSpeech/afrispeech-gender-id", "onnx/model.onnx")
|
| 2180 |
-
|
| 2181 |
-
|
| 2182 |
session = ort.InferenceSession(head_path, providers=["CPUExecutionProvider"])
|
| 2183 |
|
| 2184 |
# 3. run on a 16 kHz mono wav file
|
|
@@ -2199,7 +2199,7 @@ whole-directory batch), built on the same `gender_id.py` helper.
|
|
| 2199 |
## Files
|
| 2200 |
|
| 2201 |
- `onnx/model.onnx` - the trained MLP head (embedding -> logits)
|
| 2202 |
-
- `
|
| 2203 |
- `metrics.json` - full validation/test metrics, including the per-language table above
|
| 2204 |
- `scripts/gender_id.py` - reusable `GenderClassifier` class
|
| 2205 |
- `scripts/infer_file.py` - classify one audio file
|
|
|
|
| 2175 |
sherpa_onnx.SpeakerEmbeddingExtractorConfig(model=embed_path, num_threads=2, provider="cpu")
|
| 2176 |
)
|
| 2177 |
|
| 2178 |
+
# 2. this repo's tiny gender head + its config (holds the label map)
|
| 2179 |
head_path = hf_hub_download("AfriSpeech/afrispeech-gender-id", "onnx/model.onnx")
|
| 2180 |
+
config = json.load(open(hf_hub_download("AfriSpeech/afrispeech-gender-id", "config.json")))
|
| 2181 |
+
label_map = config["label_map"]
|
| 2182 |
session = ort.InferenceSession(head_path, providers=["CPUExecutionProvider"])
|
| 2183 |
|
| 2184 |
# 3. run on a 16 kHz mono wav file
|
|
|
|
| 2199 |
## Files
|
| 2200 |
|
| 2201 |
- `onnx/model.onnx` - the trained MLP head (embedding -> logits)
|
| 2202 |
+
- `config.json` - architecture metadata plus `label_map` (`{"0": "female", "1": "male"}`), the output-index mapping needed to interpret the head's output
|
| 2203 |
- `metrics.json` - full validation/test metrics, including the per-language table above
|
| 2204 |
- `scripts/gender_id.py` - reusable `GenderClassifier` class
|
| 2205 |
- `scripts/infer_file.py` - classify one audio file
|