You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ocr: guard output-column collisions across the OCR recipes (+ --overwrite) (#66)
* ocr: guard output-column collisions across the OCR recipes (+ --overwrite)
Generalises the pp-ocrv6 fix from #65 to the remaining output-writing recipes. Each script
that adds an output column could previously build a *duplicate* column when that name already
existed in the input dataset -- crashing on push after inference, or silently clobbering a
ground-truth column (e.g. 'text' / 'markdown').
- Add a shared ensure_output_columns_free() startup guard (copied per-script; no shared lib in
this repo) that fails fast if an output column already exists in the input, with a new
--overwrite flag to opt into replacing it. Sink scripts (pp-doclayout) carry the equivalent
guard inline; surya (in #65) guards both of its columns.
- The 5 recipes that hardcoded the "markdown" output column (nanonets-ocr, abot-ocr,
deepseek-ocr, deepseek-ocr-vllm) also gained a configurable --output-column.
- Bonus, found via a context-length audit: nanonets-ocr.py had --max-tokens 15000 >
--max-model-len 8192 (the output budget alone couldn't fit the window); raised the
--max-model-len default to 32768 (model max is 128k).
- deepseek-ocr.py: tidied a pre-existing bare `except:` -> `except Exception:` so ruff passes.
Static-verified: ruff + AST + call-site wiring on all 25 files. The guard pattern itself is
Jobs-proven via pp-ocrv6 in #65. A light Jobs smoke on one hardcoded convert + one uniform
script before merge is cheap insurance for the arg wiring.
Note: nanonets-ocr2.py is intentionally NOT included -- it carries separate in-progress
vLLM-image edits; its collision guard will land with that work.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* ocr: guard nuextract3 reasoning column too (review nit #1)
--enable-thinking also writes {output_column}_reasoning; include it in the
collision guard (conditional on enable_thinking) so a pre-existing _reasoning
column fails fast instead of crashing on push after inference.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0 commit comments