feat: add build turboocr
This commit is contained in:
@@ -52,7 +52,9 @@ Copy `.env.example` to `.env` and override only the variables you need to change
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
The first start builds TensorRT engines from ONNX. Build time depends on your GPU: roughly 5 minutes on high-end desktop GPUs and 20–30 minutes on laptop GPUs. The container may report `unhealthy` while compilation is in progress — this is normal. Once the build finishes the server starts and the container transitions to `healthy`. Subsequent restarts reuse the cached engines and start in seconds.
|
||||
The first start builds 4 TensorRT engines from ONNX. Measured build times on an RTX 3070 Laptop: det (~5 min) + rec (~30 min) + cls (~4 min) + layout (~28 min) = **~67–90 minutes total**. High-end desktop GPUs finish in ~15 minutes. The container reports `unhealthy` while compilation is in progress — this is expected. Once all engines are built the server starts and the container transitions to `healthy`. Subsequent restarts reuse the cached engines and start in seconds.
|
||||
|
||||
> **Tip — faster first boot:** Set `TURBOOCR_DISABLE_LAYOUT=1` to skip the layout detection engine (~28 min on laptop GPUs). Only do this if you don't need the `?layout=1` PDF endpoint.
|
||||
|
||||
### Endpoints
|
||||
|
||||
|
||||
@@ -52,7 +52,9 @@
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
首次启动需要从 ONNX 构建 TensorRT 引擎,耗时因 GPU 而异:高端桌面 GPU 约 5 分钟,笔记本 GPU 约 20–30 分钟。编译期间容器可能显示 `unhealthy`,这属于正常现象——构建完成后服务会自动启动并切换为 `healthy`。后续重启会复用缓存的引擎,几乎瞬间完成。
|
||||
首次启动需要编译 4 个 TensorRT 引擎。在 RTX 3070 Laptop 上的实测耗时:det(约 5 分钟)+ rec(约 30 分钟)+ cls(约 4 分钟)+ layout(约 28 分钟)= **总计约 67–90 分钟**。高端桌面 GPU 约 15 分钟完成。编译期间容器显示 `unhealthy` 属于正常现象——所有引擎构建完成后服务会自动启动并切换为 `healthy`。后续重启会复用缓存的引擎,几乎瞬间完成。
|
||||
|
||||
> **提示——加快首次启动**:设置 `TURBOOCR_DISABLE_LAYOUT=1` 可跳过版面检测引擎的编译(笔记本 GPU 约节省 28 分钟)。仅在不需要 `?layout=1` PDF 端点时使用此选项。
|
||||
|
||||
### 访问端点
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ services:
|
||||
- '${TURBOOCR_HTTP_PORT_OVERRIDE:-8000}:8000'
|
||||
- '${TURBOOCR_GRPC_PORT_OVERRIDE:-50051}:50051'
|
||||
volumes:
|
||||
# Named volume caches TensorRT engines built from ONNX on first start (~90s).
|
||||
# Named volume caches TensorRT engines built from ONNX on first start.
|
||||
# Must be a named volume - bind-mounting an empty host dir would shadow the
|
||||
# baked-in language bundles and prevent the server from loading models.
|
||||
- turboocr_trt_cache:/home/ocr/.cache/turbo-ocr
|
||||
@@ -48,11 +48,13 @@ services:
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 5
|
||||
# First start builds TensorRT engines from ONNX. Build time varies by GPU:
|
||||
# ~5 min on high-end desktop GPUs, 20-30 min on laptop GPUs. The container
|
||||
# may show "unhealthy" during compilation but will become healthy once done.
|
||||
# Subsequent restarts reuse the cached engines and start in seconds.
|
||||
start_period: 30m
|
||||
# First start builds 4 TensorRT engines from ONNX. Measured build times:
|
||||
# det (~5 min) + rec (~30 min) + cls (~4 min) + layout (~28 min) ≈ 67-90 min
|
||||
# on an RTX 3070 Laptop. High-end desktop GPUs finish in ~15 min.
|
||||
# Set TURBOOCR_DISABLE_LAYOUT=1 to skip the layout engine and cut ~28 min.
|
||||
# The container shows "unhealthy" while building but recovers once done.
|
||||
# Subsequent restarts reuse cached engines and start in seconds.
|
||||
start_period: 120m
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
|
||||
Reference in New Issue
Block a user