Suya OCR API — vLLM-backed, OpenAI-compatible OCR service
FastAPI service wrapping the Surya-OCR-2 model (datalab-to) served through vLLM: legacy /v1/api/ai/* endpoints, an OpenAI-compatible /v1/chat/completions endpoint, a coalescing request batcher, a local OCR CLI, Docker packaging, multilingual example outputs, and quantization/concurrency benchmarks. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
from scripts.quant.aggregate import build_row
|
||||
from scripts.quant.plot import pareto_points, render_all
|
||||
|
||||
|
||||
def test_pareto_points_skips_failed_and_missing():
|
||||
rows = [
|
||||
build_row(method="bf16", status="ok", mean_latency_s=6.0, mean_cer=0.0, t4_deployable=True),
|
||||
build_row(method="awq", status="ok", mean_latency_s=4.0, mean_cer=0.01, t4_deployable=True),
|
||||
build_row(method="gptq", status="failed", t4_deployable=True),
|
||||
build_row(method="fp8", status="ok", mean_latency_s=3.0, mean_cer=0.02, t4_deployable=False),
|
||||
]
|
||||
points = pareto_points(rows, x_key="mean_latency_s", y_key="mean_cer")
|
||||
methods = {p["method"] for p in points}
|
||||
assert methods == {"bf16", "awq", "fp8"} # gptq failed -> skipped
|
||||
awq = next(p for p in points if p["method"] == "awq")
|
||||
assert awq["x"] == 4.0 and awq["y"] == 0.01 and awq["t4_deployable"] is True
|
||||
|
||||
|
||||
def test_render_all_writes_png_files(tmp_path):
|
||||
rows = [
|
||||
build_row(method="bf16", status="ok", mean_latency_s=6.0, mean_cer=0.0,
|
||||
mean_bbox_iou=1.0, t4_deployable=True),
|
||||
build_row(method="awq", status="ok", mean_latency_s=4.0, mean_cer=0.01,
|
||||
mean_bbox_iou=0.98, t4_deployable=True),
|
||||
]
|
||||
written = render_all(rows, tmp_path)
|
||||
assert all(p.exists() for p in written)
|
||||
assert any(p.name == "pareto_latency_cer.png" for p in written)
|
||||
Reference in New Issue
Block a user