From 1f83da9eb7ee27bb9404605e20e75f5ef0d687ab Mon Sep 17 00:00:00 2001 From: iomgaa Date: Thu, 9 Jul 2026 22:14:57 -0400 Subject: [PATCH] =?UTF-8?q?fix:=20embedding=20=E6=94=B9=20cuda=20+=20OCR?= =?UTF-8?q?=20=E8=B6=85=E6=97=B6=20300s=20+=20=E9=87=8D=E8=AF=95=E9=80=80?= =?UTF-8?q?=E9=81=BF=2020s=20=E8=B5=B7=20+=20jitter=20=E9=98=B2=E9=9B=B7?= =?UTF-8?q?=E7=BE=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - config/default.yaml: embed.device cpu → cuda - adapters/ocr.py: _TIMEOUT_S 15 → 300(5 分钟) - adapters/llm.py: 指数退避加 ±50% jitter 避免 24 路同时重试 - .env: LLM_RETRY_BASE_DELAY 2→20s, LLM_RETRY_MAX_DELAY 30→120s Co-Authored-By: Claude Opus 4.6 (1M context) --- adapters/llm.py | 9 ++++++--- adapters/ocr.py | 2 +- config/default.yaml | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/adapters/llm.py b/adapters/llm.py index 3e9223a..a8f646d 100644 --- a/adapters/llm.py +++ b/adapters/llm.py @@ -449,12 +449,15 @@ class GovernedLLMClient: }, ) if attempt < self._max_retries - 1: - delay = min( + import random + + base = min( self._retry_base_delay_s * (2**attempt), self._retry_max_delay_s, ) - if delay > 0: - await asyncio.sleep(delay) + jitter = base * random.uniform(0.5, 1.5) + if jitter > 0: + await asyncio.sleep(jitter) continue # 非瞬时、非致命 → 记遥测后直接抛出 diff --git a/adapters/ocr.py b/adapters/ocr.py index 0a2fbc3..c5dc1b0 100644 --- a/adapters/ocr.py +++ b/adapters/ocr.py @@ -14,7 +14,7 @@ from pathlib import Path # noqa: TC003 — 运行时需要(方法签名 + ope import requests from loguru import logger -_TIMEOUT_S = 15 +_TIMEOUT_S = 300 class MonkeyOCRClient: diff --git a/config/default.yaml b/config/default.yaml index 298d07e..ff4449a 100644 --- a/config/default.yaml +++ b/config/default.yaml @@ -20,7 +20,7 @@ embed: backend: "local" model_name: "BAAI/bge-base-zh-v1.5" embed_dim: 768 - device: "cpu" + device: "cuda" # ── Harness 自进化循环 ── harness: