Repository navigation
Conversation
- Load Vision.framework with objc.loadBundle and let Vision decode the PNG. This skips PyObjC's Vision and Quartz packages, which took about 2.5 s to load the first time on a new install, against 0.9 s. On 70 images (8,141 lines) the output is identical to the wrapper version. The native-ocr extra on macOS now needs only pyobjc-core and pyobjc-framework-Cocoa. - Start prewarm at the top of main() for demo and tutorial, before the parser imports. - Run Playwright's node --version on a prewarm thread, so macOS checks the new driver binary (about 1.2 s) while Python imports the demo. Signed-off-by: Richard Abrich <richard.abrich@mldsai.com>
…s thin Apple Vision read a recorded patient band as only "01/15/1980 M Active", dropping the MRN and the name. Every OCR budget passed on the DOB, sex and status columns, so a different patient with the same DOB verified. The OCR identity tier now classifies each recorded band token as an identifier, a discriminative name or a date. For a record band (one that holds an identifier or a date, or from which OCR dropped an identifying field), the band verifies only if an identifier or a name matched, and a second kind of identifying field matched as well when a matched field has a look-alike character (l/1/I, O/0, S/5, Z/2, B/8, G/9, rn/m, cl/d, vv/w) or a recorded identifying field went unmatched. Otherwise the tier abstains. An identifier counts as evidence only on a byte-identical match. The check runs after the existing mismatch and glyph checks and can only turn verified into abstain. It is engine-independent and applies to the salted-hash template path too, where every token counts as look-alike. One existing test flips: a band whose trailing numeric identifier OCR dropped used to verify on its name tokens alone and now abstains. Signed-off-by: Richard Abrich <richard.abrich@mldsai.com>
Signed-off-by: Richard Abrich <richard.abrich@mldsai.com>
The prewarm passed a hand-written 1x1 PNG constant that doesn't decode, so the native engine raised, the error was swallowed, and Apple Vision ran its first request (about 0.3 s) during recording instead. Build a 64x16 white PNG with zlib at runtime and test that it decodes. Signed-off-by: Richard Abrich <richard.abrich@mldsai.com>
Member
Author
|
Carried over to the monorepo in OpenAdaptAI/OpenAdapt#1199 (merged as ea09df2b). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #531. Review only: Flow is frozen for the monorepo move, so don't merge.
This branch tries to get the cold first run (
openadapt-flow demoin a new environment with empty uv and Playwright caches) under 30 s on the Mac without weakening any check. It gets close but doesn't reliably get there; see "Where the time goes".Changes
objc.loadBundleand NSData instead of the PyObjC Vision and Quartz wrappers. Thenative-ocrextra on macOS now needs onlypyobjc-coreandpyobjc-framework-Cocoa. A fresh first load took 0.9 s, compared with 2.5 s forimport Vision, Quartz. The program-predicate contract records the new image input (png-data). The prewarm also starts before the CLI builds its parser and runs Playwright's Node driver once (node --version) so macOS checks it off the critical path.Timings (Mac, idle,
bench2.sh, 3 runs each, load average at the end of each run)Session 4:23-4:40 PM EDT, Oct 17. Cold totals include install.
Cold runs split into install and demo:
The demo is about 1 s faster than #531 at idle. The earlier, larger gain came from runs under load and mostly disappears on an idle machine. For reference, the earlier idle session (3:14-3:30 PM) measured 93.4-113.2 s cold for 2.0.0 and 43.5-63.0 s for #528.
Where the time goes
Timeline of one cold demo at idle (load 3.5), 22.2 s:
timeout_s, which defaults to 5 s. In run 2 the record never appears, so the check waits out the full window before the run halts. That wait is the evidence for the halt, so this branch doesn't shorten it. The 2 s in the tutorial is the HTTP request timeout, not the check window. Run 2 has no fixed sleeps to replace: the replayer's settle waits on page signals, and the rest is Playwright round trips and the postcondition template match..pycwrites in a new environment. Starting the prewarm earlier moves some of that work around rather than removing it: with the prewarm on, the main thread waits on the GIL while the prewarm thread imports the same package, and a whole run is only about 0.6 s faster than with the prewarm off.autostill uses RapidOCR.Options not taken
autoto use native, which feat(ocr): native OCR on macOS and Windows, with no OpenCV on that path #531 keeps opt-in because of false aborts.--compile-bytecodeat install: about 0.5 s net.Checks run locally
tests/test_ocr_backends.py, and the OCR and identity test files under both engines (see feat(ocr): native OCR on macOS and Windows, with no OpenCV on that path #531)