From 40427797c8d406ad7eaa881eb6fdd7828ad936a5 Mon Sep 17 00:00:00 2001
From: 雾聪 <wucong.lyb@alibaba-inc.com>
Date: 星期一, 01 七月 2024 20:49:53 +0800
Subject: [PATCH] update funasr-runtime-sdk-gpu-0.1.1
---
funasr/auto/auto_model.py | 20 +++++++++++++++-----
1 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/funasr/auto/auto_model.py b/funasr/auto/auto_model.py
index 57a15db..e027e07 100644
--- a/funasr/auto/auto_model.py
+++ b/funasr/auto/auto_model.py
@@ -20,7 +20,7 @@
from funasr.download.file import download_from_url
from funasr.utils.timestamp_tools import timestamp_sentence
from funasr.utils.timestamp_tools import timestamp_sentence_en
-from funasr.download.download_from_hub import download_model
+from funasr.download.download_model_from_hub import download_model
from funasr.utils.vad_utils import slice_padding_audio_samples
from funasr.utils.vad_utils import merge_vad
from funasr.utils.load_utils import load_audio_text_image_video
@@ -111,11 +111,15 @@
def __init__(self, **kwargs):
+ try:
+ from funasr.utils.version_checker import check_for_update
+
+ check_for_update()
+ except:
+ pass
+
log_level = getattr(logging, kwargs.get("log_level", "INFO").upper())
logging.basicConfig(level=log_level)
-
- if not kwargs.get("disable_log", True):
- tables.print()
model, kwargs = self.build_model(**kwargs)
@@ -164,7 +168,8 @@
self.spk_kwargs = spk_kwargs
self.model_path = kwargs.get("model_path")
- def build_model(self, **kwargs):
+ @staticmethod
+ def build_model(**kwargs):
assert "model" in kwargs
if "model_conf" not in kwargs:
logging.info("download models from model hub: {}".format(kwargs.get("hub", "ms")))
@@ -210,6 +215,7 @@
kwargs["frontend"] = frontend
# build model
model_class = tables.model_classes.get(kwargs["model"])
+ assert model_class is not None, f'{kwargs["model"]} is not registered'
model_conf = {}
deep_update(model_conf, kwargs.get("model_conf", {}))
deep_update(model_conf, kwargs)
@@ -237,6 +243,10 @@
elif kwargs.get("bf16", False):
model.to(torch.bfloat16)
model.to(device)
+
+ if not kwargs.get("disable_log", True):
+ tables.print()
+
return model, kwargs
def __call__(self, *args, **cfg):
--
Gitblit v1.9.1