mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-28 19:13:52 +08:00
up:修改性能测试工具读取配置的目录
This commit is contained in:
@@ -4,11 +4,11 @@ import os
|
|||||||
import statistics
|
import statistics
|
||||||
import time
|
import time
|
||||||
from typing import Dict
|
from typing import Dict
|
||||||
|
import yaml
|
||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
from tabulate import tabulate
|
from tabulate import tabulate
|
||||||
|
|
||||||
from config.settings import load_config
|
|
||||||
from core.utils.asr import create_instance as create_stt_instance
|
from core.utils.asr import create_instance as create_stt_instance
|
||||||
from core.utils.llm import create_instance as create_llm_instance
|
from core.utils.llm import create_instance as create_llm_instance
|
||||||
from core.utils.tts import create_instance as create_tts_instance
|
from core.utils.tts import create_instance as create_tts_instance
|
||||||
@@ -19,7 +19,14 @@ description = "基础性能测试工具"
|
|||||||
|
|
||||||
class AsyncPerformanceTester:
|
class AsyncPerformanceTester:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.config = load_config()
|
# 从data/.config.yaml读取配置
|
||||||
|
config_path = os.path.join("data", ".config.yaml")
|
||||||
|
if not os.path.exists(config_path):
|
||||||
|
raise FileNotFoundError(f"配置文件 {config_path} 不存在")
|
||||||
|
|
||||||
|
with open(config_path, "r", encoding="utf-8") as f:
|
||||||
|
self.config = yaml.safe_load(f) or {}
|
||||||
|
|
||||||
self.test_sentences = self.config.get("module_test", {}).get(
|
self.test_sentences = self.config.get("module_test", {}).get(
|
||||||
"test_sentences",
|
"test_sentences",
|
||||||
[
|
[
|
||||||
|
|||||||
@@ -3,18 +3,25 @@ import asyncio
|
|||||||
import logging
|
import logging
|
||||||
import statistics
|
import statistics
|
||||||
import base64
|
import base64
|
||||||
|
import yaml
|
||||||
from typing import Dict
|
from typing import Dict
|
||||||
from tabulate import tabulate
|
from tabulate import tabulate
|
||||||
from config.settings import load_config
|
|
||||||
from core.utils.vllm import create_instance
|
from core.utils.vllm import create_instance
|
||||||
|
|
||||||
# 设置全局日志级别为WARNING,抑制INFO级别日志
|
# 设置全局日志级别为WARNING,抑制INFO级别日志
|
||||||
logging.basicConfig(level=logging.WARNING)
|
logging.basicConfig(level=logging.WARNING)
|
||||||
description = "视觉识别模型性能测试"
|
|
||||||
|
|
||||||
|
description = "视觉识别模型性能测试"
|
||||||
class AsyncVisionPerformanceTester:
|
class AsyncVisionPerformanceTester:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.config = load_config()
|
# 从data/.config.yaml读取配置
|
||||||
|
config_path = os.path.join("data", ".config.yaml")
|
||||||
|
if not os.path.exists(config_path):
|
||||||
|
raise FileNotFoundError(f"配置文件 {config_path} 不存在")
|
||||||
|
|
||||||
|
with open(config_path, "r", encoding="utf-8") as f:
|
||||||
|
self.config = yaml.safe_load(f) or {}
|
||||||
|
|
||||||
self.test_images = [
|
self.test_images = [
|
||||||
"../../docs/images/demo1.png",
|
"../../docs/images/demo1.png",
|
||||||
"../../docs/images/demo2.png",
|
"../../docs/images/demo2.png",
|
||||||
|
|||||||
Reference in New Issue
Block a user