Dataset Viewer

The dataset viewer is not available because its heuristics could not detect any supported data files. You can try uploading some data files, or configuring the data files location manually.

Chandra OCR 2 sur RTX 3090 - benchmark vLLM natif

Ce depot publie les resultats d'optimisation de datalab-to/chandra-ocr-2 sur une RTX 3090 24 Go RunPod, sans Docker ni sudo, avec le backend vLLM natif.

Evolution des performances

Resultat principal

configuration pages/s s/page gain vs HF qualite
HF origine 0.053 18.828 1.0x stable
vLLM natif simple page 0.306 3.266 5.8x stable
vLLM batch optimise 1.359 0.736 25.6x stable

Le meilleur resultat observe est 1.359 pages/s avec --batch-size 16 et --max-workers 16, sans degradation visible de la sortie OCR sur le PDF multi-pages propre teste.

Comment l'optimisation a ete faite

  1. Installation du package officiel chandra-ocr avec backend HF et vLLM.
  2. Validation du backend HF comme baseline qualite/vitesse.
  3. Inspection du code chandra-ocr pour comprendre la connexion vLLM:
    • VLLM_API_BASE=http://localhost:8000/v1
    • VLLM_MODEL_NAME=chandra
    • endpoint OpenAI-compatible /v1/chat/completions
    • image envoyee en image_url base64.
  4. Remplacement du lanceur officiel chandra_vllm, qui utilisait sudo docker, par un serveur natif: python -m vllm.entrypoints.openai.api_server.
  5. Profiling du pipeline:
    • rasterisation PDF
    • scaling image
    • encodage PNG/base64
    • inference vLLM
    • post-processing Markdown/HTML.
  6. Sweep vLLM progressif:
    • max-num-seqs
    • max-num-batched-tokens
    • gpu-memory-utilization
    • max-model-len.
  7. Benchmark batch multi-pages:
    • batch 1
    • batch 2
    • batch 4
    • batch 8
    • batch 16.
  8. Rejet des configurations qui changent trop la sortie OCR ou provoquent OOM.

Configuration vLLM stable

cd /workspace/chandra-runpod-ocr
source .venv/bin/activate
source scripts/env.sh
bash scripts/serve_vllm_native.sh

Parametres valides sur RTX 3090:

DTYPE=float16
MAX_MODEL_LEN=4096
GPU_MEMORY_UTILIZATION=0.82
MAX_NUM_SEQS=4
MAX_NUM_BATCHED_TOKENS=1024
VLLM_MODEL_NAME=chandra
MODEL_CHECKPOINT=datalab-to/chandra-ocr-2

Commande OCR gagnante observee:

chandra benchmarks/fixtures/simple_16p.pdf ./output/best_vllm_b16 \
  --batch-size 16 \
  --max-workers 16 \
  --max-output-tokens 2048 \
  --max-retries 0 \
  --no-images

Goulot identifie

Le profiling montre que l'inference vLLM represente environ 96% du temps mesure sur le PDF simple. La rasterisation PDF, l'encodage image et le post-processing sont marginaux sur ce cas.

Fichiers inclus

  • reports/performance_evolution.md
  • reports/performance_breakdown.md
  • reports/vllm_native_report.md
  • reports/final_optimization_report.md
  • reports/model_comparison.md
  • reports/quantization_search.md
  • results/vllm_sweep.jsonl
  • results/batch_results.jsonl
  • results/performance_breakdown.json
  • scripts/serve_vllm_native.sh
  • scripts/test_vllm_native.sh
  • scripts/profile_pipeline.py
  • scripts/sweep_vllm.py
  • scripts/benchmark_batches.py

Limites

Le meilleur debit publie ici a ete mesure sur un PDF propre multi-pages. Avant usage production, il faut repasser les benchmarks sur:

  • scans
  • tableaux
  • documents multi-colonnes
  • documents francais
  • images texte

La regle appliquee ici est stricte: aucune optimisation n'est acceptee si la qualite OCR se degrade visiblement.

Downloads last month
66