From 6fdd4d13bcf3c5ff5bafa5a8581f1ed4ea26819f Mon Sep 17 00:00:00 2001 From: liqiang-fit2cloud Date: Wed, 20 Mar 2024 12:44:49 +0800 Subject: [PATCH 1/3] =?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" From 8fd50f091b4ab84665492a93de729a33ffe9a562 Mon Sep 17 00:00:00 2001 From: liqiang-fit2cloud Date: Wed, 20 Mar 2024 12:46:33 +0800 Subject: [PATCH 2/3] =?UTF-8?q?build:=20=E5=8F=AA=E6=94=AF=E6=8C=81linux/a?= =?UTF-8?q?md64?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-and-push-python-pg.yml | 4 ++-- .github/workflows/build-and-push-vector-model.yml | 4 ++-- .github/workflows/build-and-push.yml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-and-push-python-pg.yml b/.github/workflows/build-and-push-python-pg.yml index d82ca86bd..8ff9d692a 100644 --- a/.github/workflows/build-and-push-python-pg.yml +++ b/.github/workflows/build-and-push-python-pg.yml @@ -10,8 +10,8 @@ on: type: choice options: - linux/amd64 - - linux/arm64 - - linux/amd64,linux/arm64 + #- linux/arm64 + #- linux/amd64,linux/arm64 jobs: build-and-push-python-pg-to-ghcr: runs-on: ubuntu-latest diff --git a/.github/workflows/build-and-push-vector-model.yml b/.github/workflows/build-and-push-vector-model.yml index 1e8556461..b81eea6e0 100644 --- a/.github/workflows/build-and-push-vector-model.yml +++ b/.github/workflows/build-and-push-vector-model.yml @@ -14,8 +14,8 @@ on: type: choice options: - linux/amd64 - - linux/arm64 - - linux/amd64,linux/arm64 + #- linux/arm64 + #- linux/amd64,linux/arm64 jobs: build-and-push-vector-model-to-ghcr: diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml index b1102252e..6f0b6047e 100644 --- a/.github/workflows/build-and-push.yml +++ b/.github/workflows/build-and-push.yml @@ -14,8 +14,8 @@ on: type: choice options: - linux/amd64 - - linux/arm64 - - linux/amd64,linux/arm64 + #- linux/arm64 + #- linux/amd64,linux/arm64 registry: description: 'Push To Registry' required: true From 107d85b7b21fc680f0b6fddb78c3bbac762019b3 Mon Sep 17 00:00:00 2001 From: liqiang-fit2cloud Date: Wed, 20 Mar 2024 12:57:16 +0800 Subject: [PATCH 3/3] =?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 --- pyproject.toml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 7541cfe9d..9c3a03af2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,10 +19,7 @@ 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'"} -] +torch = { url = "https://download.pytorch.org/whl/cpu/torch-2.2.1%2Bcpu-cp311-cp311-linux_x86_64.whl", markers = "sys_platform == 'linux'"} sentence-transformers = "^2.2.2" blinker = "^1.6.3" openai = "^1.13.3"