From 369f2ff8838569351c26d909407b497ab16d3bcf Mon Sep 17 00:00:00 2001
From: zhaomingwork <61895407+zhaomingwork@users.noreply.github.com>
Date: 星期二, 20 六月 2023 11:08:50 +0800
Subject: [PATCH] add html5 local access asr service directly (#654)

---
 funasr/build_utils/build_model_from_file.py |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/funasr/build_utils/build_model_from_file.py b/funasr/build_utils/build_model_from_file.py
index 85cf8b9..8fd4e46 100644
--- a/funasr/build_utils/build_model_from_file.py
+++ b/funasr/build_utils/build_model_from_file.py
@@ -74,7 +74,10 @@
             model_dict = torch.load(model_file, map_location=device)
     if task_name == "diar" and mode == "sond":
         model_dict = fileter_model_dict(model_dict, model.state_dict())
-    model.load_state_dict(model_dict)
+    if task_name == "vad":
+        model.encoder.load_state_dict(model_dict)
+    else:
+        model.load_state_dict(model_dict)
     if model_name_pth is not None and not os.path.exists(model_name_pth):
         torch.save(model_dict, model_name_pth)
         logging.info("model_file is saved to pth: {}".format(model_name_pth))

--
Gitblit v1.9.1