From 6fdd4d13bcf3c5ff5bafa5a8581f1ed4ea26819f Mon Sep 17 00:00:00 2001 From: liqiang-fit2cloud Date: Wed, 20 Mar 2024 12:44:49 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E5=B0=9D=E8=AF=95=E5=8E=BB?= =?UTF-8?q?=E6=8E=89nvidia=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/smartdoc/conf.py | 3 +-- pyproject.toml | 4 ++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/smartdoc/conf.py b/apps/smartdoc/conf.py index aa90d2134..855b507a1 100644 --- a/apps/smartdoc/conf.py +++ b/apps/smartdoc/conf.py @@ -13,7 +13,6 @@ import os import re from importlib import import_module from urllib.parse import urljoin, urlparse -import torch.backends import yaml BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) @@ -91,7 +90,7 @@ class Config(dict): "EMAIL_HOST_PASSWORD": "", # 向量模型 "EMBEDDING_MODEL_NAME": "shibing624/text2vec-base-chinese", - "EMBEDDING_DEVICE": "cuda" if torch.cuda.is_available() else "mps" if torch.backends.mps.is_available() else "cpu", + "EMBEDDING_DEVICE": "cpu", "EMBEDDING_MODEL_PATH": os.path.join(PROJECT_DIR, 'models'), # 向量库配置 "VECTOR_STORE_NAME": 'pg_vector' diff --git a/pyproject.toml b/pyproject.toml index cd9fea832..7541cfe9d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,6 +19,10 @@ diskcache = "^5.6.3" pillow = "^10.2.0" filetype = "^1.2.0" chardet = "^5.2.0" +torch = [ + { url = "https://download.pytorch.org/whl/cpu/torch-2.2.1%2Bcpu-cp311-cp311-linux_x86_64.whl", markers = "sys_platform == 'linux'"}, + { url = "https://download.pytorch.org/whl/cpu/torch-2.2.1-cp311-none-macosx_11_0_arm64.whl", markers = "sys_platform == 'darwin' and platform_machine == 'arm64'"} +] sentence-transformers = "^2.2.2" blinker = "^1.6.3" openai = "^1.13.3"