From 4cc7247c3733c9c88f343c7432731e9b296e6a88 Mon Sep 17 00:00:00 2001 From: CGD <3030332422@qq.com> Date: Wed, 4 Jun 2025 14:35:21 +0800 Subject: [PATCH] =?UTF-8?q?update:funasr=E5=AE=9E=E4=BE=8B=E4=B9=8B?= =?UTF-8?q?=E5=89=8D=E6=B7=BB=E5=8A=A0=E5=86=85=E5=AD=98=E6=A3=80=E6=B5=8B?= =?UTF-8?q?=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main/xiaozhi-server/core/providers/asr/fun_local.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/main/xiaozhi-server/core/providers/asr/fun_local.py b/main/xiaozhi-server/core/providers/asr/fun_local.py index 8c7305c6..4b25a265 100644 --- a/main/xiaozhi-server/core/providers/asr/fun_local.py +++ b/main/xiaozhi-server/core/providers/asr/fun_local.py @@ -2,6 +2,7 @@ import time import os import sys import io +import psutil from config.logger import setup_logging from typing import Optional, Tuple, List from core.providers.asr.base import ASRProviderBase @@ -37,6 +38,13 @@ class CaptureOutput: class ASRProvider(ASRProviderBase): def __init__(self, config: dict, delete_audio_file: bool): super().__init__() + + # 内存检测,要求大于2G + min_mem_bytes = 2 * 1024 * 1024 * 1024 + total_mem = psutil.virtual_memory().total + if total_mem < min_mem_bytes: + logger.bind(tag=TAG).error(f"可用内存不足2G,当前仅有 {total_mem / (1024*1024):.2f} MB") + self.interface_type = InterfaceType.LOCAL self.model_dir = config.get("model_dir") self.output_dir = config.get("output_dir") # 修正配置键名