@qvac/ocr-ggml 0.22.0 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +6 -3
- package/prebuilds/android-arm64/qvac__ocr-ggml.bare +0 -0
- package/prebuilds/darwin-arm64/qvac__ocr-ggml.bare +0 -0
- package/prebuilds/darwin-arm64/qvac__ocr-ggml.bare.exports +0 -0
- package/prebuilds/darwin-x64/qvac__ocr-ggml.bare +0 -0
- package/prebuilds/darwin-x64/qvac__ocr-ggml.bare.exports +1 -1
- package/prebuilds/ios-arm64/qvac__ocr-ggml.bare +0 -0
- package/prebuilds/ios-arm64/qvac__ocr-ggml.bare.exports +1 -1
- package/prebuilds/ios-arm64-simulator/qvac__ocr-ggml.bare +0 -0
- package/prebuilds/ios-arm64-simulator/qvac__ocr-ggml.bare.exports +1 -1
- package/prebuilds/ios-x64-simulator/qvac__ocr-ggml.bare +0 -0
- package/prebuilds/ios-x64-simulator/qvac__ocr-ggml.bare.exports +1 -1
- package/prebuilds/linux-arm64/qvac__ocr-ggml.bare +0 -0
- package/prebuilds/linux-x64/qvac__ocr-ggml.bare +0 -0
- package/prebuilds/win32-x64/qvac__ocr-ggml.bare +0 -0
- package/test/integration/utils.js +38 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qvac/ocr-ggml",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"description": "GGML-backed OCR addon for qvac (EasyOCR and DocTR pipelines on GGUF weights)",
|
|
5
5
|
"addon": true,
|
|
6
6
|
"engines": {
|
|
@@ -88,11 +88,14 @@
|
|
|
88
88
|
"prettier": "^3.6.2",
|
|
89
89
|
"prettier-config-holepunch": "^2.0.0",
|
|
90
90
|
"typescript": "^5.9.2",
|
|
91
|
-
"typescript-eslint": "^8.63.0"
|
|
91
|
+
"typescript-eslint": "^8.63.0",
|
|
92
|
+
"cmake-npm": "^1.1.0",
|
|
93
|
+
"bare-os": "^3.6.2",
|
|
94
|
+
"bare-url": "^2.1.6"
|
|
92
95
|
},
|
|
93
96
|
"dependencies": {
|
|
94
97
|
"@qvac/error": "^0.1.0",
|
|
95
|
-
"@qvac/fabric": "^0.
|
|
98
|
+
"@qvac/fabric": "^0.14.0",
|
|
96
99
|
"@qvac/infer-base": "^0.6.2",
|
|
97
100
|
"@qvac/logging": "^0.1.0",
|
|
98
101
|
"bare-fetch": "^3.0.1",
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -690,23 +690,55 @@ function prestagedModelPath(modelName) {
|
|
|
690
690
|
return staged ? staged.src : null
|
|
691
691
|
}
|
|
692
692
|
|
|
693
|
+
// iOS kills an app that dirties more than 4 GiB in 24h, and there the staged
|
|
694
|
+
// file already sits in the app's own writable Documents dir — so copying it
|
|
695
|
+
// into the model dir spends that whole budget for nothing. Hardlink instead:
|
|
696
|
+
// same inode, zero bytes. On Android the staging dir is a different filesystem,
|
|
697
|
+
// so link() fails EXDEV and we fall back to the copy that has always run there.
|
|
698
|
+
// `link`/`copy` are injectable so that fallback is unit-testable.
|
|
699
|
+
function linkOrCopySync({ src, dest, link = fs.linkSync, copy = fs.copyFileSync }) {
|
|
700
|
+
// Same path in and out — the staged file IS the destination (a caller whose
|
|
701
|
+
// model dir is testDir itself). Deleting first would destroy the staged model
|
|
702
|
+
// and leave both link() and copy() failing ENOENT; the copy this replaced was
|
|
703
|
+
// a harmless no-op here.
|
|
704
|
+
if (path.resolve(src) === path.resolve(dest)) return 'link'
|
|
705
|
+
|
|
706
|
+
try {
|
|
707
|
+
fs.unlinkSync(dest)
|
|
708
|
+
} catch (_) {}
|
|
709
|
+
|
|
710
|
+
try {
|
|
711
|
+
link(src, dest)
|
|
712
|
+
return 'link'
|
|
713
|
+
} catch (err) {
|
|
714
|
+
console.log(
|
|
715
|
+
`[prestage] hardlink failed on ${platform} (${err.message}); falling back to a byte copy`
|
|
716
|
+
)
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
copy(src, dest)
|
|
720
|
+
return 'copy'
|
|
721
|
+
}
|
|
722
|
+
|
|
693
723
|
// The host pushes an exact byte-count sidecar with each model. Require both the
|
|
694
|
-
// staged source and
|
|
695
|
-
// fall through to the network download.
|
|
724
|
+
// staged source and the materialised destination to match it so truncated
|
|
725
|
+
// adb/app transfers fall through to the network download.
|
|
696
726
|
function copyPrestagedModel(modelName, destPath, minBytes = 1024 * 1024) {
|
|
697
727
|
const staged = readPrestagedModel(modelName)
|
|
698
728
|
if (!staged || staged.expectedSize < minBytes) return false
|
|
699
729
|
try {
|
|
700
730
|
const dir = path.dirname(destPath)
|
|
701
731
|
if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true })
|
|
702
|
-
|
|
732
|
+
const how = linkOrCopySync({ src: staged.src, dest: destPath })
|
|
703
733
|
if (fs.statSync(destPath).size === staged.expectedSize) {
|
|
704
|
-
console.log(
|
|
734
|
+
console.log(
|
|
735
|
+
`[prestage] Using pre-staged model ${modelName} (${how === 'link' ? 'hardlinked' : 'copied'})`
|
|
736
|
+
)
|
|
705
737
|
return true
|
|
706
738
|
}
|
|
707
739
|
fs.unlinkSync(destPath)
|
|
708
740
|
} catch (err) {
|
|
709
|
-
console.log(`[prestage]
|
|
741
|
+
console.log(`[prestage] staging of ${modelName} failed: ${err.message}`)
|
|
710
742
|
try {
|
|
711
743
|
fs.unlinkSync(destPath)
|
|
712
744
|
} catch (_) {}
|
|
@@ -1418,6 +1450,7 @@ module.exports = {
|
|
|
1418
1450
|
ensureModelPath,
|
|
1419
1451
|
ensureDoctrModels,
|
|
1420
1452
|
copyPrestagedModel,
|
|
1453
|
+
linkOrCopySync,
|
|
1421
1454
|
prestagedModelPath,
|
|
1422
1455
|
GGML_MODELS_DIR,
|
|
1423
1456
|
formatOCRPerformanceMetrics,
|