lxylxy123321 6 дней назад
Родитель
Сommit
86d6ffde11
4 измененных файлов с 21 добавлено и 41 удалено
  1. 1 0
      backend/.dockerignore
  2. 1 0
      backend/.python-version
  3. 4 2
      backend/Dockerfile
  4. 15 39
      backend/pyproject.toml

+ 1 - 0
backend/.dockerignore

@@ -10,3 +10,4 @@ venv/
 .env
 data/
 *.db
+uv.lock

+ 1 - 0
backend/.python-version

@@ -0,0 +1 @@
+3.10

+ 4 - 2
backend/Dockerfile

@@ -10,8 +10,10 @@ RUN sed -i 's|deb.debian.org|mirrors.aliyun.com|g' /etc/apt/sources.list.d/debia
 
 RUN apt-get update && apt-get install -y git openssh-client sshpass rsync && rm -rf /var/lib/apt/lists/*
 
-COPY requirements.txt .
-RUN pip install --no-cache-dir -r requirements.txt
+# 安装 uv 并用其管理依赖
+RUN pip install --no-cache-dir uv
+COPY pyproject.toml .
+RUN uv pip install --system -r pyproject.toml
 
 COPY . .
 

+ 15 - 39
backend/pyproject.toml

@@ -1,11 +1,7 @@
-[build-system]
-requires = ["setuptools>=68.0"]
-build-backend = "setuptools.backends._legacy:_Backend"
-
 [project]
-name = "peft-finetune-platform"
+name = "peft-platform-backend"
 version = "0.1.0"
-description = "PEFT-based fine-tuning platform with frontend-backend separation"
+description = "PEFT Fine-Tuning Platform Backend"
 requires-python = ">=3.10"
 dependencies = [
     "fastapi>=0.115.0",
@@ -15,44 +11,24 @@ dependencies = [
     "python-dotenv>=1.0",
     "sqlalchemy[asyncio]>=2.0",
     "aiosqlite>=0.20.0",
+    "asyncpg>=0.29.0",
     "alembic>=1.13.0",
     "python-multipart>=0.0.9",
     "websockets>=12.0",
-    # ML stack
-    "torch>=2.4.0",
-    "transformers>=4.45.0",
-    "peft>=0.13.0",
-    "trl>=0.12.0",
-    "datasets>=3.0.0",
-    "accelerate>=1.0.0",
-    "bitsandbytes>=0.44.0",
     "scipy>=1.14.0",
     "scikit-learn>=1.5.0",
     "pillow>=10.4.0",
+    "pandas>=2.2.0",
+    "pyarrow>=17.0.0",
+    "addict>=2.4.0",
+    "modelscope>=1.15.0,<1.18.0",
+    "oss2>=2.18.0",
+    "datasets>=3.0.0",
+    "huggingface_hub",
+    "aiohttp>=3.9.0,<3.11.0",
+    "pyjwt>=2.8.0",
+    "httpx>=0.27.0",
 ]
 
-[project.optional-dependencies]
-unsloth = ["unsloth"]
-openclip = ["open-clip-torch"]
-dev = [
-    "pytest>=8.0",
-    "pytest-asyncio>=0.23",
-    "httpx>=0.27",
-    "ruff>=0.6.0",
-]
-
-[tool.setuptools.packages.find]
-where = ["backend"]
-include = ["app*"]
-
-[tool.ruff]
-target-version = "py310"
-line-length = 120
-
-[tool.ruff.lint]
-select = ["E", "F", "I", "N", "W"]
-ignore = ["E501"]
-
-[tool.pytest.ini_options]
-asyncio_mode = "auto"
-testpaths = ["backend/tests"]
+[tool.uv]
+index-url = "https://mirrors.aliyun.com/pypi/simple/"