From c4ac64fd5d24bb3fc8ccc441d36a07c83c8b9015 Mon Sep 17 00:00:00 2001
From: Yu Cao <monstercy@hotmail.com>
Date: 星期三, 01 十月 2025 14:46:21 +0800
Subject: [PATCH] fix "can not find model issue when running libtorch runtime" (#2504)
---
funasr/download/download_model_from_hub.py | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/funasr/download/download_model_from_hub.py b/funasr/download/download_model_from_hub.py
index 77593a5..80aa588 100644
--- a/funasr/download/download_model_from_hub.py
+++ b/funasr/download/download_model_from_hub.py
@@ -1,3 +1,4 @@
+import logging
import os
import json
from omegaconf import OmegaConf, DictConfig
@@ -43,7 +44,7 @@
print(f"Download: {model_or_path} failed!: {e}")
kwargs["model_path"] = model_or_path if "model_path" not in kwargs else kwargs["model_path"]
-
+ model_or_path = kwargs["model_path"]
if os.path.exists(os.path.join(model_or_path, "configuration.json")):
with open(os.path.join(model_or_path, "configuration.json"), "r", encoding="utf-8") as f:
conf_json = json.load(f)
@@ -79,7 +80,10 @@
kwargs["jieba_usr_dict"] = os.path.join(model_or_path, "jieba_usr_dict")
if isinstance(kwargs, DictConfig):
kwargs = OmegaConf.to_container(kwargs, resolve=True)
- if os.path.exists(os.path.join(model_or_path, "requirements.txt")):
+ logging.warning(f'trust_remote_code: {kwargs.get("trust_remote_code", False)}')
+ if os.path.exists(os.path.join(model_or_path, "requirements.txt")) and kwargs.get(
+ "trust_remote_code", False
+ ):
requirements = os.path.join(model_or_path, "requirements.txt")
print(f"Detect model requirements, begin to install it: {requirements}")
from funasr.utils.install_model_requirements import install_requirements
--
Gitblit v1.9.1