Upload seamless_communication/cli/expressivity/evaluate/run_asr_bleu.py with huggingface_hub
Browse files
seamless_communication/cli/expressivity/evaluate/run_asr_bleu.py
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright (c) Meta Platforms, Inc. and affiliates
|
2 |
+
# All rights reserved.
|
3 |
+
#
|
4 |
+
# This source code is licensed under the license found in the
|
5 |
+
# MIT_LICENSE file in the root directory of this source tree.
|
6 |
+
|
7 |
+
from fire import Fire
|
8 |
+
import pandas as pd
|
9 |
+
import csv
|
10 |
+
from seamless_communication.cli.eval_utils.compute_metrics import (
|
11 |
+
compute_quality_metrics,
|
12 |
+
)
|
13 |
+
import os
|
14 |
+
from fairseq2.typing import Device
|
15 |
+
from pathlib import Path
|
16 |
+
|
17 |
+
|
18 |
+
def run_asr_bleu_expressive_model(
|
19 |
+
generation_dir_path: str,
|
20 |
+
generate_tsv_filename: str,
|
21 |
+
tgt_lang: str,
|
22 |
+
):
|
23 |
+
compute_quality_metrics(
|
24 |
+
f"{generation_dir_path}/{generate_tsv_filename}",
|
25 |
+
Path(generation_dir_path),
|
26 |
+
tgt_lang,
|
27 |
+
"S2ST",
|
28 |
+
device=Device("cuda"),
|
29 |
+
ref_text_col_name="tgt_text",
|
30 |
+
pred_text_col_name="s2t_out",
|
31 |
+
pred_audio_col_name="hypo_audio",
|
32 |
+
)
|
33 |
+
|
34 |
+
|
35 |
+
if __name__ == "__main__":
|
36 |
+
Fire(run_asr_bleu_expressive_model)
|