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,29 @@
|
||||
import scripts.quant.run_all as ra
|
||||
from scripts.quant.aggregate import SUMMARY_FIELDS
|
||||
|
||||
|
||||
def test_run_method_failure_becomes_failed_row(monkeypatch):
|
||||
def boom(*a, **k):
|
||||
raise RuntimeError("OOM at load")
|
||||
|
||||
monkeypatch.setattr(ra, "_measure_method", boom)
|
||||
row = ra.run_method("gptq", base_model="b", work_dir=ra.Path("/tmp/x"),
|
||||
eval_images=[], reference_dir=ra.Path("/tmp/ref"))
|
||||
assert row["method"] == "gptq"
|
||||
assert row["status"] == "failed"
|
||||
assert "OOM at load" in row["error"]
|
||||
assert set(row.keys()) == set(SUMMARY_FIELDS)
|
||||
|
||||
|
||||
def test_run_method_success_passes_through_metrics(monkeypatch):
|
||||
def fake_measure(method, base_model, work_dir, eval_images, reference_dir):
|
||||
return {"mean_cer": 0.01, "mean_bbox_iou": 0.98, "mean_latency_s": 4.2,
|
||||
"model_size_mb": 512.0}
|
||||
|
||||
monkeypatch.setattr(ra, "_measure_method", fake_measure)
|
||||
row = ra.run_method("awq", base_model="b", work_dir=ra.Path("/tmp/x"),
|
||||
eval_images=[], reference_dir=ra.Path("/tmp/ref"))
|
||||
assert row["status"] == "ok"
|
||||
assert row["mean_cer"] == 0.01
|
||||
assert row["t4_deployable"] is True
|
||||
assert row["mean_latency_s"] == 4.2
|
||||
Reference in New Issue
Block a user