mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
support snapshot download from local (#153)
* support snapshot download from local * let snapshot download from local
This commit is contained in:
@ -17,6 +17,7 @@ from copy import deepcopy
|
||||
import onnxruntime as ort
|
||||
from huggingface_hub import snapshot_download
|
||||
|
||||
from api.utils.file_utils import get_project_base_directory
|
||||
from .operators import *
|
||||
from rag.settings import cron_logger
|
||||
|
||||
@ -35,7 +36,15 @@ class Recognizer(object):
|
||||
|
||||
"""
|
||||
if not model_dir:
|
||||
model_dir = snapshot_download(repo_id="InfiniFlow/deepdoc")
|
||||
try:
|
||||
model_dir = snapshot_download(
|
||||
repo_id="InfiniFlow/deepdoc",
|
||||
local_dir=os.path.join(
|
||||
get_project_base_directory(),
|
||||
"rag/res/deepdoc"),
|
||||
local_files_only=True)
|
||||
except Exception as e:
|
||||
model_dir = snapshot_download(repo_id="InfiniFlow/deepdoc")
|
||||
|
||||
model_file_path = os.path.join(model_dir, task_name + ".onnx")
|
||||
if not os.path.exists(model_file_path):
|
||||
|
||||
Reference in New Issue
Block a user