mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-30 05:13:59 +08:00
update:优化asr测速源:从已有的几个文件中测速度
This commit is contained in:
@@ -411,7 +411,7 @@ LLM:
|
|||||||
base_url: https://host/api/v1
|
base_url: https://host/api/v1
|
||||||
# 你可以在这里找到你的api_key
|
# 你可以在这里找到你的api_key
|
||||||
# https://cloud.tryfastgpt.ai/account/apikey
|
# https://cloud.tryfastgpt.ai/account/apikey
|
||||||
api_key: fastgpt-xxx
|
api_key: 你的fastgpt密钥
|
||||||
variables:
|
variables:
|
||||||
k: "v"
|
k: "v"
|
||||||
k2: "v2"
|
k2: "v2"
|
||||||
|
|||||||
@@ -30,10 +30,12 @@ class AsyncPerformanceTester:
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.test_wav_list = []
|
self.test_wav_list = []
|
||||||
self.wav_root = r".\config\assets\test_asr"
|
self.wav_root = r"config/assets"
|
||||||
os.makedirs(self.wav_root, exist_ok=True)
|
for file_name in os.listdir(self.wav_root):
|
||||||
for wav_name in os.listdir(self.wav_root):
|
file_path = os.path.join(self.wav_root, file_name)
|
||||||
with open(os.path.join(self.wav_root, wav_name), "rb") as f:
|
# 检查文件大小是否大于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.test_wav_list.append(f.read())
|
||||||
|
|
||||||
self.results = {"llm": {}, "tts": {}, "stt": {}, "combinations": []}
|
self.results = {"llm": {}, "tts": {}, "stt": {}, "combinations": []}
|
||||||
@@ -335,7 +337,9 @@ class AsyncPerformanceTester:
|
|||||||
llm_final_score = llm_score * 0.7 + llm_stability * 0.3
|
llm_final_score = llm_score * 0.7 + llm_stability * 0.3
|
||||||
|
|
||||||
# 总分 = LLM得分(70%) + TTS得分(30%) + STT得分(30%)
|
# 总分 = 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(
|
self.results["combinations"].append(
|
||||||
{
|
{
|
||||||
@@ -512,7 +516,9 @@ class AsyncPerformanceTester:
|
|||||||
# 为每个句子创建独立任务
|
# 为每个句子创建独立任务
|
||||||
for sentence in self.test_sentences:
|
for sentence in self.test_sentences:
|
||||||
sentence = sentence.encode("utf-8").decode("utf-8")
|
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测试任务
|
# TTS测试任务
|
||||||
if self.config.get("TTS") is not None:
|
if self.config.get("TTS") is not None:
|
||||||
|
|||||||
Reference in New Issue
Block a user