update:优化asr测速源:从已有的几个文件中测速度

This commit is contained in:
hrz 2025-05-20 11:14:20 +08:00
parent 84ac1b6686
commit 5360cbf19c
2 changed files with 32 additions and 26 deletions

View file

@ -411,7 +411,7 @@ LLM:
base_url: https://host/api/v1
# 你可以在这里找到你的api_key
# https://cloud.tryfastgpt.ai/account/apikey
api_key: fastgpt-xxx
api_key: 你的fastgpt密钥
variables:
k: "v"
k2: "v2"

View file

@ -30,10 +30,12 @@ class AsyncPerformanceTester:
)
self.test_wav_list = []
self.wav_root = r".\config\assets\test_asr"
os.makedirs(self.wav_root, exist_ok=True)
for wav_name in os.listdir(self.wav_root):
with open(os.path.join(self.wav_root, wav_name), "rb") as f:
self.wav_root = r"config/assets"
for file_name in os.listdir(self.wav_root):
file_path = os.path.join(self.wav_root, file_name)
# 检查文件大小是否大于300KB
if os.path.getsize(file_path) > 300 * 1024: # 300KB = 300 * 1024 bytes
with open(file_path, "rb") as f:
self.test_wav_list.append(f.read())
self.results = {"llm": {}, "tts": {}, "stt": {}, "combinations": []}
@ -335,7 +337,9 @@ class AsyncPerformanceTester:
llm_final_score = llm_score * 0.7 + llm_stability * 0.3
# 总分 = LLM得分(70%) + TTS得分(30%) + STT得分(30%)
total_score = llm_final_score * 0.7 + tts_score * 0.3 + stt_score * 0.3
total_score = (
llm_final_score * 0.7 + tts_score * 0.3 + stt_score * 0.3
)
self.results["combinations"].append(
{
@ -512,7 +516,9 @@ class AsyncPerformanceTester:
# 为每个句子创建独立任务
for sentence in self.test_sentences:
sentence = sentence.encode("utf-8").decode("utf-8")
all_tasks.append(self._test_single_sentence(llm_name, llm, sentence))
all_tasks.append(
self._test_single_sentence(llm_name, llm, sentence)
)
# TTS测试任务
if self.config.get("TTS") is not None: