Spaces:
Sleeping
Sleeping
Update PER calculation
Browse files- evaluation/svs_eval.py +4 -1
evaluation/svs_eval.py
CHANGED
|
@@ -5,6 +5,7 @@ import torch
|
|
| 5 |
import uuid
|
| 6 |
from pathlib import Path
|
| 7 |
from transformers import pipeline
|
|
|
|
| 8 |
|
| 9 |
# ----------- Initialization -----------
|
| 10 |
|
|
@@ -109,7 +110,9 @@ def eval_per(audio_path, reference_text, model=None):
|
|
| 109 |
generate_kwargs={"language": "mandarin"}
|
| 110 |
)['text']
|
| 111 |
hyp_pinyin = pypinyin_g2p_phone_without_prosody(asr_result)
|
| 112 |
-
|
|
|
|
|
|
|
| 113 |
|
| 114 |
|
| 115 |
def eval_aesthetic(audio_path, predictor):
|
|
|
|
| 5 |
import uuid
|
| 6 |
from pathlib import Path
|
| 7 |
from transformers import pipeline
|
| 8 |
+
import jiwer
|
| 9 |
|
| 10 |
# ----------- Initialization -----------
|
| 11 |
|
|
|
|
| 110 |
generate_kwargs={"language": "mandarin"}
|
| 111 |
)['text']
|
| 112 |
hyp_pinyin = pypinyin_g2p_phone_without_prosody(asr_result)
|
| 113 |
+
ref_pinyin = pypinyin_g2p_phone_without_prosody(reference_text)
|
| 114 |
+
per = jiwer.wer(ref_pinyin, hyp_pinyin)
|
| 115 |
+
return {"per": per}
|
| 116 |
|
| 117 |
|
| 118 |
def eval_aesthetic(audio_path, predictor):
|