Upload benchmark.py with huggingface_hub
Browse files- benchmark.py +5 -5
benchmark.py
CHANGED
|
@@ -4,7 +4,7 @@ Measures how long the model makes each expression, whether an audio event
|
|
| 4 |
classifier hears the expressions in the released samples, and the ONNX speed
|
| 5 |
on the CPU.
|
| 6 |
|
| 7 |
-
DIZIONE_DATA=release/phonemizer
|
| 8 |
"""
|
| 9 |
|
| 10 |
import json
|
|
@@ -20,15 +20,15 @@ import torch
|
|
| 20 |
from scipy.signal import resample_poly
|
| 21 |
from transformers import ASTFeatureExtractor, ASTForAudioClassification
|
| 22 |
|
| 23 |
-
from
|
| 24 |
-
from
|
| 25 |
|
| 26 |
THREADS = 4
|
| 27 |
EVENT_MODEL_ID = "MIT/ast-finetuned-audioset-10-10-0.4593"
|
| 28 |
# AudioSet classes that count as hearing each expression, as in generate.py.
|
| 29 |
EVENT_LABELS = {"sigh": ["Sigh", "Breathing"], "exhale": ["Sigh", "Breathing"], "gasp": ["Gasp", "Breathing"]}
|
| 30 |
SENTENCES = (
|
| 31 |
-
"Hello! This is
|
| 32 |
"The weather is nice today, and I feel very relaxed.",
|
| 33 |
"Did you really pay forty two dollars for that on March third?",
|
| 34 |
"After a long journey across the mountains, the travellers reached the small village, where they were welcomed.",
|
|
@@ -92,7 +92,7 @@ def realtime_factor(path: Path, sample_rate: int) -> float:
|
|
| 92 |
|
| 93 |
def main() -> None:
|
| 94 |
release = Path(sys.argv[1])
|
| 95 |
-
model = load_model(release / "
|
| 96 |
config = model.config
|
| 97 |
report = {
|
| 98 |
"expression_seconds": expression_lengths(model, config.hop / config.sample_rate),
|
|
|
|
| 4 |
classifier hears the expressions in the released samples, and the ONNX speed
|
| 5 |
on the CPU.
|
| 6 |
|
| 7 |
+
DIZIONE_DATA=release/phonemizer FIATO_FRONTEND=own python benchmark.py release
|
| 8 |
"""
|
| 9 |
|
| 10 |
import json
|
|
|
|
| 20 |
from scipy.signal import resample_poly
|
| 21 |
from transformers import ASTFeatureExtractor, ASTForAudioClassification
|
| 22 |
|
| 23 |
+
from fiato.infer import load_model, speak
|
| 24 |
+
from fiato.text import EXPRESSIONS, phonemize
|
| 25 |
|
| 26 |
THREADS = 4
|
| 27 |
EVENT_MODEL_ID = "MIT/ast-finetuned-audioset-10-10-0.4593"
|
| 28 |
# AudioSet classes that count as hearing each expression, as in generate.py.
|
| 29 |
EVENT_LABELS = {"sigh": ["Sigh", "Breathing"], "exhale": ["Sigh", "Breathing"], "gasp": ["Gasp", "Breathing"]}
|
| 30 |
SENTENCES = (
|
| 31 |
+
"Hello! This is fiato.",
|
| 32 |
"The weather is nice today, and I feel very relaxed.",
|
| 33 |
"Did you really pay forty two dollars for that on March third?",
|
| 34 |
"After a long journey across the mountains, the travellers reached the small village, where they were welcomed.",
|
|
|
|
| 92 |
|
| 93 |
def main() -> None:
|
| 94 |
release = Path(sys.argv[1])
|
| 95 |
+
model = load_model(release / "fiato.pt")
|
| 96 |
config = model.config
|
| 97 |
report = {
|
| 98 |
"expression_seconds": expression_lengths(model, config.hop / config.sample_rate),
|