Commit ·
24aaa76
0
Parent(s):
Release 1
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +35 -0
- LICENSE +202 -0
- LICENSE.AGPL-3.0 +661 -0
- NOTICE +60 -0
- README +224 -0
- README.md +251 -0
- config_r5eval/arms_info_template.json +6 -0
- config_r5eval/endpoints_proposal.json +26 -0
- config_r5eval/mix_scratch.yaml +8 -0
- config_r5eval/r5_descriptive_labels.txt +17 -0
- config_r5eval/sota_attestations_template.json +8 -0
- config_r5eval/zero_shot_results.tsv +28 -0
- environments/venv.requirements +45 -0
- environments/venv_dl.requirements +40 -0
- environments/venv_gen.requirements +31 -0
- environments/venv_kraken.requirements +110 -0
- environments/venv_print.requirements +32 -0
- environments/venv_ref_paddle.requirements +57 -0
- environments/venv_ref_paddle_cpu.requirements +43 -0
- environments/venv_ref_tf.requirements +58 -0
- environments/venv_vlm.requirements +64 -0
- environments/venv_vlm_deepseek_ocr_2.requirements +46 -0
- environments/venv_vlm_dots_mocr.requirements +64 -0
- environments/venv_vlm_falcon_ocr.requirements +69 -0
- environments/venv_vlm_jina_ocr_v1.requirements +46 -0
- environments/venv_vlm_nemotron_3_5_parse.requirements +64 -0
- environments/venv_vlm_oxr_1_0.requirements +64 -0
- environments/venv_vlm_teleocr.requirements +45 -0
- environments/venv_vlm_unlimited_ocr_2.requirements +52 -0
- environments/venv_vlm_youtu_parsing.requirements +46 -0
- release/page-pipeline/infer.py +190 -0
- release/page-pipeline/requirements.txt +70 -0
- release/turkic-line-detector-yolo11s/infer.py +91 -0
- release/turkic-line-detector-yolo11s/requirements.txt +115 -0
- release/turkic-ocr-paddleocr-vl-1.6/infer.py +260 -0
- release/turkic-ocr-paddleocr-vl-1.6/requirements.txt +68 -0
- release/turkic-ocr-ppocrv6-medium/infer.py +363 -0
- release/turkic-ocr-ppocrv6-medium/requirements.txt +115 -0
- release/turkic-ocr-qwen3-vl-2b/infer.py +260 -0
- release/turkic-ocr-qwen3-vl-2b/requirements.txt +68 -0
- scripts/b1_page_check/b1_page_check.py +120 -0
- scripts/b1_page_check/b1_page_check.sbatch +24 -0
- scripts/b1_page_check/b1_page_score.py +82 -0
- scripts/b1_page_check/b1_page_score.sbatch +13 -0
- scripts/b1_page_check/base_page_check.sbatch +25 -0
- scripts/b1_page_check/detb1_page_check.py +99 -0
- scripts/b1_page_check/detb1_page_check.sbatch +24 -0
- scripts/j2/build_screen_set.py +38 -0
- scripts/j2/check_images_kwargs.py +26 -0
- scripts/j2/codec_238.json +244 -0
.gitattributes
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
Apache License
|
| 3 |
+
Version 2.0, January 2004
|
| 4 |
+
http://www.apache.org/licenses/
|
| 5 |
+
|
| 6 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 7 |
+
|
| 8 |
+
1. Definitions.
|
| 9 |
+
|
| 10 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
| 11 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
| 12 |
+
|
| 13 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
| 14 |
+
the copyright owner that is granting the License.
|
| 15 |
+
|
| 16 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
| 17 |
+
other entities that control, are controlled by, or are under common
|
| 18 |
+
control with that entity. For the purposes of this definition,
|
| 19 |
+
"control" means (i) the power, direct or indirect, to cause the
|
| 20 |
+
direction or management of such entity, whether by contract or
|
| 21 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
| 22 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
| 23 |
+
|
| 24 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
| 25 |
+
exercising permissions granted by this License.
|
| 26 |
+
|
| 27 |
+
"Source" form shall mean the preferred form for making modifications,
|
| 28 |
+
including but not limited to software source code, documentation
|
| 29 |
+
source, and configuration files.
|
| 30 |
+
|
| 31 |
+
"Object" form shall mean any form resulting from mechanical
|
| 32 |
+
transformation or translation of a Source form, including but
|
| 33 |
+
not limited to compiled object code, generated documentation,
|
| 34 |
+
and conversions to other media types.
|
| 35 |
+
|
| 36 |
+
"Work" shall mean the work of authorship, whether in Source or
|
| 37 |
+
Object form, made available under the License, as indicated by a
|
| 38 |
+
copyright notice that is included in or attached to the work
|
| 39 |
+
(an example is provided in the Appendix below).
|
| 40 |
+
|
| 41 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
| 42 |
+
form, that is based on (or derived from) the Work and for which the
|
| 43 |
+
editorial revisions, annotations, elaborations, or other modifications
|
| 44 |
+
represent, as a whole, an original work of authorship. For the purposes
|
| 45 |
+
of this License, Derivative Works shall not include works that remain
|
| 46 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
| 47 |
+
the Work and Derivative Works thereof.
|
| 48 |
+
|
| 49 |
+
"Contribution" shall mean any work of authorship, including
|
| 50 |
+
the original version of the Work and any modifications or additions
|
| 51 |
+
to that Work or Derivative Works thereof, that is intentionally
|
| 52 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
| 53 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
| 54 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
| 55 |
+
means any form of electronic, verbal, or written communication sent
|
| 56 |
+
to the Licensor or its representatives, including but not limited to
|
| 57 |
+
communication on electronic mailing lists, source code control systems,
|
| 58 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
| 59 |
+
Licensor for the purpose of discussing and improving the Work, but
|
| 60 |
+
excluding communication that is conspicuously marked or otherwise
|
| 61 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
| 62 |
+
|
| 63 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
| 64 |
+
on behalf of whom a Contribution has been received by Licensor and
|
| 65 |
+
subsequently incorporated within the Work.
|
| 66 |
+
|
| 67 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
| 68 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 69 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 70 |
+
copyright license to reproduce, prepare Derivative Works of,
|
| 71 |
+
publicly display, publicly perform, sublicense, and distribute the
|
| 72 |
+
Work and such Derivative Works in Source or Object form.
|
| 73 |
+
|
| 74 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
| 75 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 76 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 77 |
+
(except as stated in this section) patent license to make, have made,
|
| 78 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
| 79 |
+
where such license applies only to those patent claims licensable
|
| 80 |
+
by such Contributor that are necessarily infringed by their
|
| 81 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
| 82 |
+
with the Work to which such Contribution(s) was submitted. If You
|
| 83 |
+
institute patent litigation against any entity (including a
|
| 84 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
| 85 |
+
or a Contribution incorporated within the Work constitutes direct
|
| 86 |
+
or contributory patent infringement, then any patent licenses
|
| 87 |
+
granted to You under this License for that Work shall terminate
|
| 88 |
+
as of the date such litigation is filed.
|
| 89 |
+
|
| 90 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
| 91 |
+
Work or Derivative Works thereof in any medium, with or without
|
| 92 |
+
modifications, and in Source or Object form, provided that You
|
| 93 |
+
meet the following conditions:
|
| 94 |
+
|
| 95 |
+
(a) You must give any other recipients of the Work or
|
| 96 |
+
Derivative Works a copy of this License; and
|
| 97 |
+
|
| 98 |
+
(b) You must cause any modified files to carry prominent notices
|
| 99 |
+
stating that You changed the files; and
|
| 100 |
+
|
| 101 |
+
(c) You must retain, in the Source form of any Derivative Works
|
| 102 |
+
that You distribute, all copyright, patent, trademark, and
|
| 103 |
+
attribution notices from the Source form of the Work,
|
| 104 |
+
excluding those notices that do not pertain to any part of
|
| 105 |
+
the Derivative Works; and
|
| 106 |
+
|
| 107 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
| 108 |
+
distribution, then any Derivative Works that You distribute must
|
| 109 |
+
include a readable copy of the attribution notices contained
|
| 110 |
+
within such NOTICE file, excluding those notices that do not
|
| 111 |
+
pertain to any part of the Derivative Works, in at least one
|
| 112 |
+
of the following places: within a NOTICE text file distributed
|
| 113 |
+
as part of the Derivative Works; within the Source form or
|
| 114 |
+
documentation, if provided along with the Derivative Works; or,
|
| 115 |
+
within a display generated by the Derivative Works, if and
|
| 116 |
+
wherever such third-party notices normally appear. The contents
|
| 117 |
+
of the NOTICE file are for informational purposes only and
|
| 118 |
+
do not modify the License. You may add Your own attribution
|
| 119 |
+
notices within Derivative Works that You distribute, alongside
|
| 120 |
+
or as an addendum to the NOTICE text from the Work, provided
|
| 121 |
+
that such additional attribution notices cannot be construed
|
| 122 |
+
as modifying the License.
|
| 123 |
+
|
| 124 |
+
You may add Your own copyright statement to Your modifications and
|
| 125 |
+
may provide additional or different license terms and conditions
|
| 126 |
+
for use, reproduction, or distribution of Your modifications, or
|
| 127 |
+
for any such Derivative Works as a whole, provided Your use,
|
| 128 |
+
reproduction, and distribution of the Work otherwise complies with
|
| 129 |
+
the conditions stated in this License.
|
| 130 |
+
|
| 131 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
| 132 |
+
any Contribution intentionally submitted for inclusion in the Work
|
| 133 |
+
by You to the Licensor shall be under the terms and conditions of
|
| 134 |
+
this License, without any additional terms or conditions.
|
| 135 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
| 136 |
+
the terms of any separate license agreement you may have executed
|
| 137 |
+
with Licensor regarding such Contributions.
|
| 138 |
+
|
| 139 |
+
6. Trademarks. This License does not grant permission to use the trade
|
| 140 |
+
names, trademarks, service marks, or product names of the Licensor,
|
| 141 |
+
except as required for reasonable and customary use in describing the
|
| 142 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
| 143 |
+
|
| 144 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
| 145 |
+
agreed to in writing, Licensor provides the Work (and each
|
| 146 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
| 147 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
| 148 |
+
implied, including, without limitation, any warranties or conditions
|
| 149 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
| 150 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
| 151 |
+
appropriateness of using or redistributing the Work and assume any
|
| 152 |
+
risks associated with Your exercise of permissions under this License.
|
| 153 |
+
|
| 154 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
| 155 |
+
whether in tort (including negligence), contract, or otherwise,
|
| 156 |
+
unless required by applicable law (such as deliberate and grossly
|
| 157 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
| 158 |
+
liable to You for damages, including any direct, indirect, special,
|
| 159 |
+
incidental, or consequential damages of any character arising as a
|
| 160 |
+
result of this License or out of the use or inability to use the
|
| 161 |
+
Work (including but not limited to damages for loss of goodwill,
|
| 162 |
+
work stoppage, computer failure or malfunction, or any and all
|
| 163 |
+
other commercial damages or losses), even if such Contributor
|
| 164 |
+
has been advised of the possibility of such damages.
|
| 165 |
+
|
| 166 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
| 167 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
| 168 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
| 169 |
+
or other liability obligations and/or rights consistent with this
|
| 170 |
+
License. However, in accepting such obligations, You may act only
|
| 171 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
| 172 |
+
of any other Contributor, and only if You agree to indemnify,
|
| 173 |
+
defend, and hold each Contributor harmless for any liability
|
| 174 |
+
incurred by, or claims asserted against, such Contributor by reason
|
| 175 |
+
of your accepting any such warranty or additional liability.
|
| 176 |
+
|
| 177 |
+
END OF TERMS AND CONDITIONS
|
| 178 |
+
|
| 179 |
+
APPENDIX: How to apply the Apache License to your work.
|
| 180 |
+
|
| 181 |
+
To apply the Apache License to your work, attach the following
|
| 182 |
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
| 183 |
+
replaced with your own identifying information. (Don't include
|
| 184 |
+
the brackets!) The text should be enclosed in the appropriate
|
| 185 |
+
comment syntax for the file format. We also recommend that a
|
| 186 |
+
file or class name and description of purpose be included on the
|
| 187 |
+
same "printed page" as the copyright notice for easier
|
| 188 |
+
identification within third-party archives.
|
| 189 |
+
|
| 190 |
+
Copyright [yyyy] [name of copyright owner]
|
| 191 |
+
|
| 192 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 193 |
+
you may not use this file except in compliance with the License.
|
| 194 |
+
You may obtain a copy of the License at
|
| 195 |
+
|
| 196 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 197 |
+
|
| 198 |
+
Unless required by applicable law or agreed to in writing, software
|
| 199 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 200 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 201 |
+
See the License for the specific language governing permissions and
|
| 202 |
+
limitations under the License.
|
LICENSE.AGPL-3.0
ADDED
|
@@ -0,0 +1,661 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
GNU AFFERO GENERAL PUBLIC LICENSE
|
| 2 |
+
Version 3, 19 November 2007
|
| 3 |
+
|
| 4 |
+
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
| 5 |
+
Everyone is permitted to copy and distribute verbatim copies
|
| 6 |
+
of this license document, but changing it is not allowed.
|
| 7 |
+
|
| 8 |
+
Preamble
|
| 9 |
+
|
| 10 |
+
The GNU Affero General Public License is a free, copyleft license for
|
| 11 |
+
software and other kinds of works, specifically designed to ensure
|
| 12 |
+
cooperation with the community in the case of network server software.
|
| 13 |
+
|
| 14 |
+
The licenses for most software and other practical works are designed
|
| 15 |
+
to take away your freedom to share and change the works. By contrast,
|
| 16 |
+
our General Public Licenses are intended to guarantee your freedom to
|
| 17 |
+
share and change all versions of a program--to make sure it remains free
|
| 18 |
+
software for all its users.
|
| 19 |
+
|
| 20 |
+
When we speak of free software, we are referring to freedom, not
|
| 21 |
+
price. Our General Public Licenses are designed to make sure that you
|
| 22 |
+
have the freedom to distribute copies of free software (and charge for
|
| 23 |
+
them if you wish), that you receive source code or can get it if you
|
| 24 |
+
want it, that you can change the software or use pieces of it in new
|
| 25 |
+
free programs, and that you know you can do these things.
|
| 26 |
+
|
| 27 |
+
Developers that use our General Public Licenses protect your rights
|
| 28 |
+
with two steps: (1) assert copyright on the software, and (2) offer
|
| 29 |
+
you this License which gives you legal permission to copy, distribute
|
| 30 |
+
and/or modify the software.
|
| 31 |
+
|
| 32 |
+
A secondary benefit of defending all users' freedom is that
|
| 33 |
+
improvements made in alternate versions of the program, if they
|
| 34 |
+
receive widespread use, become available for other developers to
|
| 35 |
+
incorporate. Many developers of free software are heartened and
|
| 36 |
+
encouraged by the resulting cooperation. However, in the case of
|
| 37 |
+
software used on network servers, this result may fail to come about.
|
| 38 |
+
The GNU General Public License permits making a modified version and
|
| 39 |
+
letting the public access it on a server without ever releasing its
|
| 40 |
+
source code to the public.
|
| 41 |
+
|
| 42 |
+
The GNU Affero General Public License is designed specifically to
|
| 43 |
+
ensure that, in such cases, the modified source code becomes available
|
| 44 |
+
to the community. It requires the operator of a network server to
|
| 45 |
+
provide the source code of the modified version running there to the
|
| 46 |
+
users of that server. Therefore, public use of a modified version, on
|
| 47 |
+
a publicly accessible server, gives the public access to the source
|
| 48 |
+
code of the modified version.
|
| 49 |
+
|
| 50 |
+
An older license, called the Affero General Public License and
|
| 51 |
+
published by Affero, was designed to accomplish similar goals. This is
|
| 52 |
+
a different license, not a version of the Affero GPL, but Affero has
|
| 53 |
+
released a new version of the Affero GPL which permits relicensing under
|
| 54 |
+
this license.
|
| 55 |
+
|
| 56 |
+
The precise terms and conditions for copying, distribution and
|
| 57 |
+
modification follow.
|
| 58 |
+
|
| 59 |
+
TERMS AND CONDITIONS
|
| 60 |
+
|
| 61 |
+
0. Definitions.
|
| 62 |
+
|
| 63 |
+
"This License" refers to version 3 of the GNU Affero General Public License.
|
| 64 |
+
|
| 65 |
+
"Copyright" also means copyright-like laws that apply to other kinds of
|
| 66 |
+
works, such as semiconductor masks.
|
| 67 |
+
|
| 68 |
+
"The Program" refers to any copyrightable work licensed under this
|
| 69 |
+
License. Each licensee is addressed as "you". "Licensees" and
|
| 70 |
+
"recipients" may be individuals or organizations.
|
| 71 |
+
|
| 72 |
+
To "modify" a work means to copy from or adapt all or part of the work
|
| 73 |
+
in a fashion requiring copyright permission, other than the making of an
|
| 74 |
+
exact copy. The resulting work is called a "modified version" of the
|
| 75 |
+
earlier work or a work "based on" the earlier work.
|
| 76 |
+
|
| 77 |
+
A "covered work" means either the unmodified Program or a work based
|
| 78 |
+
on the Program.
|
| 79 |
+
|
| 80 |
+
To "propagate" a work means to do anything with it that, without
|
| 81 |
+
permission, would make you directly or secondarily liable for
|
| 82 |
+
infringement under applicable copyright law, except executing it on a
|
| 83 |
+
computer or modifying a private copy. Propagation includes copying,
|
| 84 |
+
distribution (with or without modification), making available to the
|
| 85 |
+
public, and in some countries other activities as well.
|
| 86 |
+
|
| 87 |
+
To "convey" a work means any kind of propagation that enables other
|
| 88 |
+
parties to make or receive copies. Mere interaction with a user through
|
| 89 |
+
a computer network, with no transfer of a copy, is not conveying.
|
| 90 |
+
|
| 91 |
+
An interactive user interface displays "Appropriate Legal Notices"
|
| 92 |
+
to the extent that it includes a convenient and prominently visible
|
| 93 |
+
feature that (1) displays an appropriate copyright notice, and (2)
|
| 94 |
+
tells the user that there is no warranty for the work (except to the
|
| 95 |
+
extent that warranties are provided), that licensees may convey the
|
| 96 |
+
work under this License, and how to view a copy of this License. If
|
| 97 |
+
the interface presents a list of user commands or options, such as a
|
| 98 |
+
menu, a prominent item in the list meets this criterion.
|
| 99 |
+
|
| 100 |
+
1. Source Code.
|
| 101 |
+
|
| 102 |
+
The "source code" for a work means the preferred form of the work
|
| 103 |
+
for making modifications to it. "Object code" means any non-source
|
| 104 |
+
form of a work.
|
| 105 |
+
|
| 106 |
+
A "Standard Interface" means an interface that either is an official
|
| 107 |
+
standard defined by a recognized standards body, or, in the case of
|
| 108 |
+
interfaces specified for a particular programming language, one that
|
| 109 |
+
is widely used among developers working in that language.
|
| 110 |
+
|
| 111 |
+
The "System Libraries" of an executable work include anything, other
|
| 112 |
+
than the work as a whole, that (a) is included in the normal form of
|
| 113 |
+
packaging a Major Component, but which is not part of that Major
|
| 114 |
+
Component, and (b) serves only to enable use of the work with that
|
| 115 |
+
Major Component, or to implement a Standard Interface for which an
|
| 116 |
+
implementation is available to the public in source code form. A
|
| 117 |
+
"Major Component", in this context, means a major essential component
|
| 118 |
+
(kernel, window system, and so on) of the specific operating system
|
| 119 |
+
(if any) on which the executable work runs, or a compiler used to
|
| 120 |
+
produce the work, or an object code interpreter used to run it.
|
| 121 |
+
|
| 122 |
+
The "Corresponding Source" for a work in object code form means all
|
| 123 |
+
the source code needed to generate, install, and (for an executable
|
| 124 |
+
work) run the object code and to modify the work, including scripts to
|
| 125 |
+
control those activities. However, it does not include the work's
|
| 126 |
+
System Libraries, or general-purpose tools or generally available free
|
| 127 |
+
programs which are used unmodified in performing those activities but
|
| 128 |
+
which are not part of the work. For example, Corresponding Source
|
| 129 |
+
includes interface definition files associated with source files for
|
| 130 |
+
the work, and the source code for shared libraries and dynamically
|
| 131 |
+
linked subprograms that the work is specifically designed to require,
|
| 132 |
+
such as by intimate data communication or control flow between those
|
| 133 |
+
subprograms and other parts of the work.
|
| 134 |
+
|
| 135 |
+
The Corresponding Source need not include anything that users
|
| 136 |
+
can regenerate automatically from other parts of the Corresponding
|
| 137 |
+
Source.
|
| 138 |
+
|
| 139 |
+
The Corresponding Source for a work in source code form is that
|
| 140 |
+
same work.
|
| 141 |
+
|
| 142 |
+
2. Basic Permissions.
|
| 143 |
+
|
| 144 |
+
All rights granted under this License are granted for the term of
|
| 145 |
+
copyright on the Program, and are irrevocable provided the stated
|
| 146 |
+
conditions are met. This License explicitly affirms your unlimited
|
| 147 |
+
permission to run the unmodified Program. The output from running a
|
| 148 |
+
covered work is covered by this License only if the output, given its
|
| 149 |
+
content, constitutes a covered work. This License acknowledges your
|
| 150 |
+
rights of fair use or other equivalent, as provided by copyright law.
|
| 151 |
+
|
| 152 |
+
You may make, run and propagate covered works that you do not
|
| 153 |
+
convey, without conditions so long as your license otherwise remains
|
| 154 |
+
in force. You may convey covered works to others for the sole purpose
|
| 155 |
+
of having them make modifications exclusively for you, or provide you
|
| 156 |
+
with facilities for running those works, provided that you comply with
|
| 157 |
+
the terms of this License in conveying all material for which you do
|
| 158 |
+
not control copyright. Those thus making or running the covered works
|
| 159 |
+
for you must do so exclusively on your behalf, under your direction
|
| 160 |
+
and control, on terms that prohibit them from making any copies of
|
| 161 |
+
your copyrighted material outside their relationship with you.
|
| 162 |
+
|
| 163 |
+
Conveying under any other circumstances is permitted solely under
|
| 164 |
+
the conditions stated below. Sublicensing is not allowed; section 10
|
| 165 |
+
makes it unnecessary.
|
| 166 |
+
|
| 167 |
+
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
| 168 |
+
|
| 169 |
+
No covered work shall be deemed part of an effective technological
|
| 170 |
+
measure under any applicable law fulfilling obligations under article
|
| 171 |
+
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
| 172 |
+
similar laws prohibiting or restricting circumvention of such
|
| 173 |
+
measures.
|
| 174 |
+
|
| 175 |
+
When you convey a covered work, you waive any legal power to forbid
|
| 176 |
+
circumvention of technological measures to the extent such circumvention
|
| 177 |
+
is effected by exercising rights under this License with respect to
|
| 178 |
+
the covered work, and you disclaim any intention to limit operation or
|
| 179 |
+
modification of the work as a means of enforcing, against the work's
|
| 180 |
+
users, your or third parties' legal rights to forbid circumvention of
|
| 181 |
+
technological measures.
|
| 182 |
+
|
| 183 |
+
4. Conveying Verbatim Copies.
|
| 184 |
+
|
| 185 |
+
You may convey verbatim copies of the Program's source code as you
|
| 186 |
+
receive it, in any medium, provided that you conspicuously and
|
| 187 |
+
appropriately publish on each copy an appropriate copyright notice;
|
| 188 |
+
keep intact all notices stating that this License and any
|
| 189 |
+
non-permissive terms added in accord with section 7 apply to the code;
|
| 190 |
+
keep intact all notices of the absence of any warranty; and give all
|
| 191 |
+
recipients a copy of this License along with the Program.
|
| 192 |
+
|
| 193 |
+
You may charge any price or no price for each copy that you convey,
|
| 194 |
+
and you may offer support or warranty protection for a fee.
|
| 195 |
+
|
| 196 |
+
5. Conveying Modified Source Versions.
|
| 197 |
+
|
| 198 |
+
You may convey a work based on the Program, or the modifications to
|
| 199 |
+
produce it from the Program, in the form of source code under the
|
| 200 |
+
terms of section 4, provided that you also meet all of these conditions:
|
| 201 |
+
|
| 202 |
+
a) The work must carry prominent notices stating that you modified
|
| 203 |
+
it, and giving a relevant date.
|
| 204 |
+
|
| 205 |
+
b) The work must carry prominent notices stating that it is
|
| 206 |
+
released under this License and any conditions added under section
|
| 207 |
+
7. This requirement modifies the requirement in section 4 to
|
| 208 |
+
"keep intact all notices".
|
| 209 |
+
|
| 210 |
+
c) You must license the entire work, as a whole, under this
|
| 211 |
+
License to anyone who comes into possession of a copy. This
|
| 212 |
+
License will therefore apply, along with any applicable section 7
|
| 213 |
+
additional terms, to the whole of the work, and all its parts,
|
| 214 |
+
regardless of how they are packaged. This License gives no
|
| 215 |
+
permission to license the work in any other way, but it does not
|
| 216 |
+
invalidate such permission if you have separately received it.
|
| 217 |
+
|
| 218 |
+
d) If the work has interactive user interfaces, each must display
|
| 219 |
+
Appropriate Legal Notices; however, if the Program has interactive
|
| 220 |
+
interfaces that do not display Appropriate Legal Notices, your
|
| 221 |
+
work need not make them do so.
|
| 222 |
+
|
| 223 |
+
A compilation of a covered work with other separate and independent
|
| 224 |
+
works, which are not by their nature extensions of the covered work,
|
| 225 |
+
and which are not combined with it such as to form a larger program,
|
| 226 |
+
in or on a volume of a storage or distribution medium, is called an
|
| 227 |
+
"aggregate" if the compilation and its resulting copyright are not
|
| 228 |
+
used to limit the access or legal rights of the compilation's users
|
| 229 |
+
beyond what the individual works permit. Inclusion of a covered work
|
| 230 |
+
in an aggregate does not cause this License to apply to the other
|
| 231 |
+
parts of the aggregate.
|
| 232 |
+
|
| 233 |
+
6. Conveying Non-Source Forms.
|
| 234 |
+
|
| 235 |
+
You may convey a covered work in object code form under the terms
|
| 236 |
+
of sections 4 and 5, provided that you also convey the
|
| 237 |
+
machine-readable Corresponding Source under the terms of this License,
|
| 238 |
+
in one of these ways:
|
| 239 |
+
|
| 240 |
+
a) Convey the object code in, or embodied in, a physical product
|
| 241 |
+
(including a physical distribution medium), accompanied by the
|
| 242 |
+
Corresponding Source fixed on a durable physical medium
|
| 243 |
+
customarily used for software interchange.
|
| 244 |
+
|
| 245 |
+
b) Convey the object code in, or embodied in, a physical product
|
| 246 |
+
(including a physical distribution medium), accompanied by a
|
| 247 |
+
written offer, valid for at least three years and valid for as
|
| 248 |
+
long as you offer spare parts or customer support for that product
|
| 249 |
+
model, to give anyone who possesses the object code either (1) a
|
| 250 |
+
copy of the Corresponding Source for all the software in the
|
| 251 |
+
product that is covered by this License, on a durable physical
|
| 252 |
+
medium customarily used for software interchange, for a price no
|
| 253 |
+
more than your reasonable cost of physically performing this
|
| 254 |
+
conveying of source, or (2) access to copy the
|
| 255 |
+
Corresponding Source from a network server at no charge.
|
| 256 |
+
|
| 257 |
+
c) Convey individual copies of the object code with a copy of the
|
| 258 |
+
written offer to provide the Corresponding Source. This
|
| 259 |
+
alternative is allowed only occasionally and noncommercially, and
|
| 260 |
+
only if you received the object code with such an offer, in accord
|
| 261 |
+
with subsection 6b.
|
| 262 |
+
|
| 263 |
+
d) Convey the object code by offering access from a designated
|
| 264 |
+
place (gratis or for a charge), and offer equivalent access to the
|
| 265 |
+
Corresponding Source in the same way through the same place at no
|
| 266 |
+
further charge. You need not require recipients to copy the
|
| 267 |
+
Corresponding Source along with the object code. If the place to
|
| 268 |
+
copy the object code is a network server, the Corresponding Source
|
| 269 |
+
may be on a different server (operated by you or a third party)
|
| 270 |
+
that supports equivalent copying facilities, provided you maintain
|
| 271 |
+
clear directions next to the object code saying where to find the
|
| 272 |
+
Corresponding Source. Regardless of what server hosts the
|
| 273 |
+
Corresponding Source, you remain obligated to ensure that it is
|
| 274 |
+
available for as long as needed to satisfy these requirements.
|
| 275 |
+
|
| 276 |
+
e) Convey the object code using peer-to-peer transmission, provided
|
| 277 |
+
you inform other peers where the object code and Corresponding
|
| 278 |
+
Source of the work are being offered to the general public at no
|
| 279 |
+
charge under subsection 6d.
|
| 280 |
+
|
| 281 |
+
A separable portion of the object code, whose source code is excluded
|
| 282 |
+
from the Corresponding Source as a System Library, need not be
|
| 283 |
+
included in conveying the object code work.
|
| 284 |
+
|
| 285 |
+
A "User Product" is either (1) a "consumer product", which means any
|
| 286 |
+
tangible personal property which is normally used for personal, family,
|
| 287 |
+
or household purposes, or (2) anything designed or sold for incorporation
|
| 288 |
+
into a dwelling. In determining whether a product is a consumer product,
|
| 289 |
+
doubtful cases shall be resolved in favor of coverage. For a particular
|
| 290 |
+
product received by a particular user, "normally used" refers to a
|
| 291 |
+
typical or common use of that class of product, regardless of the status
|
| 292 |
+
of the particular user or of the way in which the particular user
|
| 293 |
+
actually uses, or expects or is expected to use, the product. A product
|
| 294 |
+
is a consumer product regardless of whether the product has substantial
|
| 295 |
+
commercial, industrial or non-consumer uses, unless such uses represent
|
| 296 |
+
the only significant mode of use of the product.
|
| 297 |
+
|
| 298 |
+
"Installation Information" for a User Product means any methods,
|
| 299 |
+
procedures, authorization keys, or other information required to install
|
| 300 |
+
and execute modified versions of a covered work in that User Product from
|
| 301 |
+
a modified version of its Corresponding Source. The information must
|
| 302 |
+
suffice to ensure that the continued functioning of the modified object
|
| 303 |
+
code is in no case prevented or interfered with solely because
|
| 304 |
+
modification has been made.
|
| 305 |
+
|
| 306 |
+
If you convey an object code work under this section in, or with, or
|
| 307 |
+
specifically for use in, a User Product, and the conveying occurs as
|
| 308 |
+
part of a transaction in which the right of possession and use of the
|
| 309 |
+
User Product is transferred to the recipient in perpetuity or for a
|
| 310 |
+
fixed term (regardless of how the transaction is characterized), the
|
| 311 |
+
Corresponding Source conveyed under this section must be accompanied
|
| 312 |
+
by the Installation Information. But this requirement does not apply
|
| 313 |
+
if neither you nor any third party retains the ability to install
|
| 314 |
+
modified object code on the User Product (for example, the work has
|
| 315 |
+
been installed in ROM).
|
| 316 |
+
|
| 317 |
+
The requirement to provide Installation Information does not include a
|
| 318 |
+
requirement to continue to provide support service, warranty, or updates
|
| 319 |
+
for a work that has been modified or installed by the recipient, or for
|
| 320 |
+
the User Product in which it has been modified or installed. Access to a
|
| 321 |
+
network may be denied when the modification itself materially and
|
| 322 |
+
adversely affects the operation of the network or violates the rules and
|
| 323 |
+
protocols for communication across the network.
|
| 324 |
+
|
| 325 |
+
Corresponding Source conveyed, and Installation Information provided,
|
| 326 |
+
in accord with this section must be in a format that is publicly
|
| 327 |
+
documented (and with an implementation available to the public in
|
| 328 |
+
source code form), and must require no special password or key for
|
| 329 |
+
unpacking, reading or copying.
|
| 330 |
+
|
| 331 |
+
7. Additional Terms.
|
| 332 |
+
|
| 333 |
+
"Additional permissions" are terms that supplement the terms of this
|
| 334 |
+
License by making exceptions from one or more of its conditions.
|
| 335 |
+
Additional permissions that are applicable to the entire Program shall
|
| 336 |
+
be treated as though they were included in this License, to the extent
|
| 337 |
+
that they are valid under applicable law. If additional permissions
|
| 338 |
+
apply only to part of the Program, that part may be used separately
|
| 339 |
+
under those permissions, but the entire Program remains governed by
|
| 340 |
+
this License without regard to the additional permissions.
|
| 341 |
+
|
| 342 |
+
When you convey a copy of a covered work, you may at your option
|
| 343 |
+
remove any additional permissions from that copy, or from any part of
|
| 344 |
+
it. (Additional permissions may be written to require their own
|
| 345 |
+
removal in certain cases when you modify the work.) You may place
|
| 346 |
+
additional permissions on material, added by you to a covered work,
|
| 347 |
+
for which you have or can give appropriate copyright permission.
|
| 348 |
+
|
| 349 |
+
Notwithstanding any other provision of this License, for material you
|
| 350 |
+
add to a covered work, you may (if authorized by the copyright holders of
|
| 351 |
+
that material) supplement the terms of this License with terms:
|
| 352 |
+
|
| 353 |
+
a) Disclaiming warranty or limiting liability differently from the
|
| 354 |
+
terms of sections 15 and 16 of this License; or
|
| 355 |
+
|
| 356 |
+
b) Requiring preservation of specified reasonable legal notices or
|
| 357 |
+
author attributions in that material or in the Appropriate Legal
|
| 358 |
+
Notices displayed by works containing it; or
|
| 359 |
+
|
| 360 |
+
c) Prohibiting misrepresentation of the origin of that material, or
|
| 361 |
+
requiring that modified versions of such material be marked in
|
| 362 |
+
reasonable ways as different from the original version; or
|
| 363 |
+
|
| 364 |
+
d) Limiting the use for publicity purposes of names of licensors or
|
| 365 |
+
authors of the material; or
|
| 366 |
+
|
| 367 |
+
e) Declining to grant rights under trademark law for use of some
|
| 368 |
+
trade names, trademarks, or service marks; or
|
| 369 |
+
|
| 370 |
+
f) Requiring indemnification of licensors and authors of that
|
| 371 |
+
material by anyone who conveys the material (or modified versions of
|
| 372 |
+
it) with contractual assumptions of liability to the recipient, for
|
| 373 |
+
any liability that these contractual assumptions directly impose on
|
| 374 |
+
those licensors and authors.
|
| 375 |
+
|
| 376 |
+
All other non-permissive additional terms are considered "further
|
| 377 |
+
restrictions" within the meaning of section 10. If the Program as you
|
| 378 |
+
received it, or any part of it, contains a notice stating that it is
|
| 379 |
+
governed by this License along with a term that is a further
|
| 380 |
+
restriction, you may remove that term. If a license document contains
|
| 381 |
+
a further restriction but permits relicensing or conveying under this
|
| 382 |
+
License, you may add to a covered work material governed by the terms
|
| 383 |
+
of that license document, provided that the further restriction does
|
| 384 |
+
not survive such relicensing or conveying.
|
| 385 |
+
|
| 386 |
+
If you add terms to a covered work in accord with this section, you
|
| 387 |
+
must place, in the relevant source files, a statement of the
|
| 388 |
+
additional terms that apply to those files, or a notice indicating
|
| 389 |
+
where to find the applicable terms.
|
| 390 |
+
|
| 391 |
+
Additional terms, permissive or non-permissive, may be stated in the
|
| 392 |
+
form of a separately written license, or stated as exceptions;
|
| 393 |
+
the above requirements apply either way.
|
| 394 |
+
|
| 395 |
+
8. Termination.
|
| 396 |
+
|
| 397 |
+
You may not propagate or modify a covered work except as expressly
|
| 398 |
+
provided under this License. Any attempt otherwise to propagate or
|
| 399 |
+
modify it is void, and will automatically terminate your rights under
|
| 400 |
+
this License (including any patent licenses granted under the third
|
| 401 |
+
paragraph of section 11).
|
| 402 |
+
|
| 403 |
+
However, if you cease all violation of this License, then your
|
| 404 |
+
license from a particular copyright holder is reinstated (a)
|
| 405 |
+
provisionally, unless and until the copyright holder explicitly and
|
| 406 |
+
finally terminates your license, and (b) permanently, if the copyright
|
| 407 |
+
holder fails to notify you of the violation by some reasonable means
|
| 408 |
+
prior to 60 days after the cessation.
|
| 409 |
+
|
| 410 |
+
Moreover, your license from a particular copyright holder is
|
| 411 |
+
reinstated permanently if the copyright holder notifies you of the
|
| 412 |
+
violation by some reasonable means, this is the first time you have
|
| 413 |
+
received notice of violation of this License (for any work) from that
|
| 414 |
+
copyright holder, and you cure the violation prior to 30 days after
|
| 415 |
+
your receipt of the notice.
|
| 416 |
+
|
| 417 |
+
Termination of your rights under this section does not terminate the
|
| 418 |
+
licenses of parties who have received copies or rights from you under
|
| 419 |
+
this License. If your rights have been terminated and not permanently
|
| 420 |
+
reinstated, you do not qualify to receive new licenses for the same
|
| 421 |
+
material under section 10.
|
| 422 |
+
|
| 423 |
+
9. Acceptance Not Required for Having Copies.
|
| 424 |
+
|
| 425 |
+
You are not required to accept this License in order to receive or
|
| 426 |
+
run a copy of the Program. Ancillary propagation of a covered work
|
| 427 |
+
occurring solely as a consequence of using peer-to-peer transmission
|
| 428 |
+
to receive a copy likewise does not require acceptance. However,
|
| 429 |
+
nothing other than this License grants you permission to propagate or
|
| 430 |
+
modify any covered work. These actions infringe copyright if you do
|
| 431 |
+
not accept this License. Therefore, by modifying or propagating a
|
| 432 |
+
covered work, you indicate your acceptance of this License to do so.
|
| 433 |
+
|
| 434 |
+
10. Automatic Licensing of Downstream Recipients.
|
| 435 |
+
|
| 436 |
+
Each time you convey a covered work, the recipient automatically
|
| 437 |
+
receives a license from the original licensors, to run, modify and
|
| 438 |
+
propagate that work, subject to this License. You are not responsible
|
| 439 |
+
for enforcing compliance by third parties with this License.
|
| 440 |
+
|
| 441 |
+
An "entity transaction" is a transaction transferring control of an
|
| 442 |
+
organization, or substantially all assets of one, or subdividing an
|
| 443 |
+
organization, or merging organizations. If propagation of a covered
|
| 444 |
+
work results from an entity transaction, each party to that
|
| 445 |
+
transaction who receives a copy of the work also receives whatever
|
| 446 |
+
licenses to the work the party's predecessor in interest had or could
|
| 447 |
+
give under the previous paragraph, plus a right to possession of the
|
| 448 |
+
Corresponding Source of the work from the predecessor in interest, if
|
| 449 |
+
the predecessor has it or can get it with reasonable efforts.
|
| 450 |
+
|
| 451 |
+
You may not impose any further restrictions on the exercise of the
|
| 452 |
+
rights granted or affirmed under this License. For example, you may
|
| 453 |
+
not impose a license fee, royalty, or other charge for exercise of
|
| 454 |
+
rights granted under this License, and you may not initiate litigation
|
| 455 |
+
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
| 456 |
+
any patent claim is infringed by making, using, selling, offering for
|
| 457 |
+
sale, or importing the Program or any portion of it.
|
| 458 |
+
|
| 459 |
+
11. Patents.
|
| 460 |
+
|
| 461 |
+
A "contributor" is a copyright holder who authorizes use under this
|
| 462 |
+
License of the Program or a work on which the Program is based. The
|
| 463 |
+
work thus licensed is called the contributor's "contributor version".
|
| 464 |
+
|
| 465 |
+
A contributor's "essential patent claims" are all patent claims
|
| 466 |
+
owned or controlled by the contributor, whether already acquired or
|
| 467 |
+
hereafter acquired, that would be infringed by some manner, permitted
|
| 468 |
+
by this License, of making, using, or selling its contributor version,
|
| 469 |
+
but do not include claims that would be infringed only as a
|
| 470 |
+
consequence of further modification of the contributor version. For
|
| 471 |
+
purposes of this definition, "control" includes the right to grant
|
| 472 |
+
patent sublicenses in a manner consistent with the requirements of
|
| 473 |
+
this License.
|
| 474 |
+
|
| 475 |
+
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
| 476 |
+
patent license under the contributor's essential patent claims, to
|
| 477 |
+
make, use, sell, offer for sale, import and otherwise run, modify and
|
| 478 |
+
propagate the contents of its contributor version.
|
| 479 |
+
|
| 480 |
+
In the following three paragraphs, a "patent license" is any express
|
| 481 |
+
agreement or commitment, however denominated, not to enforce a patent
|
| 482 |
+
(such as an express permission to practice a patent or covenant not to
|
| 483 |
+
sue for patent infringement). To "grant" such a patent license to a
|
| 484 |
+
party means to make such an agreement or commitment not to enforce a
|
| 485 |
+
patent against the party.
|
| 486 |
+
|
| 487 |
+
If you convey a covered work, knowingly relying on a patent license,
|
| 488 |
+
and the Corresponding Source of the work is not available for anyone
|
| 489 |
+
to copy, free of charge and under the terms of this License, through a
|
| 490 |
+
publicly available network server or other readily accessible means,
|
| 491 |
+
then you must either (1) cause the Corresponding Source to be so
|
| 492 |
+
available, or (2) arrange to deprive yourself of the benefit of the
|
| 493 |
+
patent license for this particular work, or (3) arrange, in a manner
|
| 494 |
+
consistent with the requirements of this License, to extend the patent
|
| 495 |
+
license to downstream recipients. "Knowingly relying" means you have
|
| 496 |
+
actual knowledge that, but for the patent license, your conveying the
|
| 497 |
+
covered work in a country, or your recipient's use of the covered work
|
| 498 |
+
in a country, would infringe one or more identifiable patents in that
|
| 499 |
+
country that you have reason to believe are valid.
|
| 500 |
+
|
| 501 |
+
If, pursuant to or in connection with a single transaction or
|
| 502 |
+
arrangement, you convey, or propagate by procuring conveyance of, a
|
| 503 |
+
covered work, and grant a patent license to some of the parties
|
| 504 |
+
receiving the covered work authorizing them to use, propagate, modify
|
| 505 |
+
or convey a specific copy of the covered work, then the patent license
|
| 506 |
+
you grant is automatically extended to all recipients of the covered
|
| 507 |
+
work and works based on it.
|
| 508 |
+
|
| 509 |
+
A patent license is "discriminatory" if it does not include within
|
| 510 |
+
the scope of its coverage, prohibits the exercise of, or is
|
| 511 |
+
conditioned on the non-exercise of one or more of the rights that are
|
| 512 |
+
specifically granted under this License. You may not convey a covered
|
| 513 |
+
work if you are a party to an arrangement with a third party that is
|
| 514 |
+
in the business of distributing software, under which you make payment
|
| 515 |
+
to the third party based on the extent of your activity of conveying
|
| 516 |
+
the work, and under which the third party grants, to any of the
|
| 517 |
+
parties who would receive the covered work from you, a discriminatory
|
| 518 |
+
patent license (a) in connection with copies of the covered work
|
| 519 |
+
conveyed by you (or copies made from those copies), or (b) primarily
|
| 520 |
+
for and in connection with specific products or compilations that
|
| 521 |
+
contain the covered work, unless you entered into that arrangement,
|
| 522 |
+
or that patent license was granted, prior to 28 March 2007.
|
| 523 |
+
|
| 524 |
+
Nothing in this License shall be construed as excluding or limiting
|
| 525 |
+
any implied license or other defenses to infringement that may
|
| 526 |
+
otherwise be available to you under applicable patent law.
|
| 527 |
+
|
| 528 |
+
12. No Surrender of Others' Freedom.
|
| 529 |
+
|
| 530 |
+
If conditions are imposed on you (whether by court order, agreement or
|
| 531 |
+
otherwise) that contradict the conditions of this License, they do not
|
| 532 |
+
excuse you from the conditions of this License. If you cannot convey a
|
| 533 |
+
covered work so as to satisfy simultaneously your obligations under this
|
| 534 |
+
License and any other pertinent obligations, then as a consequence you may
|
| 535 |
+
not convey it at all. For example, if you agree to terms that obligate you
|
| 536 |
+
to collect a royalty for further conveying from those to whom you convey
|
| 537 |
+
the Program, the only way you could satisfy both those terms and this
|
| 538 |
+
License would be to refrain entirely from conveying the Program.
|
| 539 |
+
|
| 540 |
+
13. Remote Network Interaction; Use with the GNU General Public License.
|
| 541 |
+
|
| 542 |
+
Notwithstanding any other provision of this License, if you modify the
|
| 543 |
+
Program, your modified version must prominently offer all users
|
| 544 |
+
interacting with it remotely through a computer network (if your version
|
| 545 |
+
supports such interaction) an opportunity to receive the Corresponding
|
| 546 |
+
Source of your version by providing access to the Corresponding Source
|
| 547 |
+
from a network server at no charge, through some standard or customary
|
| 548 |
+
means of facilitating copying of software. This Corresponding Source
|
| 549 |
+
shall include the Corresponding Source for any work covered by version 3
|
| 550 |
+
of the GNU General Public License that is incorporated pursuant to the
|
| 551 |
+
following paragraph.
|
| 552 |
+
|
| 553 |
+
Notwithstanding any other provision of this License, you have
|
| 554 |
+
permission to link or combine any covered work with a work licensed
|
| 555 |
+
under version 3 of the GNU General Public License into a single
|
| 556 |
+
combined work, and to convey the resulting work. The terms of this
|
| 557 |
+
License will continue to apply to the part which is the covered work,
|
| 558 |
+
but the work with which it is combined will remain governed by version
|
| 559 |
+
3 of the GNU General Public License.
|
| 560 |
+
|
| 561 |
+
14. Revised Versions of this License.
|
| 562 |
+
|
| 563 |
+
The Free Software Foundation may publish revised and/or new versions of
|
| 564 |
+
the GNU Affero General Public License from time to time. Such new versions
|
| 565 |
+
will be similar in spirit to the present version, but may differ in detail to
|
| 566 |
+
address new problems or concerns.
|
| 567 |
+
|
| 568 |
+
Each version is given a distinguishing version number. If the
|
| 569 |
+
Program specifies that a certain numbered version of the GNU Affero General
|
| 570 |
+
Public License "or any later version" applies to it, you have the
|
| 571 |
+
option of following the terms and conditions either of that numbered
|
| 572 |
+
version or of any later version published by the Free Software
|
| 573 |
+
Foundation. If the Program does not specify a version number of the
|
| 574 |
+
GNU Affero General Public License, you may choose any version ever published
|
| 575 |
+
by the Free Software Foundation.
|
| 576 |
+
|
| 577 |
+
If the Program specifies that a proxy can decide which future
|
| 578 |
+
versions of the GNU Affero General Public License can be used, that proxy's
|
| 579 |
+
public statement of acceptance of a version permanently authorizes you
|
| 580 |
+
to choose that version for the Program.
|
| 581 |
+
|
| 582 |
+
Later license versions may give you additional or different
|
| 583 |
+
permissions. However, no additional obligations are imposed on any
|
| 584 |
+
author or copyright holder as a result of your choosing to follow a
|
| 585 |
+
later version.
|
| 586 |
+
|
| 587 |
+
15. Disclaimer of Warranty.
|
| 588 |
+
|
| 589 |
+
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
| 590 |
+
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
| 591 |
+
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
| 592 |
+
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
| 593 |
+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
| 594 |
+
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
| 595 |
+
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
| 596 |
+
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
| 597 |
+
|
| 598 |
+
16. Limitation of Liability.
|
| 599 |
+
|
| 600 |
+
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
| 601 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
| 602 |
+
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
| 603 |
+
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
| 604 |
+
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
| 605 |
+
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
| 606 |
+
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
| 607 |
+
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
| 608 |
+
SUCH DAMAGES.
|
| 609 |
+
|
| 610 |
+
17. Interpretation of Sections 15 and 16.
|
| 611 |
+
|
| 612 |
+
If the disclaimer of warranty and limitation of liability provided
|
| 613 |
+
above cannot be given local legal effect according to their terms,
|
| 614 |
+
reviewing courts shall apply local law that most closely approximates
|
| 615 |
+
an absolute waiver of all civil liability in connection with the
|
| 616 |
+
Program, unless a warranty or assumption of liability accompanies a
|
| 617 |
+
copy of the Program in return for a fee.
|
| 618 |
+
|
| 619 |
+
END OF TERMS AND CONDITIONS
|
| 620 |
+
|
| 621 |
+
How to Apply These Terms to Your New Programs
|
| 622 |
+
|
| 623 |
+
If you develop a new program, and you want it to be of the greatest
|
| 624 |
+
possible use to the public, the best way to achieve this is to make it
|
| 625 |
+
free software which everyone can redistribute and change under these terms.
|
| 626 |
+
|
| 627 |
+
To do so, attach the following notices to the program. It is safest
|
| 628 |
+
to attach them to the start of each source file to most effectively
|
| 629 |
+
state the exclusion of warranty; and each file should have at least
|
| 630 |
+
the "copyright" line and a pointer to where the full notice is found.
|
| 631 |
+
|
| 632 |
+
<one line to give the program's name and a brief idea of what it does.>
|
| 633 |
+
Copyright (C) <year> <name of author>
|
| 634 |
+
|
| 635 |
+
This program is free software: you can redistribute it and/or modify
|
| 636 |
+
it under the terms of the GNU Affero General Public License as published by
|
| 637 |
+
the Free Software Foundation, either version 3 of the License, or
|
| 638 |
+
(at your option) any later version.
|
| 639 |
+
|
| 640 |
+
This program is distributed in the hope that it will be useful,
|
| 641 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 642 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 643 |
+
GNU Affero General Public License for more details.
|
| 644 |
+
|
| 645 |
+
You should have received a copy of the GNU Affero General Public License
|
| 646 |
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
| 647 |
+
|
| 648 |
+
Also add information on how to contact you by electronic and paper mail.
|
| 649 |
+
|
| 650 |
+
If your software can interact with users remotely through a computer
|
| 651 |
+
network, you should also make sure that it provides a way for users to
|
| 652 |
+
get its source. For example, if your program is a web application, its
|
| 653 |
+
interface could display a "Source" link that leads users to an archive
|
| 654 |
+
of the code. There are many ways you could offer source, and different
|
| 655 |
+
solutions will be better for different programs; see section 13 for the
|
| 656 |
+
specific requirements.
|
| 657 |
+
|
| 658 |
+
You should also get your employer (if you work as a programmer) or school,
|
| 659 |
+
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
| 660 |
+
For more information on this, and how to apply and follow the GNU AGPL, see
|
| 661 |
+
<https://www.gnu.org/licenses/>.
|
NOTICE
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Turkic OCR: code of the generator, training and evaluation (release candidate rc1_code)
|
| 2 |
+
|
| 3 |
+
Copyright 2026 Anuar Suleimenov, Zhalgasbek Bolatov, Aidana Baglanova, Anel Kadirbekova
|
| 4 |
+
|
| 5 |
+
Cite as: Suleimenov, A., Bolatov, Z., Baglanova, A., Kadirbekova, A., Nguyen, A. T. (2026). A Handwriting Recognition
|
| 6 |
+
Model for Turkic Languages in Latin and Cyrillic Script. Project report, Nazarbayev University.
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
LICENCES
|
| 10 |
+
|
| 11 |
+
1. Apache License 2.0 (full text in LICENSE) applies to every file of this package except those listed under 2, 3 and 4.
|
| 12 |
+
|
| 13 |
+
2. GNU Affero General Public License v3.0 (full text in LICENSE.AGPL-3.0) applies to the training and inference path of the
|
| 14 |
+
line detector and to the page pipeline. The detector is trained and run with Ultralytics YOLO, which is AGPL-3.0, and
|
| 15 |
+
Ultralytics states that models trained with its code fall under AGPL-3.0 (https://www.ultralytics.com/license).
|
| 16 |
+
Files under AGPL-3.0:
|
| 17 |
+
src/linedet/det_prep.py
|
| 18 |
+
src/linedet/det_yolo.py
|
| 19 |
+
src/linedet/det_eval.py
|
| 20 |
+
src/linedet/det_overlay.py
|
| 21 |
+
src/linedet/det_school_stats.py
|
| 22 |
+
scripts/r5_linedet/det_prep_school.sbatch
|
| 23 |
+
scripts/release2/rel2_d5_prep.py
|
| 24 |
+
scripts/release2/rel2_d5_prep.sbatch
|
| 25 |
+
scripts/release2/rel2_d5_detector_retrain.sbatch
|
| 26 |
+
scripts/release2/rel2_d5_check.py
|
| 27 |
+
scripts/release2/rel2_d5_check.sbatch
|
| 28 |
+
scripts/release2/rel2_d5_install.sbatch
|
| 29 |
+
scripts/r5_release/rc1_prep_det.py
|
| 30 |
+
scripts/r5_testpass2/tp2_tob_detect.py
|
| 31 |
+
scripts/r5_loopguard/lg_detect.py
|
| 32 |
+
scripts/r5_showcase/showcase_detect.py
|
| 33 |
+
release/turkic-line-detector-yolo11s/infer.py
|
| 34 |
+
release/turkic-line-detector-yolo11s/requirements.txt
|
| 35 |
+
release/page-pipeline/infer.py
|
| 36 |
+
release/page-pipeline/requirements.txt
|
| 37 |
+
|
| 38 |
+
3. MIT License (third-party code, vendored without changes; only its README.md is left out):
|
| 39 |
+
the HTR-Flor folder in src/ref/ (its path is set in scripts/r5_ref/ref_common.py)
|
| 40 |
+
HTR-Flor, https://github.com/arthurflor23/handwritten-text-recognition, repository state of 23 June 2021,
|
| 41 |
+
Copyright (c) 2019 Arthur Flôr. Its LICENSE file is kept in that folder. Used for the HTR-Flor reference re-run.
|
| 42 |
+
|
| 43 |
+
4. Public domain data: src/pagesynth/assets/naturalearth/*.geojson, Natural Earth vector map data (1:50m),
|
| 44 |
+
https://www.naturalearthdata.com. Its terms of use state: "All versions of Natural Earth raster + vector map data found on
|
| 45 |
+
this website are in the public domain." The generator draws its maps from these files.
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
THIRD-PARTY SOFTWARE NOT INCLUDED
|
| 49 |
+
|
| 50 |
+
The code imports third-party packages (PyTorch, Hugging Face Transformers, kraken, Ultralytics, KenLM, PaddleOCR and others)
|
| 51 |
+
that are installed separately under their own licences; the environments/ folder lists the versions used.
|
| 52 |
+
The PP-OCRv3 reference re-run (scripts/r5_ref, arm R2) expects PaddleOCR release v2.10.0
|
| 53 |
+
(7 March 2025) of https://github.com/PaddlePaddle/PaddleOCR (Apache-2.0) in the folder under src/ref/ that
|
| 54 |
+
scripts/r5_ref/ref_common.py sets (PPOCR_ROOT); it is not included.
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
NOT INCLUDED
|
| 58 |
+
|
| 59 |
+
No data, no font files and no weights of the fine-tuned readers (PaddleOCR-VL-1.6, Qwen3-VL-2B, PP-OCRv6-medium and its
|
| 60 |
+
character language model). See README.
|
README
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
TURKIC OCR: CODE OF THE GENERATOR, TRAINING AND EVALUATION
|
| 2 |
+
(release candidate rc1_code)
|
| 3 |
+
|
| 4 |
+
This package holds the code behind the project report
|
| 5 |
+
|
| 6 |
+
Suleimenov, A., Bolatov, Z., Baglanova, A., Kadirbekova, A., Nguyen, A. T. (2026). A Handwriting Recognition Model
|
| 7 |
+
for Turkic Languages in Latin and Cyrillic Script. Project report, Nazarbayev University.
|
| 8 |
+
|
| 9 |
+
@techreport{suleimenov2026turkic,
|
| 10 |
+
author = {Suleimenov, Anuar and Bolatov, Zhalgasbek and Baglanova, Aidana and Kadirbekova, Anel and Nguyen, Anh Tu},
|
| 11 |
+
title = {A Handwriting Recognition Model for Turkic Languages in Latin and Cyrillic Script},
|
| 12 |
+
institution = {Nazarbayev University},
|
| 13 |
+
type = {Project report},
|
| 14 |
+
year = {2026}
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
It contains the page and line generator (pagesynth 0.3.0) with its text filters, the builders of the real-data
|
| 18 |
+
manifests and of the training mix, the training code of the vision-language readers and of the CTC line recognizers,
|
| 19 |
+
the training and inference code of the line detector, the scorer with its bootstrap intervals and selection rules, the
|
| 20 |
+
test-pass and page-scoring scripts, the inference scripts of the release packages, and the code of the planned RQ2
|
| 21 |
+
augmentation study. "The paper" below means the report cited above; section numbers refer to it (S1 to S11 are the
|
| 22 |
+
sections of its supplementary material). Comments in the code name the project's work stages in capitals (for example
|
| 23 |
+
GEN for the generator, DATA for the real-data manifests, PRINT, FREEZE, LINEDET, REF, VLMA, VLMB, EVALCODE) and use the
|
| 24 |
+
round name R5 for the run that produced the paper's results.
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
1. WHAT IS NOT IN THIS PACKAGE
|
| 28 |
+
|
| 29 |
+
- No data. None of the real datasets is included, and neither are the project's generated data, manifests, splits or
|
| 30 |
+
predictions. Where to obtain the real datasets is listed in part 6. The generated data are released separately under
|
| 31 |
+
CC BY-SA 4.0.
|
| 32 |
+
- No reader weights. The fine-tuned weights of the three readers (PaddleOCR-VL-1.6, the final model; Qwen3-VL-2B; and
|
| 33 |
+
the PP-OCRv6-medium line recognizer with its character language model) are not released. They were trained on KOHTD
|
| 34 |
+
and HKR, whose terms limit use to the applicant's group and to academic research, and their authors have not given
|
| 35 |
+
permission to share models trained on them. The code here lets others train their own readers from the released
|
| 36 |
+
generated data and the real datasets obtained from their sources.
|
| 37 |
+
- The line detector's weights are released separately, with this code path, under AGPL-3.0.
|
| 38 |
+
- No font files. The generator needs the 73 fonts listed in src/pagesynth/assets/fonts_manifest.tsv (file name,
|
| 39 |
+
content fingerprint, licence class, and whether the font is held out of training). Place them in src/pagesynth/assets/fonts/ or
|
| 40 |
+
point the environment variable PAGESYNTH_FONTS to their folder. Eight of them are personal-use fonts (licence class
|
| 41 |
+
personal_use_only); they may not be redistributed, and the released generated data contain no item drawn with them.
|
| 42 |
+
- Not included: the vendored PaddleOCR source used only by the PP-OCRv3 reference re-run (see NOTICE), earlier
|
| 43 |
+
generator versions (0.1 and 0.2.0; the text filters of 0.2.0 are identical to those of 0.3.0), staging and test copies of
|
| 44 |
+
scripts, one-off probes, the corrector pilot (never trained), the unfinished full-schedule PP-OCRv3 re-run, and the
|
| 45 |
+
download and extraction scripts of KOHTD, which need access credentials from its authors.
|
| 46 |
+
- config_r5eval/sota_checklist.json is not included. scripts/r5_select_verdict.sbatch passes it to
|
| 47 |
+
scripts/r5eval/verdict.py; remove that argument (verdict.py runs without it) or supply your own checklist.
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
2. LICENCES
|
| 51 |
+
|
| 52 |
+
Apache-2.0 (LICENSE) for everything except: the line detector's training and inference path and the page pipeline,
|
| 53 |
+
which are AGPL-3.0 (LICENSE.AGPL-3.0; the files are listed in NOTICE); the vendored HTR-Flor copy in
|
| 54 |
+
src/ref/ (repository state of 23 June 2021; MIT, its own LICENSE); and the Natural Earth map files in
|
| 55 |
+
src/pagesynth/assets/naturalearth/ (public domain). Copyright and third-party notices are in NOTICE.
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
3. SETTING UP
|
| 59 |
+
|
| 60 |
+
3.1 Paths. The code ran on a Slurm cluster with one code folder and one data folder. Every absolute path in the
|
| 61 |
+
package now starts with a placeholder:
|
| 62 |
+
|
| 63 |
+
/path/to/TURKIC_OCR_CODE the folder that holds this package (src/, scripts/, ... and the virtual environments)
|
| 64 |
+
/path/to/TURKIC_OCR_DATA the data folder, with data/raw, data/processed, outputs, checkpoints, logs, hf_cache, tmp
|
| 65 |
+
|
| 66 |
+
Replace both with your own folders before running anything, for example:
|
| 67 |
+
|
| 68 |
+
grep -rlF /path/to/TURKIC_OCR_CODE . | xargs sed -i 's#/path/to/TURKIC_OCR_CODE#/home/me/turkic_ocr#g'
|
| 69 |
+
grep -rlF /path/to/TURKIC_OCR_DATA . | xargs sed -i 's#/path/to/TURKIC_OCR_DATA#/data/turkic_ocr#g'
|
| 70 |
+
|
| 71 |
+
Neither placeholder is a prefix of the other, so the order does not matter. The Slurm headers name
|
| 72 |
+
the partitions (H100, ZEN4) and quality-of-service names of the original cluster; adapt them to yours. Many scripts
|
| 73 |
+
and comments refer to the project's working records (paths that begin with records/, or files under the data folder
|
| 74 |
+
such as manifests and score files); these records are not part of this package.
|
| 75 |
+
|
| 76 |
+
3.2 Python environments. The scripts call the interpreter of a project environment, for example
|
| 77 |
+
/path/to/TURKIC_OCR_CODE/.venv_gen/bin/python. The folder environments/ holds the exact package list of each
|
| 78 |
+
environment, made with 'uv pip freeze'. To rebuild one:
|
| 79 |
+
|
| 80 |
+
uv venv --python 3.12 /path/to/TURKIC_OCR_CODE/.venv_gen
|
| 81 |
+
uv pip install --python /path/to/TURKIC_OCR_CODE/.venv_gen/bin/python -r environments/venv_gen.requirements
|
| 82 |
+
|
| 83 |
+
PyTorch builds with a +cu suffix in the lists come from the PyTorch package index (add
|
| 84 |
+
--extra-index-url https://download.pytorch.org/whl/<cuda tag>, the tag matching the suffix).
|
| 85 |
+
|
| 86 |
+
environment (file) Python main use
|
| 87 |
+
.venv (venv.requirements) 3.12 real-data manifests (scripts/r5), KOHTD split and leak checks, zero-shot screen
|
| 88 |
+
.venv_gen (venv_gen.requirements) 3.12 generator, training-mix freeze, release data build
|
| 89 |
+
.venv_kraken 3.12 CTC line recognizers, letter model, detector, scorer jobs, test pass 2, RQ2
|
| 90 |
+
.venv_vlm 3.12 vision-language training and evaluation (scripts/r5_vlma), single page model,
|
| 91 |
+
loop guard, page check, showcase
|
| 92 |
+
.venv_vlm_<model> (9 files) 3.12 * one per extra candidate in scripts/r5_vlmb (* unlimited_ocr_2: 3.10)
|
| 93 |
+
.venv_print 3.12 real printed lines (scripts/r5_print)
|
| 94 |
+
.venv_ref_tf 3.11 HTR-Flor reference re-run (R1)
|
| 95 |
+
.venv_ref_paddle, .venv_ref_paddle_cpu 3.11 PP-OCRv3 reference re-run (R2)
|
| 96 |
+
.venv_dl see file download tools (Kazakh web benchmark)
|
| 97 |
+
|
| 98 |
+
The exact Python version of each environment is in its file's first line. Each shell and sbatch file names the
|
| 99 |
+
environment its step used. The release packages in release/ carry their own requirements.txt.
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
4. FOLDERS AND WHERE THEY APPEAR IN THE PAPER
|
| 103 |
+
|
| 104 |
+
src/pagesynth/ Page and line generator 0.3.0: text cleaning and filters (text.py, langtext.py,
|
| 105 |
+
textbuild.py, vocab.py), fonts and the glyph gate, the simulated writer, layouts, paper,
|
| 106 |
+
marks, maps, capture, cropping; produce_r5.py and scripts/ run the text build, the text
|
| 107 |
+
split by source document and the production. Paper: Section 2.2, S2.
|
| 108 |
+
src/linedet/ CTC line recognizers (PP-OCRv6 medium and small, CRNN, HTR-VT-style model), training
|
| 109 |
+
driver, prediction, the character 6-gram letter model with beam search and its gate, and
|
| 110 |
+
(det_*.py, AGPL-3.0) the YOLO11s line detector: data preparation, training, evaluation.
|
| 111 |
+
Paper: Sections 3.4 and 3.5, S6, S9, S10.
|
| 112 |
+
src/r5eval/, scripts/r5eval/ Scorer: text normalisation, CER and WER, look-alike repair, form-level bootstrap,
|
| 113 |
+
config_r5eval/, tests_r5eval/ Holm correction, selection of leaders and of the final model, decision rules, report
|
| 114 |
+
cards; with its configuration and tests. Paper: Section 4, S7.
|
| 115 |
+
scripts/r5_score.sbatch and Scoring, selection, verdict, learning-curve and self-test jobs of the scorer.
|
| 116 |
+
the other scripts/r5_*.sbatch Paper: Section 4, S7.
|
| 117 |
+
scripts/r5_gate/ Gate files that kept the test sets sealed until the single test pass. Paper: Section 4, S7.
|
| 118 |
+
scripts/r5/ Real-data manifests (KOHTD, HKR, Cyrillic Handwriting Dataset, School Notebooks, RUKOPYS,
|
| 119 |
+
LocalDoc), de-duplication against held-out images, the registry of training, validation
|
| 120 |
+
and test sets, validation subsets and the unseen-word slice. Paper: Section 2.1, S1, S4, S7.
|
| 121 |
+
scripts/k1_labels_all.py, KOHTD split by exam form (a salted deterministic function of the form number). Paper: Section 2.1, S4.
|
| 122 |
+
scripts/k1_build_split.py
|
| 123 |
+
scripts/kohtd_leak_* Checks that no KOHTD training crop without a form number is a copy of a validation or
|
| 124 |
+
test crop. Paper: S4.
|
| 125 |
+
scripts/r5_print/ Real printed lines: candidate PDFs from FinePDFs, text-layer check, line cutting, pixel
|
| 126 |
+
checks, split by document. Paper: Section 2.1, S3.
|
| 127 |
+
scripts/r5_freeze/ Freeze of the training mix (shares, de-duplication against held-out sets, sample
|
| 128 |
+
sequences). Paper: Section 2.3, S2.
|
| 129 |
+
scripts/j2/ Zero-shot screen of released document models on KOHTD validation words. Paper: Section 3.2.
|
| 130 |
+
scripts/r5_vlma/ Fine-tuning and evaluation of the vision-language readers (shared recipe, short and long
|
| 131 |
+
runs, slot runners), preference post-training (DPO, GRPO), and the sealed test pass.
|
| 132 |
+
Paper: Sections 3.2, 3.3 and 4, S5, S6, S7.
|
| 133 |
+
scripts/r5_vlmb/ Adapters, environments and runner for the extra vision-language candidates. Paper: S5, S6.
|
| 134 |
+
scripts/r5_linedet/ Jobs of the line recognizers, the detector and the letter model. Paper: Sections 3.4, 3.5, S6.
|
| 135 |
+
scripts/r5_ref/, src/ref/ Reference re-runs: HTR-Flor (R1, vendored copy in src/ref/) and PP-OCRv3 (R2, PaddleOCR
|
| 136 |
+
not included). Paper: Section 5, S10.
|
| 137 |
+
scripts/r5_testpass2/ Second test pass and its amendments: real handwriting and print tests, page tests
|
| 138 |
+
(TurkishOCR-Bench, Kazakh web benchmark), label-free re-reading of the line recognizer,
|
| 139 |
+
per-language tables, error analysis. Paper: Section 5, S7, S8, S9.
|
| 140 |
+
scripts/tp2_proposal_metrics.py Measures for the research questions. Paper: Section 6.1, S8.
|
| 141 |
+
scripts/r5_erran/ Error analysis of validation outputs (label errors, ambiguous handwriting). Paper: S7.
|
| 142 |
+
scripts/b1_page_check/ Page check: the final model on whole pages, alone and after the detector. Paper: S9.
|
| 143 |
+
scripts/r5_onemodel/ Single page model: page records, training, page scoring. Paper: S6, S9.
|
| 144 |
+
scripts/r5_loopguard/ Loop guard for the single page model. Paper: S9, S10.
|
| 145 |
+
scripts/r5_showcase/ Showcase pages: the generator stages of chosen validation pages (material for Figure 2)
|
| 146 |
+
and pages read by the pipeline. Paper: Section 2.2, S11.
|
| 147 |
+
scripts/r5_release/ Checks of the first release candidate, including the batching diagnostic of the line
|
| 148 |
+
recognizer. Paper: S7 (the batching leak).
|
| 149 |
+
scripts/release2/ Release build: data package, Parquet shards, regeneration check of every released page,
|
| 150 |
+
Sakha-text check, cards and file verification; rel2_d5_* (AGPL-3.0) retrain and check the
|
| 151 |
+
released detector without the personal-use-font pages. Paper: S11.
|
| 152 |
+
release/ Inference scripts and requirements of the release packages: the three readers (whose
|
| 153 |
+
weights are not released), the line detector and the page pipeline (AGPL-3.0). Paper: S11.
|
| 154 |
+
src/rq2/, scripts/r5_rq2/, RQ2 augmentation study (line height 32 or 64 px crossed with a typical or a diacritic-safe
|
| 155 |
+
src/lettersynth/ augmentation policy) and its pixel probe; src/lettersynth holds only the letter-sheet
|
| 156 |
+
reader that the probe uses. This code was written after the paper's results; the paper
|
| 157 |
+
states that the study was not run, and no RQ2 result is part of it.
|
| 158 |
+
environments/ Package lists of the Python environments (part 3.2).
|
| 159 |
+
|
| 160 |
+
|
| 161 |
+
5. KNOWN ISSUES
|
| 162 |
+
|
| 163 |
+
- Content pins. Some files pin the exact content of other files as it was on the cluster, and a few check it at start.
|
| 164 |
+
Making the paths configurable changed some pinned files, so those pins no longer match (the list of affected pins
|
| 165 |
+
is in part 7). Update the pinned values after configuring the paths, or skip the check.
|
| 166 |
+
- release/turkic-ocr-ppocrv6-medium/infer.py is the inference script of the withheld PP-OCRv6 package. Its docstring
|
| 167 |
+
was written before the corrections the paper reports in S7 (the batching leak) and was not updated; the paper's
|
| 168 |
+
figures supersede the ones it quotes.
|
| 169 |
+
- The generator reproduces the content of a page from its seed but not every byte (paper, S11).
|
| 170 |
+
- The scripts were written for one cluster and one run of the project: many take their inputs from fixed paths and
|
| 171 |
+
write records of that run. They document what was done; running them elsewhere needs the data, the paths and the
|
| 172 |
+
job headers set up as described in part 3.
|
| 173 |
+
|
| 174 |
+
|
| 175 |
+
6. REAL DATASETS: NOT INCLUDED, WHERE TO OBTAIN THEM
|
| 176 |
+
|
| 177 |
+
KOHTD (Kazakh handwriting) https://github.com/abdoelsayed2016/KOHTD (the authors' application form)
|
| 178 |
+
HKR (Kazakh and Russian) https://github.com/abdoelsayed2016/HKR_Dataset (the authors' application form)
|
| 179 |
+
School Notebooks RU https://huggingface.co/datasets/ai-forever/school_notebooks_RU
|
| 180 |
+
Cyrillic Handwriting Dataset https://www.kaggle.com/datasets/constantinwerner/cyrillic-handwriting-dataset
|
| 181 |
+
Azerbaijani Handwritten OCR
|
| 182 |
+
Benchmark (LocalDoc) https://huggingface.co/datasets/LocalDoc/azerbaijani-htr-benchmark
|
| 183 |
+
TurkishOCR-Bench https://huggingface.co/datasets/moganai/TurkishOCR-Bench
|
| 184 |
+
RUKOPYS (Ukrainian) https://huggingface.co/datasets/UkrainianCatholicUniversity/rukopys
|
| 185 |
+
FinePDFs (real printed lines) https://huggingface.co/datasets/HuggingFaceFW/finepdfs
|
| 186 |
+
FineWeb-2 (generator text) https://huggingface.co/datasets/HuggingFaceFW/fineweb-2
|
| 187 |
+
Wikipedia (generator text) https://huggingface.co/datasets/wikimedia/wikipedia (snapshot 20231101)
|
| 188 |
+
PP-OCRv6 medium base weights https://doi.org/10.5281/zenodo.21788410
|
| 189 |
+
|
| 190 |
+
Each dataset keeps its own licence and terms. Three further sources are read by the code but are not in the paper's
|
| 191 |
+
reference list; their identifiers are taken from the code:
|
| 192 |
+
Kazakh web benchmark Hugging Face dataset Omar-2002/kz_benchmark_data (scripts/r5_testpass2/tp2_kzb_fetch.py)
|
| 193 |
+
Sakha newspaper corpus Hugging Face dataset ailabykt/sakha-corpus-mono (generator text for Sakha)
|
| 194 |
+
Kazakh handwritten letter sheets https://github.com/Nuray-Sheriyeva/Kazakh_Handwritten_Letter_Dataset (dataset_split_v2;
|
| 195 |
+
read by the RQ2 pixel probe)
|
| 196 |
+
|
| 197 |
+
|
| 198 |
+
7. EDITS MADE FOR THE PACKAGE, AND CONTENT PINS
|
| 199 |
+
|
| 200 |
+
The package was made from the project's files by these edits only: absolute paths were replaced by the placeholders of
|
| 201 |
+
part 3.1; comments and descriptive strings were reworded; the folder scripts/r5_gate was renamed; two output fields
|
| 202 |
+
were renamed (endpoints_confirmed in the verdict written by scripts/r5eval/verdict.py, added_beyond_plan in the set
|
| 203 |
+
registry written by scripts/r5/r5_registry.py); one verdict text of scripts/r5_freeze/dedupe_verdict.py now reads
|
| 204 |
+
"NEEDS MANUAL REVIEW"; and scripts/r5_testpass2/tp2_make_plan.py no longer records the fingerprint of a planning note.
|
| 205 |
+
|
| 206 |
+
Two pins that the code checks at run time were updated to the shipped files, so they match:
|
| 207 |
+
src/r5eval/cards.py (label-rule pin) the content of config_r5eval/r5_descriptive_labels.txt (reworded first line),
|
| 208 |
+
checked by scripts/r5eval/report_cards.py.
|
| 209 |
+
src/r5eval/frozen.py (frozen-file pin) the content of src/r5eval/frozen/postproc_vlma.py (one reworded docstring line;
|
| 210 |
+
scripts/r5_vlma/postproc.py and scripts/r5_vlmb/postproc.py are identical
|
| 211 |
+
copies), checked whenever the scorer is imported.
|
| 212 |
+
|
| 213 |
+
Four pins refer to a file that these edits changed and were left as they were:
|
| 214 |
+
|
| 215 |
+
src/rq2/geom.py pins src/linedet/common.py (paths). Checked at start: the RQ2 wrappers stop
|
| 216 |
+
with "REFUSED". After configuring the paths, put the new fingerprint of
|
| 217 |
+
src/linedet/common.py into PINNED in src/rq2/geom.py. The same table pins
|
| 218 |
+
four kraken files of the installed kraken package and three data files.
|
| 219 |
+
scripts/r5_vlma/make_vlmb_testpass.py pins scripts/r5_vlmb/vlmb_eval_vlm.py (a reworded comment); it is the one-time
|
| 220 |
+
builder of scripts/r5_vlmb/vlmb_eval_vlm_testpass.py, which also quotes that
|
| 221 |
+
fingerprint in a comment.
|
| 222 |
+
scripts/r5_vlma/testpass_config.json quotes the fingerprint of scripts/r5_linedet/test_pass_commands.sh (paths) in a note.
|
| 223 |
+
|
| 224 |
+
All other pins inside the package still match.
|
README.md
ADDED
|
@@ -0,0 +1,251 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
# Licence: Apache-2.0 for the package, except the line detector's training and inference path and the page
|
| 3 |
+
# pipeline, which are AGPL-3.0 (LICENSE.AGPL-3.0; the files are listed in NOTICE); see also README part 2.
|
| 4 |
+
license: apache-2.0
|
| 5 |
+
language:
|
| 6 |
+
- kk
|
| 7 |
+
- ky
|
| 8 |
+
- uz
|
| 9 |
+
- tr
|
| 10 |
+
- az
|
| 11 |
+
- tt
|
| 12 |
+
- ba
|
| 13 |
+
- tk
|
| 14 |
+
- sah
|
| 15 |
+
pipeline_tag: image-to-text
|
| 16 |
+
tags:
|
| 17 |
+
- ocr
|
| 18 |
+
- handwriting
|
| 19 |
+
- handwritten-text-recognition
|
| 20 |
+
- text-line-detection
|
| 21 |
+
- synthetic-data
|
| 22 |
+
- document-images
|
| 23 |
+
- turkic-languages
|
| 24 |
+
- cyrillic
|
| 25 |
+
- latin-script
|
| 26 |
+
---
|
| 27 |
+
|
| 28 |
+
TURKIC OCR: CODE OF THE GENERATOR, TRAINING AND EVALUATION
|
| 29 |
+
(release candidate rc1_code)
|
| 30 |
+
|
| 31 |
+
This package holds the code behind the project report
|
| 32 |
+
|
| 33 |
+
Suleimenov, A., Bolatov, Z., Baglanova, A., Kadirbekova, A., Nguyen, A. T. (2026). A Handwriting Recognition Model
|
| 34 |
+
for Turkic Languages in Latin and Cyrillic Script. Project report, Nazarbayev University.
|
| 35 |
+
|
| 36 |
+
@techreport{suleimenov2026turkic,
|
| 37 |
+
author = {Suleimenov, Anuar and Bolatov, Zhalgasbek and Baglanova, Aidana and Kadirbekova, Anel and Nguyen, Anh Tu},
|
| 38 |
+
title = {A Handwriting Recognition Model for Turkic Languages in Latin and Cyrillic Script},
|
| 39 |
+
institution = {Nazarbayev University},
|
| 40 |
+
type = {Project report},
|
| 41 |
+
year = {2026}
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
It contains the page and line generator (pagesynth 0.3.0) with its text filters, the builders of the real-data
|
| 45 |
+
manifests and of the training mix, the training code of the vision-language readers and of the CTC line recognizers,
|
| 46 |
+
the training and inference code of the line detector, the scorer with its bootstrap intervals and selection rules, the
|
| 47 |
+
test-pass and page-scoring scripts, the inference scripts of the release packages, and the code of the planned RQ2
|
| 48 |
+
augmentation study. "The paper" below means the report cited above; section numbers refer to it (S1 to S11 are the
|
| 49 |
+
sections of its supplementary material). Comments in the code name the project's work stages in capitals (for example
|
| 50 |
+
GEN for the generator, DATA for the real-data manifests, PRINT, FREEZE, LINEDET, REF, VLMA, VLMB, EVALCODE) and use the
|
| 51 |
+
round name R5 for the run that produced the paper's results.
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
1. WHAT IS NOT IN THIS PACKAGE
|
| 55 |
+
|
| 56 |
+
- No data. None of the real datasets is included, and neither are the project's generated data, manifests, splits or
|
| 57 |
+
predictions. Where to obtain the real datasets is listed in part 6. The generated data are released separately under
|
| 58 |
+
CC BY-SA 4.0.
|
| 59 |
+
- No reader weights. The fine-tuned weights of the three readers (PaddleOCR-VL-1.6, the final model; Qwen3-VL-2B; and
|
| 60 |
+
the PP-OCRv6-medium line recognizer with its character language model) are not released. They were trained on KOHTD
|
| 61 |
+
and HKR, whose terms limit use to the applicant's group and to academic research, and their authors have not given
|
| 62 |
+
permission to share models trained on them. The code here lets others train their own readers from the released
|
| 63 |
+
generated data and the real datasets obtained from their sources.
|
| 64 |
+
- The line detector's weights are released separately, with this code path, under AGPL-3.0.
|
| 65 |
+
- No font files. The generator needs the 73 fonts listed in src/pagesynth/assets/fonts_manifest.tsv (file name,
|
| 66 |
+
content fingerprint, licence class, and whether the font is held out of training). Place them in src/pagesynth/assets/fonts/ or
|
| 67 |
+
point the environment variable PAGESYNTH_FONTS to their folder. Eight of them are personal-use fonts (licence class
|
| 68 |
+
personal_use_only); they may not be redistributed, and the released generated data contain no item drawn with them.
|
| 69 |
+
- Not included: the vendored PaddleOCR source used only by the PP-OCRv3 reference re-run (see NOTICE), earlier
|
| 70 |
+
generator versions (0.1 and 0.2.0; the text filters of 0.2.0 are identical to those of 0.3.0), staging and test copies of
|
| 71 |
+
scripts, one-off probes, the corrector pilot (never trained), the unfinished full-schedule PP-OCRv3 re-run, and the
|
| 72 |
+
download and extraction scripts of KOHTD, which need access credentials from its authors.
|
| 73 |
+
- config_r5eval/sota_checklist.json is not included. scripts/r5_select_verdict.sbatch passes it to
|
| 74 |
+
scripts/r5eval/verdict.py; remove that argument (verdict.py runs without it) or supply your own checklist.
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
2. LICENCES
|
| 78 |
+
|
| 79 |
+
Apache-2.0 (LICENSE) for everything except: the line detector's training and inference path and the page pipeline,
|
| 80 |
+
which are AGPL-3.0 (LICENSE.AGPL-3.0; the files are listed in NOTICE); the vendored HTR-Flor copy in
|
| 81 |
+
src/ref/ (repository state of 23 June 2021; MIT, its own LICENSE); and the Natural Earth map files in
|
| 82 |
+
src/pagesynth/assets/naturalearth/ (public domain). Copyright and third-party notices are in NOTICE.
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
3. SETTING UP
|
| 86 |
+
|
| 87 |
+
3.1 Paths. The code ran on a Slurm cluster with one code folder and one data folder. Every absolute path in the
|
| 88 |
+
package now starts with a placeholder:
|
| 89 |
+
|
| 90 |
+
/path/to/TURKIC_OCR_CODE the folder that holds this package (src/, scripts/, ... and the virtual environments)
|
| 91 |
+
/path/to/TURKIC_OCR_DATA the data folder, with data/raw, data/processed, outputs, checkpoints, logs, hf_cache, tmp
|
| 92 |
+
|
| 93 |
+
Replace both with your own folders before running anything, for example:
|
| 94 |
+
|
| 95 |
+
grep -rlF /path/to/TURKIC_OCR_CODE . | xargs sed -i 's#/path/to/TURKIC_OCR_CODE#/home/me/turkic_ocr#g'
|
| 96 |
+
grep -rlF /path/to/TURKIC_OCR_DATA . | xargs sed -i 's#/path/to/TURKIC_OCR_DATA#/data/turkic_ocr#g'
|
| 97 |
+
|
| 98 |
+
Neither placeholder is a prefix of the other, so the order does not matter. The Slurm headers name
|
| 99 |
+
the partitions (H100, ZEN4) and quality-of-service names of the original cluster; adapt them to yours. Many scripts
|
| 100 |
+
and comments refer to the project's working records (paths that begin with records/, or files under the data folder
|
| 101 |
+
such as manifests and score files); these records are not part of this package.
|
| 102 |
+
|
| 103 |
+
3.2 Python environments. The scripts call the interpreter of a project environment, for example
|
| 104 |
+
/path/to/TURKIC_OCR_CODE/.venv_gen/bin/python. The folder environments/ holds the exact package list of each
|
| 105 |
+
environment, made with 'uv pip freeze'. To rebuild one:
|
| 106 |
+
|
| 107 |
+
uv venv --python 3.12 /path/to/TURKIC_OCR_CODE/.venv_gen
|
| 108 |
+
uv pip install --python /path/to/TURKIC_OCR_CODE/.venv_gen/bin/python -r environments/venv_gen.requirements
|
| 109 |
+
|
| 110 |
+
PyTorch builds with a +cu suffix in the lists come from the PyTorch package index (add
|
| 111 |
+
--extra-index-url https://download.pytorch.org/whl/<cuda tag>, the tag matching the suffix).
|
| 112 |
+
|
| 113 |
+
environment (file) Python main use
|
| 114 |
+
.venv (venv.requirements) 3.12 real-data manifests (scripts/r5), KOHTD split and leak checks, zero-shot screen
|
| 115 |
+
.venv_gen (venv_gen.requirements) 3.12 generator, training-mix freeze, release data build
|
| 116 |
+
.venv_kraken 3.12 CTC line recognizers, letter model, detector, scorer jobs, test pass 2, RQ2
|
| 117 |
+
.venv_vlm 3.12 vision-language training and evaluation (scripts/r5_vlma), single page model,
|
| 118 |
+
loop guard, page check, showcase
|
| 119 |
+
.venv_vlm_<model> (9 files) 3.12 * one per extra candidate in scripts/r5_vlmb (* unlimited_ocr_2: 3.10)
|
| 120 |
+
.venv_print 3.12 real printed lines (scripts/r5_print)
|
| 121 |
+
.venv_ref_tf 3.11 HTR-Flor reference re-run (R1)
|
| 122 |
+
.venv_ref_paddle, .venv_ref_paddle_cpu 3.11 PP-OCRv3 reference re-run (R2)
|
| 123 |
+
.venv_dl see file download tools (Kazakh web benchmark)
|
| 124 |
+
|
| 125 |
+
The exact Python version of each environment is in its file's first line. Each shell and sbatch file names the
|
| 126 |
+
environment its step used. The release packages in release/ carry their own requirements.txt.
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
4. FOLDERS AND WHERE THEY APPEAR IN THE PAPER
|
| 130 |
+
|
| 131 |
+
src/pagesynth/ Page and line generator 0.3.0: text cleaning and filters (text.py, langtext.py,
|
| 132 |
+
textbuild.py, vocab.py), fonts and the glyph gate, the simulated writer, layouts, paper,
|
| 133 |
+
marks, maps, capture, cropping; produce_r5.py and scripts/ run the text build, the text
|
| 134 |
+
split by source document and the production. Paper: Section 2.2, S2.
|
| 135 |
+
src/linedet/ CTC line recognizers (PP-OCRv6 medium and small, CRNN, HTR-VT-style model), training
|
| 136 |
+
driver, prediction, the character 6-gram letter model with beam search and its gate, and
|
| 137 |
+
(det_*.py, AGPL-3.0) the YOLO11s line detector: data preparation, training, evaluation.
|
| 138 |
+
Paper: Sections 3.4 and 3.5, S6, S9, S10.
|
| 139 |
+
src/r5eval/, scripts/r5eval/ Scorer: text normalisation, CER and WER, look-alike repair, form-level bootstrap,
|
| 140 |
+
config_r5eval/, tests_r5eval/ Holm correction, selection of leaders and of the final model, decision rules, report
|
| 141 |
+
cards; with its configuration and tests. Paper: Section 4, S7.
|
| 142 |
+
scripts/r5_score.sbatch and Scoring, selection, verdict, learning-curve and self-test jobs of the scorer.
|
| 143 |
+
the other scripts/r5_*.sbatch Paper: Section 4, S7.
|
| 144 |
+
scripts/r5_gate/ Gate files that kept the test sets sealed until the single test pass. Paper: Section 4, S7.
|
| 145 |
+
scripts/r5/ Real-data manifests (KOHTD, HKR, Cyrillic Handwriting Dataset, School Notebooks, RUKOPYS,
|
| 146 |
+
LocalDoc), de-duplication against held-out images, the registry of training, validation
|
| 147 |
+
and test sets, validation subsets and the unseen-word slice. Paper: Section 2.1, S1, S4, S7.
|
| 148 |
+
scripts/k1_labels_all.py, KOHTD split by exam form (a salted deterministic function of the form number). Paper: Section 2.1, S4.
|
| 149 |
+
scripts/k1_build_split.py
|
| 150 |
+
scripts/kohtd_leak_* Checks that no KOHTD training crop without a form number is a copy of a validation or
|
| 151 |
+
test crop. Paper: S4.
|
| 152 |
+
scripts/r5_print/ Real printed lines: candidate PDFs from FinePDFs, text-layer check, line cutting, pixel
|
| 153 |
+
checks, split by document. Paper: Section 2.1, S3.
|
| 154 |
+
scripts/r5_freeze/ Freeze of the training mix (shares, de-duplication against held-out sets, sample
|
| 155 |
+
sequences). Paper: Section 2.3, S2.
|
| 156 |
+
scripts/j2/ Zero-shot screen of released document models on KOHTD validation words. Paper: Section 3.2.
|
| 157 |
+
scripts/r5_vlma/ Fine-tuning and evaluation of the vision-language readers (shared recipe, short and long
|
| 158 |
+
runs, slot runners), preference post-training (DPO, GRPO), and the sealed test pass.
|
| 159 |
+
Paper: Sections 3.2, 3.3 and 4, S5, S6, S7.
|
| 160 |
+
scripts/r5_vlmb/ Adapters, environments and runner for the extra vision-language candidates. Paper: S5, S6.
|
| 161 |
+
scripts/r5_linedet/ Jobs of the line recognizers, the detector and the letter model. Paper: Sections 3.4, 3.5, S6.
|
| 162 |
+
scripts/r5_ref/, src/ref/ Reference re-runs: HTR-Flor (R1, vendored copy in src/ref/) and PP-OCRv3 (R2, PaddleOCR
|
| 163 |
+
not included). Paper: Section 5, S10.
|
| 164 |
+
scripts/r5_testpass2/ Second test pass and its amendments: real handwriting and print tests, page tests
|
| 165 |
+
(TurkishOCR-Bench, Kazakh web benchmark), label-free re-reading of the line recognizer,
|
| 166 |
+
per-language tables, error analysis. Paper: Section 5, S7, S8, S9.
|
| 167 |
+
scripts/tp2_proposal_metrics.py Measures for the research questions. Paper: Section 6.1, S8.
|
| 168 |
+
scripts/r5_erran/ Error analysis of validation outputs (label errors, ambiguous handwriting). Paper: S7.
|
| 169 |
+
scripts/b1_page_check/ Page check: the final model on whole pages, alone and after the detector. Paper: S9.
|
| 170 |
+
scripts/r5_onemodel/ Single page model: page records, training, page scoring. Paper: S6, S9.
|
| 171 |
+
scripts/r5_loopguard/ Loop guard for the single page model. Paper: S9, S10.
|
| 172 |
+
scripts/r5_showcase/ Showcase pages: the generator stages of chosen validation pages (material for Figure 2)
|
| 173 |
+
and pages read by the pipeline. Paper: Section 2.2, S11.
|
| 174 |
+
scripts/r5_release/ Checks of the first release candidate, including the batching diagnostic of the line
|
| 175 |
+
recognizer. Paper: S7 (the batching leak).
|
| 176 |
+
scripts/release2/ Release build: data package, Parquet shards, regeneration check of every released page,
|
| 177 |
+
Sakha-text check, cards and file verification; rel2_d5_* (AGPL-3.0) retrain and check the
|
| 178 |
+
released detector without the personal-use-font pages. Paper: S11.
|
| 179 |
+
release/ Inference scripts and requirements of the release packages: the three readers (whose
|
| 180 |
+
weights are not released), the line detector and the page pipeline (AGPL-3.0). Paper: S11.
|
| 181 |
+
src/rq2/, scripts/r5_rq2/, RQ2 augmentation study (line height 32 or 64 px crossed with a typical or a diacritic-safe
|
| 182 |
+
src/lettersynth/ augmentation policy) and its pixel probe; src/lettersynth holds only the letter-sheet
|
| 183 |
+
reader that the probe uses. This code was written after the paper's results; the paper
|
| 184 |
+
states that the study was not run, and no RQ2 result is part of it.
|
| 185 |
+
environments/ Package lists of the Python environments (part 3.2).
|
| 186 |
+
|
| 187 |
+
|
| 188 |
+
5. KNOWN ISSUES
|
| 189 |
+
|
| 190 |
+
- Content pins. Some files pin the exact content of other files as it was on the cluster, and a few check it at start.
|
| 191 |
+
Making the paths configurable changed some pinned files, so those pins no longer match (the list of affected pins
|
| 192 |
+
is in part 7). Update the pinned values after configuring the paths, or skip the check.
|
| 193 |
+
- release/turkic-ocr-ppocrv6-medium/infer.py is the inference script of the withheld PP-OCRv6 package. Its docstring
|
| 194 |
+
was written before the corrections the paper reports in S7 (the batching leak) and was not updated; the paper's
|
| 195 |
+
figures supersede the ones it quotes.
|
| 196 |
+
- The generator reproduces the content of a page from its seed but not every byte (paper, S11).
|
| 197 |
+
- The scripts were written for one cluster and one run of the project: many take their inputs from fixed paths and
|
| 198 |
+
write records of that run. They document what was done; running them elsewhere needs the data, the paths and the
|
| 199 |
+
job headers set up as described in part 3.
|
| 200 |
+
|
| 201 |
+
|
| 202 |
+
6. REAL DATASETS: NOT INCLUDED, WHERE TO OBTAIN THEM
|
| 203 |
+
|
| 204 |
+
KOHTD (Kazakh handwriting) https://github.com/abdoelsayed2016/KOHTD (the authors' application form)
|
| 205 |
+
HKR (Kazakh and Russian) https://github.com/abdoelsayed2016/HKR_Dataset (the authors' application form)
|
| 206 |
+
School Notebooks RU https://huggingface.co/datasets/ai-forever/school_notebooks_RU
|
| 207 |
+
Cyrillic Handwriting Dataset https://www.kaggle.com/datasets/constantinwerner/cyrillic-handwriting-dataset
|
| 208 |
+
Azerbaijani Handwritten OCR
|
| 209 |
+
Benchmark (LocalDoc) https://huggingface.co/datasets/LocalDoc/azerbaijani-htr-benchmark
|
| 210 |
+
TurkishOCR-Bench https://huggingface.co/datasets/moganai/TurkishOCR-Bench
|
| 211 |
+
RUKOPYS (Ukrainian) https://huggingface.co/datasets/UkrainianCatholicUniversity/rukopys
|
| 212 |
+
FinePDFs (real printed lines) https://huggingface.co/datasets/HuggingFaceFW/finepdfs
|
| 213 |
+
FineWeb-2 (generator text) https://huggingface.co/datasets/HuggingFaceFW/fineweb-2
|
| 214 |
+
Wikipedia (generator text) https://huggingface.co/datasets/wikimedia/wikipedia (snapshot 20231101)
|
| 215 |
+
PP-OCRv6 medium base weights https://doi.org/10.5281/zenodo.21788410
|
| 216 |
+
|
| 217 |
+
Each dataset keeps its own licence and terms. Three further sources are read by the code but are not in the paper's
|
| 218 |
+
reference list; their identifiers are taken from the code:
|
| 219 |
+
Kazakh web benchmark Hugging Face dataset Omar-2002/kz_benchmark_data (scripts/r5_testpass2/tp2_kzb_fetch.py)
|
| 220 |
+
Sakha newspaper corpus Hugging Face dataset ailabykt/sakha-corpus-mono (generator text for Sakha)
|
| 221 |
+
Kazakh handwritten letter sheets https://github.com/Nuray-Sheriyeva/Kazakh_Handwritten_Letter_Dataset (dataset_split_v2;
|
| 222 |
+
read by the RQ2 pixel probe)
|
| 223 |
+
|
| 224 |
+
|
| 225 |
+
7. EDITS MADE FOR THE PACKAGE, AND CONTENT PINS
|
| 226 |
+
|
| 227 |
+
The package was made from the project's files by these edits only: absolute paths were replaced by the placeholders of
|
| 228 |
+
part 3.1; comments and descriptive strings were reworded; the folder scripts/r5_gate was renamed; two output fields
|
| 229 |
+
were renamed (endpoints_confirmed in the verdict written by scripts/r5eval/verdict.py, added_beyond_plan in the set
|
| 230 |
+
registry written by scripts/r5/r5_registry.py); one verdict text of scripts/r5_freeze/dedupe_verdict.py now reads
|
| 231 |
+
"NEEDS MANUAL REVIEW"; and scripts/r5_testpass2/tp2_make_plan.py no longer records the fingerprint of a planning note.
|
| 232 |
+
|
| 233 |
+
Two pins that the code checks at run time were updated to the shipped files, so they match:
|
| 234 |
+
src/r5eval/cards.py (label-rule pin) the content of config_r5eval/r5_descriptive_labels.txt (reworded first line),
|
| 235 |
+
checked by scripts/r5eval/report_cards.py.
|
| 236 |
+
src/r5eval/frozen.py (frozen-file pin) the content of src/r5eval/frozen/postproc_vlma.py (one reworded docstring line;
|
| 237 |
+
scripts/r5_vlma/postproc.py and scripts/r5_vlmb/postproc.py are identical
|
| 238 |
+
copies), checked whenever the scorer is imported.
|
| 239 |
+
|
| 240 |
+
Four pins refer to a file that these edits changed and were left as they were:
|
| 241 |
+
|
| 242 |
+
src/rq2/geom.py pins src/linedet/common.py (paths). Checked at start: the RQ2 wrappers stop
|
| 243 |
+
with "REFUSED". After configuring the paths, put the new fingerprint of
|
| 244 |
+
src/linedet/common.py into PINNED in src/rq2/geom.py. The same table pins
|
| 245 |
+
four kraken files of the installed kraken package and three data files.
|
| 246 |
+
scripts/r5_vlma/make_vlmb_testpass.py pins scripts/r5_vlmb/vlmb_eval_vlm.py (a reworded comment); it is the one-time
|
| 247 |
+
builder of scripts/r5_vlmb/vlmb_eval_vlm_testpass.py, which also quotes that
|
| 248 |
+
fingerprint in a comment.
|
| 249 |
+
scripts/r5_vlma/testpass_config.json quotes the fingerprint of scripts/r5_linedet/test_pass_commands.sh (paths) in a note.
|
| 250 |
+
|
| 251 |
+
All other pins inside the package still match.
|
config_r5eval/arms_info_template.json
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_how_to_use": "arms_info.json for select_b1b2.py and report_cards.py. Only list what is known; unique_params_b comes from CODE/scripts/r5_vlma/models_r5.tsv when this file lacks it. flags are free text shown on the card. not_trained_reason: set it when the arm could not be trained (status NOT TRAINED). broken_run_reason: set it when the loss became NaN or infinite or the run ended early for a reason other than the time cap (status BROKEN RUN). final_checkpoint: the checkpoint that counts as final (default: final, leader, long, short in that order). seed2_checkpoint: default <final_checkpoint>_seed2.",
|
| 3 |
+
"paddleocr_vl_1_6": {"unique_params_b": 0.9586, "flags": [], "final_checkpoint": "short"},
|
| 4 |
+
"teleocr": {"not_trained_reason": "example: needs the maker's code and failed the 20-step save-and-resume test"},
|
| 5 |
+
"example_broken": {"broken_run_reason": "example: loss became NaN at step 312"}
|
| 6 |
+
}
|
config_r5eval/endpoints_proposal.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"config_version": "r5-endpoints-1",
|
| 3 |
+
"status": "PROPOSED by EVALCODE on 21 Nov 2026; it is confirmed (confirmed set to true) before the test pass; verdict.json records its sha256",
|
| 4 |
+
"confirmed": false,
|
| 5 |
+
"B": 10000,
|
| 6 |
+
"seed": 20261121,
|
| 7 |
+
"margin": 0.10,
|
| 8 |
+
"T1": {"evalsets": ["kohtd_test"], "P1_group": "all", "P2_group": "slice:P2",
|
| 9 |
+
"note": "P1 = all KOHTD test crops; P2 = the unseen-word slice of clarification G3, computed inside the gated pass from the frozen K_train"},
|
| 10 |
+
"T1_rand": {"evalsets": ["kohtd_rand_test"], "P1_group": "all",
|
| 11 |
+
"note": "test part of the seeded crop-level random 70/15/15 split of KOHTD (amendment 3.3 D5 variant ii); replication check only, never compared with our arms"},
|
| 12 |
+
"T2": {"evalsets": ["print_real_test"], "audited_languages": null,
|
| 13 |
+
"note": "typed non-inferiority (N): the real born-digital line test built by stage PRINT. audited_languages must be filled from PRINT's audit (languages with at least 49 of 50 test lines matching); null makes clauses 3.1.b, 3.3.n, 3.5.n and 4.c not evaluable. Alternative if print_real_test is unusable: synth_typed_test (synthetic lines, exact by construction)."},
|
| 14 |
+
"clutter": {"evalsets": ["synth_clutter_test"], "note": "clutter-only crops for HR1; the registry name may carry a suffix such as ' (T4)': the file stem decides"},
|
| 15 |
+
"validation": {"kohtd_val": ["kohtd_val"], "V1": ["V1", "kohtd_screen_v1"]},
|
| 16 |
+
"reader_only_counts_as_pipeline": false,
|
| 17 |
+
"reader_only_note": "gate G needs the memory of the whole pipeline; if no detector was measured the clause stays not evaluable unless this is set to true",
|
| 18 |
+
"reference_arms": {
|
| 19 |
+
"R1": {"name": "HTR-Flor", "published": {"cer_percent": 6.52, "wer_percent": 24.52, "ser_percent": 26.98, "metric": "HTR-Flor style (lower case, longer-string denominator, mean over crops) probably",
|
| 20 |
+
"source": "Toiganbayeva et al., arXiv 2110.04075v1, p.19 Table 4; records/R5/RESEVAL/sota_table.json"}},
|
| 21 |
+
"R2": {"name": "SVTR-Tiny", "published": {"cer_percent": 4.59, "wer_percent": 20.00, "metric": "CER = (S+I+D)/N; WER = share of wrongly recognised images",
|
| 22 |
+
"source": "Bimurat et al., SDU Bulletin 65(2) 2024, p.11 Table 3 and p.10 section 2.5; records/R5/RESEVAL/sota_table.json"}}
|
| 23 |
+
},
|
| 24 |
+
"seed_convention": "a second seed is a second checkpoint of the same arm named <checkpoint>_seed2 (for example long_seed2, short_seed2, leader_seed2); selection.json roles carry it as seed2_checkpoint. Voted outputs are the checkpoint 'vote' of the arm.",
|
| 25 |
+
"reference_roles": "selection.json roles R1 and R2 (variant i: trained on KOHTD train of our form split, scored on kohtd_test); R1_rand and R2_rand (variant ii: scored on kohtd_rand_test)"
|
| 26 |
+
}
|
config_r5eval/mix_scratch.yaml
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SCRATCH mix used only to time and size-check build_ktrain.py on the real train manifests before mix_v1 is frozen.
|
| 2 |
+
# It is NOT mix_v1 and nothing reads it for training or scoring. Output goes to DATA/tmp/evalcode_ktrain_scratch.
|
| 3 |
+
mix:
|
| 4 |
+
members:
|
| 5 |
+
- {name: kohtd_train, manifest: /path/to/TURKIC_OCR_DATA/data/processed/r5/manifests/kohtd_train.tsv, share: 0.25}
|
| 6 |
+
- {name: hkr_train, manifest: /path/to/TURKIC_OCR_DATA/data/processed/r5/manifests/hkr_train.tsv, share: 0.25}
|
| 7 |
+
- {name: chd_train, manifest: /path/to/TURKIC_OCR_DATA/data/processed/r5/manifests/chd_train.tsv, share: 0.25}
|
| 8 |
+
- {name: school_train, manifest: /path/to/TURKIC_OCR_DATA/data/processed/r5/manifests/school_train.tsv, share: 0.25}
|
config_r5eval/r5_descriptive_labels.txt
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
DESCRIPTIVE LABELS FOR EVERY ARM (R5). Written on 20 Nov 2026, before any arm has trained on mix_v1 and before any validation figure of a fine-tuned arm exists. Fingerprinted in r5_descriptive_labels.sha256.
|
| 2 |
+
|
| 3 |
+
The owner asked (21 Nov) for results that show "what are prosperous models and which ones have failed so far". These labels describe the arms on the pages. They do NOT change the decision rule: B1, B2 and the verdict follow version 3 + 3.1 + 3.2 and its clarifications. The labels use validation data only, at the P_short checkpoint (the equal comparison), with greedy decoding. Every label is stored with the figures that produced it.
|
| 4 |
+
|
| 5 |
+
Exactly one status per arm, checked in this order:
|
| 6 |
+
1. NOT TRAINED: set-up failed within the 3-hour budget, or the 20-step plus save-and-resume test failed. The reason is recorded.
|
| 7 |
+
2. BROKEN RUN: training loss became NaN or infinite, or the run ended early for a reason other than the time cap. The reason is recorded.
|
| 8 |
+
3. NO GAIN: V1 CER at P_short is not lower than the arm's own zero-shot V1 CER (VLM arms that ran in the zero-shot screen only).
|
| 9 |
+
4. FAILS MEMORY GATE: peak torch.cuda.max_memory_reserved above 24 GB when reading one crop at batch 1 (pages come later).
|
| 10 |
+
5. HALLUCINATES: on validation analogues of the veto, HR1 on synth_clutter_val above max(2 x HR1 of A1, HR1 of A1 + 2 points) or above 5% absolute; or HR4 (loops) above 0.1% on V1.
|
| 11 |
+
6. NOT COMPETITIVE: V1 CER more than 1.5 x the lowest V1 CER of any arm at P_short.
|
| 12 |
+
7. COMPETITIVE: V1 CER within 1.5 x the lowest, but not PROMISING.
|
| 13 |
+
8. PROMISING: V1 CER within 10% (relative) of the lowest V1 CER at P_short, or the lowest V1 CER in its size class (line; VLM below 0.5B; 0.5B to 1.5B; above 1.5B).
|
| 14 |
+
LEADER is added to the two arms chosen under amendment 3.2 C4.
|
| 15 |
+
|
| 16 |
+
Language flags (any status): an arm is flagged "weak on <language-script>" when its CER on that language-script, in synth_hand_val, synth_typed_val or print_real_val, is more than 2 x its own macro CER over the language-scripts of that set.
|
| 17 |
+
Learning-curve flag: "still improving" when V1-curve CER fell by more than 10% (relative) between the 75% and the 100% points of P_short. "Plateaued" otherwise.
|
config_r5eval/sota_attestations_template.json
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_how_to_use": "Copy to sota_attestations.json and set holds to true or false for the items that no code can decide. Items the code decides itself (C01-C05, C09-C11, C13-C15) ignore this file. Leave holds null to keep the item 'not evaluable'. Pass the file to verdict.py with --sota-attestations.",
|
| 3 |
+
"C06": {"holds": null, "note": "same decoding rules: greedy for every arm, no language model or lexicon with test text; state what R1 and R2 used"},
|
| 4 |
+
"C07": {"holds": null, "note": "no train-test overlap: DATA dedupe.json, form-disjoint KOHTD split, generator text split by document; scan-named KOHTD crops are a leak risk that was not tested"},
|
| 5 |
+
"C08": {"holds": null, "note": "same or disclosed training data: our arms use mix_v1, R1 and R2 use KOHTD train only; say whether this difference is disclosed in the claim"},
|
| 6 |
+
"C12": {"holds": null, "note": "test labels exact or human-checked: KOHTD test labels are crowd labels agreed by two volunteers"},
|
| 7 |
+
"C16": {"holds": null, "note": "release enough to recompute: prediction files and scorer code; no data release (owner rule)"}
|
| 8 |
+
}
|
config_r5eval/zero_shot_results.tsv
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
model scale complete prompt_source version_revision params_unique gpu crops_done crops_in_list cer_pooled cer_mean cer_mean_cap1 exact_match hr2_ins_per_ref_char hr3_share_refs_ge5 hr4_loop_share empty_share other_script_share ref_other_script_share cer_pooled_casefold exact_casefold hit_cap_share mean_image_tokens crops_per_s_H100_not_5090 crops_per_s_excl_first_batch_H100_not_5090 crops_per_s_median_full_batch_H100_not_5090 new_tokens_per_s_H100_not_5090 disk_read_s_per_crop peak_gpu_mem_GiB_H100_not_5090 batch_size job_ids errors bad_lines best_of_scales_pooled_cer scales_finished
|
| 2 |
+
glm_ocr 1 yes card 2e85a62840ccac27daa451df36c736c4636b8628 1107405824 NVIDIA H100 80GB HBM3 3678 3678 1.0695 1.1055 0.9299 0.0087 0.1804 0.4040 0.0041 0.0005 0.0285 0.0000 1.0662 0.0103 0.0033 15.3896 21.5245 22.4950 112.0448 105.6901 0.0012 3.5272 16 50781,50801 0 0 1.0617 1,2,3
|
| 3 |
+
glm_ocr 2 yes card 2e85a62840ccac27daa451df36c736c4636b8628 1107405824 NVIDIA H100 80GB HBM3 3678 3678 1.0617 1.0910 0.9336 0.0079 0.1727 0.4476 0.0005 0.0000 0.0302 0.0000 1.0584 0.0084 0.0005 53.6555 10.8193 11.1040 83.0306 50.6867 0.0013 7.7812 16 50781,50801 0 0 1.0617 1,2,3
|
| 4 |
+
glm_ocr 3 yes card 2e85a62840ccac27daa451df36c736c4636b8628 1107405824 NVIDIA H100 80GB HBM3 3678 3678 1.0871 1.1143 0.9365 0.0073 0.1923 0.4707 0.0011 0.0000 0.0272 0.0000 1.0835 0.0079 0.0011 120.5541 6.8569 6.9783 17.1196 32.1086 0.0029 13.2988 16 50781,50801 0 0 1.0617 1,2,3
|
| 5 |
+
granite_docling_258m 1 yes nearest documented (page prompt) 982fe3b40f2fa73c365bdb1bcacf6c81b7184bfe 257517120 NVIDIA H100 80GB HBM3 3678 3678 1.5829 1.6734 0.9950 0.0005 0.5978 0.5311 0.0182 0.3051 0.0030 0.0000 1.5825 0.0005 0.0791 576.6264 3.7770 3.8776 4.2015 134.0745 0.0014 6.0687 16 50779,50799 0 0 1.5322 1,2,3
|
| 6 |
+
granite_docling_258m 2 yes nearest documented (page prompt) 982fe3b40f2fa73c365bdb1bcacf6c81b7184bfe 257517120 NVIDIA H100 80GB HBM3 3678 3678 1.5322 1.6323 0.9951 0.0005 0.5474 0.5274 0.0160 0.3105 0.0030 0.0000 1.5318 0.0005 0.0704 576.6264 3.8111 3.9132 4.2785 134.4285 0.0014 6.0687 16 50779,50799 0 0 1.5322 1,2,3
|
| 7 |
+
granite_docling_258m 3 yes nearest documented (page prompt) 982fe3b40f2fa73c365bdb1bcacf6c81b7184bfe 257517120 NVIDIA H100 80GB HBM3 3678 3678 1.5553 1.6548 0.9948 0.0005 0.5702 0.5311 0.0155 0.3048 0.0027 0.0000 1.5566 0.0005 0.0721 576.6264 3.7484 3.8470 4.2363 132.7906 0.0020 6.0687 16 50779,50799 0 0 1.5322 1,2,3
|
| 8 |
+
hunyuanocr 1 yes card 47644ecc4fc854efa4f505155158831f36773ee4 996208112 NVIDIA H100 80GB HBM3 3678 3678 1.0890 1.0995 0.9842 0.0068 0.1066 0.4018 0.0000 0.0003 0.0038 0.0000 1.0889 0.0071 0.0000 287.2526 5.5095 5.5792 5.6180 51.0710 0.0006 3.4244 16 50780,50800 0 0 1.0890 1,2,3
|
| 9 |
+
hunyuanocr 2 yes card 47644ecc4fc854efa4f505155158831f36773ee4 996208112 NVIDIA H100 80GB HBM3 3678 3678 1.0900 1.1024 0.9844 0.0071 0.1075 0.3988 0.0000 0.0003 0.0038 0.0000 1.0899 0.0073 0.0000 287.9182 5.1241 5.1864 5.1556 47.5250 0.0014 7.7323 16 50780,50800 0 0 1.0890 1,2,3
|
| 10 |
+
hunyuanocr 3 yes card 47644ecc4fc854efa4f505155158831f36773ee4 996208112 NVIDIA H100 80GB HBM3 3678 3678 1.0896 1.1001 0.9847 0.0068 0.1068 0.3973 0.0000 0.0003 0.0044 0.0000 1.0895 0.0071 0.0000 290.6381 4.0917 4.1287 4.6459 37.8253 0.0020 14.7718 16 50780,50800 0 0 1.0890 1,2,3
|
| 11 |
+
lightonocr_3_0_8b 1 yes card 36d8636925327c671bd8e479c517a004f7566bd9 852985920 NVIDIA H100 80GB HBM3 3678 3678 5.5027 9.6069 0.8769 0.0120 4.6944 0.3504 0.0022 0.0003 0.0060 0.0000 5.4972 0.0128 0.1721 73.8494 6.1216 6.6146 8.6026 78.2636 0.0006 2.9552 16 50779,50799 0 0 5.5027 1,2,3
|
| 12 |
+
lightonocr_3_0_8b 2 yes card 36d8636925327c671bd8e479c517a004f7566bd9 852985920 NVIDIA H100 80GB HBM3 3678 3678 6.1313 10.5883 0.8845 0.0114 5.3166 0.3682 0.0033 0.0005 0.0065 0.0000 6.1260 0.0125 0.1987 77.2308 3.8823 4.0721 8.0104 53.7154 0.0013 6.3925 16 50779,50799 0 0 5.5027 1,2,3
|
| 13 |
+
lightonocr_3_0_8b 3 yes card 36d8636925327c671bd8e479c517a004f7566bd9 852985920 NVIDIA H100 80GB HBM3 3678 3678 6.6171 10.9027 0.8866 0.0117 5.8011 0.3873 0.0014 0.0003 0.0079 0.0000 6.6118 0.0125 0.2197 105.7569 2.2981 2.3636 4.6470 33.5795 0.0020 12.0682 16 50779,50799 0 0 5.5027 1,2,3
|
| 14 |
+
lightonocr_3_1b 1 yes card 23d544085c886bbdace647bcfab91203299417e2 1005647872 NVIDIA H100 80GB HBM3 3678 3678 7.8892 11.9248 0.9748 0.0019 6.9524 0.5926 0.1123 0.1188 0.0601 0.0000 7.8864 0.0022 0.3184 13.2316 6.9719 7.3915 11.1042 141.8738 0.0005 3.3976 16 50780,50800 0 0 3.8715 1,2,3
|
| 15 |
+
lightonocr_3_1b 2 yes card 23d544085c886bbdace647bcfab91203299417e2 1005647872 NVIDIA H100 80GB HBM3 3678 3678 4.9369 7.6376 0.9733 0.0049 3.9826 0.5043 0.0049 0.0122 0.0386 0.0000 4.9347 0.0052 0.1381 52.3638 5.3593 5.6002 10.9327 64.6920 0.0012 3.6582 16 50780,50800 0 0 3.8715 1,2,3
|
| 16 |
+
lightonocr_3_1b 3 yes card 23d544085c886bbdace647bcfab91203299417e2 1005647872 NVIDIA H100 80GB HBM3 3678 3678 3.8715 6.0153 0.9785 0.0054 2.9091 0.5535 0.0054 0.0046 0.0519 0.0000 3.8701 0.0060 0.1006 117.6011 4.3636 4.5199 10.3520 46.2122 0.0020 4.1474 16 50780,50800 0 0 3.8715 1,2,3
|
| 17 |
+
minicpm_ocr_1_0 1 yes card 883ca368d17335b9ce5aa6fef4d000ef0684fcaa 1300434160 NVIDIA H100 80GB HBM3 3678 3678 1.0792 1.1094 0.9665 0.0087 0.1267 0.4324 0.0000 0.0000 0.0150 0.0000 1.0789 0.0092 0.0000 255.2675 5.2258 5.3106 5.1470 23.3772 0.0007 14.6410 16 50781,50801 0 0 1.0761 1,2,3
|
| 18 |
+
minicpm_ocr_1_0 2 yes card 883ca368d17335b9ce5aa6fef4d000ef0684fcaa 1300434160 NVIDIA H100 80GB HBM3 3678 3678 1.0761 1.1065 0.9658 0.0087 0.1241 0.4178 0.0000 0.0000 0.0131 0.0000 1.0757 0.0092 0.0000 258.2303 4.5423 4.5936 4.9869 20.2609 0.0014 20.3590 16 50781,50801 0 0 1.0761 1,2,3
|
| 19 |
+
minicpm_ocr_1_0 3 yes card 883ca368d17335b9ce5aa6fef4d000ef0684fcaa 1300434160 NVIDIA H100 80GB HBM3 3678 3678 1.0776 1.1074 0.9657 0.0087 0.1257 0.4245 0.0000 0.0000 0.0131 0.0000 1.0772 0.0092 0.0000 301.9706 3.1926 3.2181 3.8247 14.2090 0.0026 20.3592 16 50781,50801 0 0 1.0761 1,2,3
|
| 20 |
+
ovisocr2 1 yes nearest documented (page prompt) cbdede82e048659b83310476ff807da825f8fe78 852985920 NVIDIA H100 80GB HBM3 3678 3678 1.0779 1.0876 0.9786 0.0071 0.1032 0.2836 0.0038 0.0000 0.0060 0.0000 1.0770 0.0071 0.0038 212.6718 18.4014 19.4534 48.0192 109.6891 0.0006 3.5022 16 50779,50799 0 0 1.0779 1,2,3
|
| 21 |
+
ovisocr2 2 yes nearest documented (page prompt) cbdede82e048659b83310476ff807da825f8fe78 852985920 NVIDIA H100 80GB HBM3 3678 3678 1.0840 1.0951 0.9793 0.0065 0.1091 0.2941 0.0046 0.0000 0.0063 0.0000 1.0833 0.0068 0.0046 213.4038 15.3536 16.0665 46.2161 91.6371 0.0013 7.2218 16 50779,50799 0 0 1.0779 1,2,3
|
| 22 |
+
ovisocr2 3 yes nearest documented (page prompt) cbdede82e048659b83310476ff807da825f8fe78 852985920 NVIDIA H100 80GB HBM3 3678 3678 1.0843 1.0949 0.9798 0.0063 0.1087 0.2941 0.0049 0.0000 0.0063 0.0000 1.0835 0.0065 0.0046 217.8059 6.9907 7.1324 40.3735 41.0137 0.0020 13.3416 16 50779,50799 0 0 1.0779 1,2,3
|
| 23 |
+
paddleocr_vl_1_6 1 yes card 132c45f52c0a26ed5a6b2f6bd8e3985794cc27dd 905601648 NVIDIA H100 80GB HBM3 3678 3678 1.2003 1.2259 0.9811 0.0076 0.2257 0.5650 0.0005 0.0000 0.0402 0.0000 1.2005 0.0079 0.0003 158.6142 32.1315 34.3730 94.3953 155.1345 0.0014 2.2374 16 50780,50800 0 0 1.2003 1,2,3
|
| 24 |
+
paddleocr_vl_1_6 2 yes card 132c45f52c0a26ed5a6b2f6bd8e3985794cc27dd 905601648 NVIDIA H100 80GB HBM3 3678 3678 1.2193 1.2460 0.9813 0.0073 0.2451 0.5818 0.0014 0.0000 0.0372 0.0000 1.2195 0.0076 0.0005 159.9478 15.0712 15.6913 88.8889 71.7253 0.0012 2.3305 16 50780,50800 0 0 1.2003 1,2,3
|
| 25 |
+
paddleocr_vl_1_6 3 yes card 132c45f52c0a26ed5a6b2f6bd8e3985794cc27dd 905601648 NVIDIA H100 80GB HBM3 3678 3678 1.2248 1.2467 0.9816 0.0073 0.2482 0.5885 0.0016 0.0000 0.0411 0.0000 1.2247 0.0076 0.0014 176.7662 7.6205 7.7506 52.1173 36.1534 0.0020 2.4528 16 50780,50800 0 0 1.2003 1,2,3
|
| 26 |
+
qwen3_vl_2b 1 yes J2 departure (not from the card) 89644892e4d85e24eaac8bacfd4f463576704203 2127532032 NVIDIA H100 80GB HBM3 3678 3678 0.6027 0.6346 0.5880 0.0734 0.1114 0.0619 0.0016 0.0000 0.0054 0.0000 0.5894 0.0816 0.0016 73.8494 28.3111 30.6432 68.9953 156.7720 0.0007 5.6108 16 50781,50801 0 0 0.6027 1,2,3
|
| 27 |
+
qwen3_vl_2b 2 yes J2 departure (not from the card) 89644892e4d85e24eaac8bacfd4f463576704203 2127532032 NVIDIA H100 80GB HBM3 3678 3678 0.6064 0.6409 0.5951 0.0726 0.1123 0.0652 0.0016 0.0000 0.0063 0.0000 0.5920 0.0805 0.0016 77.2308 13.3094 13.8036 67.4821 72.9700 0.0014 10.4457 16 50781,50801 0 0 0.6027 1,2,3
|
| 28 |
+
qwen3_vl_2b 3 yes J2 departure (not from the card) 89644892e4d85e24eaac8bacfd4f463576704203 2127532032 NVIDIA H100 80GB HBM3 3678 3678 0.6194 0.6500 0.6020 0.0696 0.1152 0.0727 0.0019 0.0000 0.0060 0.0000 0.6045 0.0767 0.0019 105.7569 7.4065 7.5396 21.3875 40.7017 0.0020 18.4164 16 50781,50801 0 0 0.6027 1,2,3
|
environments/venv.requirements
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# environment .venv, Python 3.12.13; package list from 'uv pip freeze' on 2026-11-26
|
| 2 |
+
contourpy==1.4.0
|
| 3 |
+
cuda-bindings==12.9.7
|
| 4 |
+
cuda-pathfinder==1.6.0
|
| 5 |
+
cuda-toolkit==12.8.1
|
| 6 |
+
cycler==0.12.1
|
| 7 |
+
filelock==4.2.4
|
| 8 |
+
fonttools==4.68.0
|
| 9 |
+
fsspec==2026.9.0
|
| 10 |
+
jinja2==3.1.6
|
| 11 |
+
kiwisolver==1.5.1
|
| 12 |
+
markupsafe==3.0.3
|
| 13 |
+
matplotlib==3.11.2
|
| 14 |
+
mpmath==1.3.0
|
| 15 |
+
networkx==3.7
|
| 16 |
+
numpy==2.5.4
|
| 17 |
+
nvidia-cublas-cu12==12.8.4.1
|
| 18 |
+
nvidia-cuda-cupti-cu12==12.8.90
|
| 19 |
+
nvidia-cuda-nvrtc-cu12==12.8.93
|
| 20 |
+
nvidia-cuda-runtime-cu12==12.8.90
|
| 21 |
+
nvidia-cudnn-cu12==9.19.0.56
|
| 22 |
+
nvidia-cufft-cu12==11.3.3.83
|
| 23 |
+
nvidia-cufile-cu12==1.13.1.3
|
| 24 |
+
nvidia-curand-cu12==10.3.9.90
|
| 25 |
+
nvidia-cusolver-cu12==11.7.3.90
|
| 26 |
+
nvidia-cusparse-cu12==12.5.8.93
|
| 27 |
+
nvidia-cusparselt-cu12==0.7.1
|
| 28 |
+
nvidia-nccl-cu12==2.28.9
|
| 29 |
+
nvidia-nvjitlink-cu12==12.8.93
|
| 30 |
+
nvidia-nvshmem-cu12==3.4.5
|
| 31 |
+
nvidia-nvtx-cu12==12.8.90
|
| 32 |
+
opencv-python-headless==5.1.0.95
|
| 33 |
+
packaging==26.3
|
| 34 |
+
pandas==3.1.1
|
| 35 |
+
pillow==13.0.0
|
| 36 |
+
pyarrow==26.0.1
|
| 37 |
+
pyparsing==3.3.3
|
| 38 |
+
python-dateutil==4.0.0
|
| 39 |
+
setuptools==78.1.0
|
| 40 |
+
sympy==1.14.0
|
| 41 |
+
torch==2.11.0+cu128
|
| 42 |
+
torchvision==0.26.0+cu128
|
| 43 |
+
triton==3.6.0
|
| 44 |
+
typing-extensions==4.16.0
|
| 45 |
+
tzdata==2026.6
|
environments/venv_dl.requirements
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# environment .venv_dl, Python 3.12.13; package list from 'uv pip freeze' on 2026-11-26
|
| 2 |
+
anyio==4.16.0
|
| 3 |
+
backports-zstd==1.8.0
|
| 4 |
+
beautifulsoup4==4.15.0
|
| 5 |
+
brotli==1.2.1
|
| 6 |
+
certifi==2026.10.23
|
| 7 |
+
cffi==2.1.1
|
| 8 |
+
charset-normalizer==3.5.2
|
| 9 |
+
click==8.5.1
|
| 10 |
+
filelock==4.2.12
|
| 11 |
+
fsspec==2026.9.0
|
| 12 |
+
gdown==6.5.1
|
| 13 |
+
h11==0.16.0
|
| 14 |
+
hf-xet==1.8.0
|
| 15 |
+
httpcore2==2.16.2
|
| 16 |
+
httpx2==2.16.2
|
| 17 |
+
huggingface-hub==2.4.0
|
| 18 |
+
idna==3.20
|
| 19 |
+
inflate64==1.0.4
|
| 20 |
+
libarchive-c==5.3
|
| 21 |
+
multivolumefile==0.2.3
|
| 22 |
+
packaging==26.3
|
| 23 |
+
psutil==7.2.2
|
| 24 |
+
py7zr==1.1.4
|
| 25 |
+
pyarrow==26.0.1
|
| 26 |
+
pybcj==1.0.8
|
| 27 |
+
pycparser==3.12
|
| 28 |
+
pycryptodomex==3.24.2
|
| 29 |
+
pyppmd==1.3.1
|
| 30 |
+
pysocks==1.7.1
|
| 31 |
+
pyyaml==6.0.3
|
| 32 |
+
pyzipper==0.4.0
|
| 33 |
+
requests==2.34.2
|
| 34 |
+
soupsieve==4.1.1
|
| 35 |
+
texttable==1.7.3
|
| 36 |
+
tqdm==4.70.1
|
| 37 |
+
truststore==0.10.5
|
| 38 |
+
typing-extensions==4.16.0
|
| 39 |
+
unrar-cffi==0.2.2
|
| 40 |
+
urllib3==2.8.0
|
environments/venv_gen.requirements
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# environment .venv_gen, Python 3.12.13; package list from 'uv pip freeze' on 2026-11-26
|
| 2 |
+
anyio==4.16.0
|
| 3 |
+
click==8.5.1
|
| 4 |
+
contourpy==1.4.0
|
| 5 |
+
cycler==0.12.1
|
| 6 |
+
filelock==4.2.12
|
| 7 |
+
fonttools==4.68.0
|
| 8 |
+
fsspec==2026.9.0
|
| 9 |
+
h11==0.16.0
|
| 10 |
+
hf-xet==1.8.0
|
| 11 |
+
httpcore2==2.16.2
|
| 12 |
+
httpx2==2.16.2
|
| 13 |
+
huggingface-hub==2.4.0
|
| 14 |
+
idna==3.20
|
| 15 |
+
kiwisolver==1.5.1
|
| 16 |
+
matplotlib==3.11.2
|
| 17 |
+
numpy==2.5.5
|
| 18 |
+
opencv-python-headless==5.1.0.95
|
| 19 |
+
packaging==26.3
|
| 20 |
+
pillow==13.0.0
|
| 21 |
+
pyarrow==26.0.1
|
| 22 |
+
pyparsing==3.3.3
|
| 23 |
+
python-dateutil==4.0.0
|
| 24 |
+
pyyaml==6.0.3
|
| 25 |
+
rdkit==2026.9.2
|
| 26 |
+
schemdraw==0.23
|
| 27 |
+
scipy==1.18.1
|
| 28 |
+
tqdm==4.70.1
|
| 29 |
+
truststore==0.10.5
|
| 30 |
+
typing-extensions==4.16.0
|
| 31 |
+
tzdata==2026.6
|
environments/venv_kraken.requirements
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# environment .venv_kraken, Python 3.12.13; package list from 'uv pip freeze' on 2026-11-26
|
| 2 |
+
aiohappyeyeballs==2.7.1
|
| 3 |
+
aiohttp==3.14.5
|
| 4 |
+
aiosignal==1.4.0
|
| 5 |
+
anyio==4.16.0
|
| 6 |
+
atpublic==9.0.0
|
| 7 |
+
attrs==26.1.0
|
| 8 |
+
cattrs==26.2.1
|
| 9 |
+
certifi==2026.10.23
|
| 10 |
+
charset-normalizer==3.5.2
|
| 11 |
+
click==8.2.1
|
| 12 |
+
cloudpickle==3.1.3
|
| 13 |
+
contourpy==1.4.0
|
| 14 |
+
coremltools==9.0
|
| 15 |
+
cuda-bindings==12.9.7
|
| 16 |
+
cuda-pathfinder==1.6.0
|
| 17 |
+
cuda-toolkit==12.8.1
|
| 18 |
+
cycler==0.12.1
|
| 19 |
+
filelock==4.2.4
|
| 20 |
+
flufl-lock==10.0.0
|
| 21 |
+
fonttools==4.68.0
|
| 22 |
+
frozenlist==1.8.0
|
| 23 |
+
fsspec==2026.9.0
|
| 24 |
+
h11==0.16.0
|
| 25 |
+
htrmopo==0.6
|
| 26 |
+
httpcore==1.0.9
|
| 27 |
+
httpx==0.28.1
|
| 28 |
+
idna==3.20
|
| 29 |
+
imageio==2.38.2
|
| 30 |
+
iso639-lang==2.6.3
|
| 31 |
+
jinja2==3.1.6
|
| 32 |
+
joblib==1.6.0
|
| 33 |
+
jsonschema==4.26.0
|
| 34 |
+
jsonschema-specifications==2025.9.1
|
| 35 |
+
kenlm==0.3.0
|
| 36 |
+
kiwisolver==1.5.1
|
| 37 |
+
kraken==7.2
|
| 38 |
+
lazy-loader==0.6
|
| 39 |
+
lightning==2.6.6
|
| 40 |
+
lightning-utilities==0.15.3
|
| 41 |
+
lxml==6.1.3
|
| 42 |
+
markdown==3.11.3
|
| 43 |
+
markdown-it-py==4.3.0
|
| 44 |
+
markupsafe==3.0.3
|
| 45 |
+
matplotlib==3.11.2
|
| 46 |
+
mdurl==0.1.2
|
| 47 |
+
mpmath==1.3.0
|
| 48 |
+
multidict==7.2.1
|
| 49 |
+
networkx==3.7
|
| 50 |
+
numpy==2.4.6
|
| 51 |
+
nvidia-cublas-cu12==12.8.4.1
|
| 52 |
+
nvidia-cuda-cupti-cu12==12.8.90
|
| 53 |
+
nvidia-cuda-nvrtc-cu12==12.8.93
|
| 54 |
+
nvidia-cuda-runtime-cu12==12.8.90
|
| 55 |
+
nvidia-cudnn-cu12==9.19.0.56
|
| 56 |
+
nvidia-cufft-cu12==11.3.3.83
|
| 57 |
+
nvidia-cufile-cu12==1.13.1.3
|
| 58 |
+
nvidia-curand-cu12==10.3.9.90
|
| 59 |
+
nvidia-cusolver-cu12==11.7.3.90
|
| 60 |
+
nvidia-cusparse-cu12==12.5.8.93
|
| 61 |
+
nvidia-cusparselt-cu12==0.7.1
|
| 62 |
+
nvidia-ml-py==13.615.71
|
| 63 |
+
nvidia-nccl-cu12==2.28.9
|
| 64 |
+
nvidia-nvjitlink-cu12==12.8.93
|
| 65 |
+
nvidia-nvshmem-cu12==3.4.5
|
| 66 |
+
nvidia-nvtx-cu12==12.8.90
|
| 67 |
+
opencv-python==5.1.0.95
|
| 68 |
+
packaging==26.3
|
| 69 |
+
pillow==13.0.0
|
| 70 |
+
platformdirs==4.14.8
|
| 71 |
+
polars==2.1.0
|
| 72 |
+
polars-runtime-32==2.1.0
|
| 73 |
+
propcache==0.5.4
|
| 74 |
+
protobuf==7.36.2
|
| 75 |
+
psutil==7.2.2
|
| 76 |
+
pyaml==26.7.0
|
| 77 |
+
pyarrow==26.0.1
|
| 78 |
+
pygments==2.21.0
|
| 79 |
+
pyparsing==3.3.3
|
| 80 |
+
python-dateutil==4.0.0
|
| 81 |
+
pytorch-lightning==2.6.6
|
| 82 |
+
pyyaml==6.0.3
|
| 83 |
+
rapidfuzz==3.14.6
|
| 84 |
+
referencing==0.37.0
|
| 85 |
+
regex==2026.11.19
|
| 86 |
+
requests==2.34.2
|
| 87 |
+
rich==14.0.0
|
| 88 |
+
rpds-py==2026.9.1
|
| 89 |
+
safetensors==0.7.0
|
| 90 |
+
scikit-image==0.26.0
|
| 91 |
+
scikit-learn==1.7.2
|
| 92 |
+
scipy==1.16.3
|
| 93 |
+
setuptools==78.1.0
|
| 94 |
+
shapely==2.1.2
|
| 95 |
+
sickle==0.7.0
|
| 96 |
+
sympy==1.14.0
|
| 97 |
+
threadpoolctl==3.6.0
|
| 98 |
+
tifffile==2026.11.16
|
| 99 |
+
torch==2.11.0+cu128
|
| 100 |
+
torchmetrics==1.9.0
|
| 101 |
+
torchvision==0.26.0+cu128
|
| 102 |
+
tqdm==4.70.1
|
| 103 |
+
triton==3.6.0
|
| 104 |
+
typing-extensions==4.16.0
|
| 105 |
+
tzdata==2026.6
|
| 106 |
+
ultralytics==8.4.216
|
| 107 |
+
ultralytics-platform==0.1.119
|
| 108 |
+
ultralytics-thop==2.2.5
|
| 109 |
+
urllib3==2.8.0
|
| 110 |
+
yarl==1.25.1
|
environments/venv_print.requirements
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# environment .venv_print, Python 3.12.13; package list from 'uv pip freeze' on 2026-11-26
|
| 2 |
+
anyio==4.16.0
|
| 3 |
+
certifi==2026.10.23
|
| 4 |
+
charset-normalizer==3.5.2
|
| 5 |
+
click==8.5.1
|
| 6 |
+
filelock==4.2.12
|
| 7 |
+
flatbuffers==25.12.19
|
| 8 |
+
fsspec==2026.9.0
|
| 9 |
+
h11==0.16.0
|
| 10 |
+
hf-xet==1.8.0
|
| 11 |
+
httpcore2==2.16.2
|
| 12 |
+
httpx2==2.16.2
|
| 13 |
+
huggingface-hub==2.4.0
|
| 14 |
+
idna==3.20
|
| 15 |
+
networkx==3.7
|
| 16 |
+
numpy==2.5.5
|
| 17 |
+
onnxruntime==1.32.0
|
| 18 |
+
packaging==26.3
|
| 19 |
+
pillow==13.0.0
|
| 20 |
+
protobuf==7.36.2
|
| 21 |
+
psutil==7.2.2
|
| 22 |
+
pyarrow==26.0.1
|
| 23 |
+
pymupdf==2.1
|
| 24 |
+
pymupdf-layout==2.1
|
| 25 |
+
pymupdf4llm==2.1
|
| 26 |
+
pyyaml==6.0.3
|
| 27 |
+
requests==2.34.2
|
| 28 |
+
tabulate==0.10.0
|
| 29 |
+
tqdm==4.70.1
|
| 30 |
+
truststore==0.10.5
|
| 31 |
+
typing-extensions==4.16.0
|
| 32 |
+
urllib3==2.8.0
|
environments/venv_ref_paddle.requirements
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# environment .venv_ref_paddle, Python 3.11.15; package list from 'uv pip freeze' on 2026-11-26
|
| 2 |
+
albucore==0.0.24
|
| 3 |
+
albumentations==2.0.8
|
| 4 |
+
annotated-types==0.8.0
|
| 5 |
+
anyio==4.16.0
|
| 6 |
+
astor==0.8.1
|
| 7 |
+
certifi==2026.11.20
|
| 8 |
+
charset-normalizer==3.5.2
|
| 9 |
+
cython==3.3.1
|
| 10 |
+
decorator==5.3.1
|
| 11 |
+
editdistance==0.8.1
|
| 12 |
+
h11==0.16.0
|
| 13 |
+
httpcore==1.0.9
|
| 14 |
+
httpx==0.28.1
|
| 15 |
+
idna==3.20
|
| 16 |
+
imageio==2.38.2
|
| 17 |
+
lazy-loader==0.6
|
| 18 |
+
lmdb==3.0.0
|
| 19 |
+
networkx==3.6.1
|
| 20 |
+
numpy==1.26.4
|
| 21 |
+
nvidia-cublas-cu12==12.6.4.1
|
| 22 |
+
nvidia-cuda-cupti-cu12==12.6.80
|
| 23 |
+
nvidia-cuda-nvrtc-cu12==12.6.77
|
| 24 |
+
nvidia-cuda-runtime-cu12==12.6.77
|
| 25 |
+
nvidia-cudnn-cu12==9.5.1.17
|
| 26 |
+
nvidia-cufft-cu12==11.3.0.4
|
| 27 |
+
nvidia-cufile-cu12==1.11.1.6
|
| 28 |
+
nvidia-curand-cu12==10.3.7.77
|
| 29 |
+
nvidia-cusolver-cu12==11.7.1.2
|
| 30 |
+
nvidia-cusparse-cu12==12.5.4.2
|
| 31 |
+
nvidia-cusparselt-cu12==0.6.3
|
| 32 |
+
nvidia-nccl-cu12==2.25.1
|
| 33 |
+
nvidia-nvjitlink-cu12==12.6.85
|
| 34 |
+
nvidia-nvtx-cu12==12.6.77
|
| 35 |
+
opencv-python-headless==4.11.0.86
|
| 36 |
+
opt-einsum==3.3.0
|
| 37 |
+
packaging==26.3
|
| 38 |
+
paddlepaddle-gpu==3.0.0
|
| 39 |
+
pillow==13.0.0
|
| 40 |
+
protobuf==7.36.2
|
| 41 |
+
pyclipper==1.4.0
|
| 42 |
+
pydantic==2.14.4
|
| 43 |
+
pydantic-core==2.50.5
|
| 44 |
+
pyyaml==6.0.4
|
| 45 |
+
rapidfuzz==3.14.6
|
| 46 |
+
requests==2.34.2
|
| 47 |
+
scikit-image==0.26.0
|
| 48 |
+
scipy==1.17.1
|
| 49 |
+
setuptools==84.2.1
|
| 50 |
+
shapely==2.2.0
|
| 51 |
+
simsimd==6.5.16
|
| 52 |
+
stringzilla==5.3.2
|
| 53 |
+
tifffile==2026.3.3
|
| 54 |
+
tqdm==4.70.1
|
| 55 |
+
typing-extensions==4.16.0
|
| 56 |
+
typing-inspection==0.4.5
|
| 57 |
+
urllib3==2.8.0
|
environments/venv_ref_paddle_cpu.requirements
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# environment .venv_ref_paddle_cpu, Python 3.11.15; package list from 'uv pip freeze' on 2026-11-26
|
| 2 |
+
albucore==0.0.24
|
| 3 |
+
albumentations==2.0.8
|
| 4 |
+
annotated-types==0.8.0
|
| 5 |
+
anyio==4.16.0
|
| 6 |
+
astor==0.8.1
|
| 7 |
+
certifi==2026.11.20
|
| 8 |
+
charset-normalizer==3.5.2
|
| 9 |
+
cython==3.3.1
|
| 10 |
+
decorator==5.3.1
|
| 11 |
+
editdistance==0.8.1
|
| 12 |
+
h11==0.16.0
|
| 13 |
+
httpcore==1.0.9
|
| 14 |
+
httpx==0.28.1
|
| 15 |
+
idna==3.20
|
| 16 |
+
imageio==2.38.2
|
| 17 |
+
lazy-loader==0.6
|
| 18 |
+
lmdb==3.0.0
|
| 19 |
+
networkx==3.6.1
|
| 20 |
+
numpy==1.26.4
|
| 21 |
+
opencv-python-headless==4.11.0.86
|
| 22 |
+
opt-einsum==3.3.0
|
| 23 |
+
packaging==26.3
|
| 24 |
+
paddlepaddle==3.0.0
|
| 25 |
+
pillow==13.0.0
|
| 26 |
+
protobuf==7.36.2
|
| 27 |
+
pyclipper==1.4.0
|
| 28 |
+
pydantic==2.14.4
|
| 29 |
+
pydantic-core==2.50.5
|
| 30 |
+
pyyaml==6.0.4
|
| 31 |
+
rapidfuzz==3.14.6
|
| 32 |
+
requests==2.34.2
|
| 33 |
+
scikit-image==0.26.0
|
| 34 |
+
scipy==1.17.1
|
| 35 |
+
setuptools==84.2.1
|
| 36 |
+
shapely==2.2.0
|
| 37 |
+
simsimd==6.5.16
|
| 38 |
+
stringzilla==5.3.2
|
| 39 |
+
tifffile==2026.3.3
|
| 40 |
+
tqdm==4.70.1
|
| 41 |
+
typing-extensions==4.16.0
|
| 42 |
+
typing-inspection==0.4.5
|
| 43 |
+
urllib3==2.8.0
|
environments/venv_ref_tf.requirements
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# environment .venv_ref_tf, Python 3.11.15; package list from 'uv pip freeze' on 2026-11-26
|
| 2 |
+
absl-py==2.5.1
|
| 3 |
+
astunparse==1.6.3
|
| 4 |
+
certifi==2026.11.20
|
| 5 |
+
cffi==2.1.1
|
| 6 |
+
charset-normalizer==3.5.2
|
| 7 |
+
cryptography==50.0.2
|
| 8 |
+
editdistance==0.8.1
|
| 9 |
+
flatbuffers==25.12.19
|
| 10 |
+
gast==0.7.0
|
| 11 |
+
google-auth==2.63.0
|
| 12 |
+
google-auth-oauthlib==1.5.0
|
| 13 |
+
google-pasta==0.2.0
|
| 14 |
+
grpcio==1.85.3
|
| 15 |
+
h5py==3.16.0
|
| 16 |
+
idna==3.20
|
| 17 |
+
keras==2.15.0
|
| 18 |
+
libclang==18.1.1
|
| 19 |
+
markdown==3.11.3
|
| 20 |
+
markupsafe==3.0.4
|
| 21 |
+
ml-dtypes==0.3.2
|
| 22 |
+
numpy==1.26.4
|
| 23 |
+
nvidia-cublas-cu12==12.2.5.6
|
| 24 |
+
nvidia-cuda-cupti-cu12==12.2.142
|
| 25 |
+
nvidia-cuda-nvcc-cu12==12.2.140
|
| 26 |
+
nvidia-cuda-nvrtc-cu12==12.2.140
|
| 27 |
+
nvidia-cuda-runtime-cu12==12.2.140
|
| 28 |
+
nvidia-cudnn-cu12==8.9.4.25
|
| 29 |
+
nvidia-cufft-cu12==11.0.8.103
|
| 30 |
+
nvidia-curand-cu12==10.3.3.141
|
| 31 |
+
nvidia-cusolver-cu12==11.5.2.141
|
| 32 |
+
nvidia-cusparse-cu12==12.1.2.141
|
| 33 |
+
nvidia-nccl-cu12==2.16.5
|
| 34 |
+
nvidia-nvjitlink-cu12==12.2.140
|
| 35 |
+
oauthlib==4.0.1
|
| 36 |
+
opencv-python-headless==4.11.0.86
|
| 37 |
+
opt-einsum==3.4.0
|
| 38 |
+
packaging==26.3
|
| 39 |
+
protobuf==4.25.9
|
| 40 |
+
pyasn1==0.6.5
|
| 41 |
+
pyasn1-modules==0.4.2
|
| 42 |
+
pycparser==3.12
|
| 43 |
+
requests==2.34.2
|
| 44 |
+
requests-oauthlib==2.0.0
|
| 45 |
+
setuptools==84.2.1
|
| 46 |
+
six==1.17.0
|
| 47 |
+
tensorboard==2.15.2
|
| 48 |
+
tensorboard-data-server==0.7.2
|
| 49 |
+
tensorflow==2.15.1
|
| 50 |
+
tensorflow-estimator==2.15.0
|
| 51 |
+
tensorflow-io-gcs-filesystem==0.37.1
|
| 52 |
+
termcolor==3.3.0
|
| 53 |
+
tqdm==4.70.1
|
| 54 |
+
typing-extensions==4.16.0
|
| 55 |
+
urllib3==2.8.0
|
| 56 |
+
werkzeug==3.1.9
|
| 57 |
+
wheel==0.48.0
|
| 58 |
+
wrapt==1.14.2
|
environments/venv_vlm.requirements
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# environment .venv_vlm, Python 3.12.13; package list from 'uv pip freeze' on 2026-11-26
|
| 2 |
+
accelerate==1.16.0
|
| 3 |
+
annotated-doc==0.0.7
|
| 4 |
+
annotated-types==0.8.0
|
| 5 |
+
anyio==4.16.0
|
| 6 |
+
click==8.5.1
|
| 7 |
+
cuda-bindings==12.9.7
|
| 8 |
+
cuda-pathfinder==1.6.0
|
| 9 |
+
cuda-toolkit==12.8.1
|
| 10 |
+
filelock==4.2.4
|
| 11 |
+
fsspec==2026.9.0
|
| 12 |
+
h11==0.16.0
|
| 13 |
+
hf-xet==1.8.0
|
| 14 |
+
httpcore2==2.16.2
|
| 15 |
+
httpx2==2.16.2
|
| 16 |
+
huggingface-hub==2.4.0
|
| 17 |
+
idna==3.20
|
| 18 |
+
jinja2==3.1.6
|
| 19 |
+
markdown-it-py==4.3.0
|
| 20 |
+
markupsafe==3.0.3
|
| 21 |
+
mdurl==0.1.2
|
| 22 |
+
mpmath==1.3.0
|
| 23 |
+
networkx==3.7
|
| 24 |
+
numpy==2.5.4
|
| 25 |
+
nvidia-cublas-cu12==12.8.4.1
|
| 26 |
+
nvidia-cuda-cupti-cu12==12.8.90
|
| 27 |
+
nvidia-cuda-nvrtc-cu12==12.8.93
|
| 28 |
+
nvidia-cuda-runtime-cu12==12.8.90
|
| 29 |
+
nvidia-cudnn-cu12==9.19.0.56
|
| 30 |
+
nvidia-cufft-cu12==11.3.3.83
|
| 31 |
+
nvidia-cufile-cu12==1.13.1.3
|
| 32 |
+
nvidia-curand-cu12==10.3.9.90
|
| 33 |
+
nvidia-cusolver-cu12==11.7.3.90
|
| 34 |
+
nvidia-cusparse-cu12==12.5.8.93
|
| 35 |
+
nvidia-cusparselt-cu12==0.7.1
|
| 36 |
+
nvidia-nccl-cu12==2.28.9
|
| 37 |
+
nvidia-nvjitlink-cu12==12.8.93
|
| 38 |
+
nvidia-nvshmem-cu12==3.4.5
|
| 39 |
+
nvidia-nvtx-cu12==12.8.90
|
| 40 |
+
packaging==26.3
|
| 41 |
+
pillow==13.0.0
|
| 42 |
+
protobuf==7.36.2
|
| 43 |
+
psutil==7.2.2
|
| 44 |
+
pydantic==2.14.4
|
| 45 |
+
pydantic-core==2.50.5
|
| 46 |
+
pygments==2.21.0
|
| 47 |
+
pyyaml==6.0.3
|
| 48 |
+
regex==2026.11.19
|
| 49 |
+
rich==15.0.0
|
| 50 |
+
safetensors==0.8.0
|
| 51 |
+
sentencepiece==0.2.3
|
| 52 |
+
setuptools==78.1.0
|
| 53 |
+
shellingham==1.5.4
|
| 54 |
+
sympy==1.14.0
|
| 55 |
+
tokenizers==0.23.3
|
| 56 |
+
torch==2.11.0+cu128
|
| 57 |
+
torchvision==0.26.0+cu128
|
| 58 |
+
tqdm==4.70.1
|
| 59 |
+
transformers==5.23.0
|
| 60 |
+
triton==3.6.0
|
| 61 |
+
truststore==0.10.5
|
| 62 |
+
typer==0.29.2
|
| 63 |
+
typing-extensions==4.16.0
|
| 64 |
+
typing-inspection==0.4.5
|
environments/venv_vlm_deepseek_ocr_2.requirements
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# environment .venv_vlm_deepseek_ocr_2, Python 3.12.13; package list from 'uv pip freeze' on 2026-11-26
|
| 2 |
+
accelerate==1.2.1
|
| 3 |
+
addict==2.4.0
|
| 4 |
+
certifi==2026.10.23
|
| 5 |
+
charset-normalizer==3.5.2
|
| 6 |
+
easydict==1.13
|
| 7 |
+
einops==0.8.0
|
| 8 |
+
filelock==4.2.4
|
| 9 |
+
fsspec==2026.9.0
|
| 10 |
+
huggingface-hub==0.26.5
|
| 11 |
+
idna==3.20
|
| 12 |
+
jinja2==3.1.6
|
| 13 |
+
markupsafe==3.0.3
|
| 14 |
+
mpmath==1.3.0
|
| 15 |
+
networkx==3.7
|
| 16 |
+
numpy==1.26.4
|
| 17 |
+
nvidia-cublas-cu12==12.4.5.8
|
| 18 |
+
nvidia-cuda-cupti-cu12==12.4.127
|
| 19 |
+
nvidia-cuda-nvrtc-cu12==12.4.127
|
| 20 |
+
nvidia-cuda-runtime-cu12==12.4.127
|
| 21 |
+
nvidia-cudnn-cu12==9.1.0.70
|
| 22 |
+
nvidia-cufft-cu12==11.2.1.3
|
| 23 |
+
nvidia-curand-cu12==10.3.5.147
|
| 24 |
+
nvidia-cusolver-cu12==11.6.1.9
|
| 25 |
+
nvidia-cusparse-cu12==12.3.1.170
|
| 26 |
+
nvidia-cusparselt-cu12==0.6.2
|
| 27 |
+
nvidia-nccl-cu12==2.21.5
|
| 28 |
+
nvidia-nvjitlink-cu12==12.4.127
|
| 29 |
+
nvidia-nvtx-cu12==12.4.127
|
| 30 |
+
packaging==26.3
|
| 31 |
+
pillow==11.0.0
|
| 32 |
+
psutil==7.2.2
|
| 33 |
+
pyyaml==6.0.3
|
| 34 |
+
regex==2026.11.19
|
| 35 |
+
requests==2.34.2
|
| 36 |
+
safetensors==0.4.5
|
| 37 |
+
setuptools==78.1.0
|
| 38 |
+
sympy==1.13.1
|
| 39 |
+
tokenizers==0.20.3
|
| 40 |
+
torch==2.6.0+cu124
|
| 41 |
+
torchvision==0.21.0+cu124
|
| 42 |
+
tqdm==4.70.1
|
| 43 |
+
transformers==4.46.3
|
| 44 |
+
triton==3.2.0
|
| 45 |
+
typing-extensions==4.16.0
|
| 46 |
+
urllib3==2.8.0
|
environments/venv_vlm_dots_mocr.requirements
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# environment .venv_vlm_dots_mocr, Python 3.12.13; package list from 'uv pip freeze' on 2026-11-26
|
| 2 |
+
accelerate==1.16.0
|
| 3 |
+
annotated-doc==0.0.7
|
| 4 |
+
annotated-types==0.8.0
|
| 5 |
+
anyio==4.16.0
|
| 6 |
+
click==8.5.1
|
| 7 |
+
cuda-bindings==12.9.7
|
| 8 |
+
cuda-pathfinder==1.6.0
|
| 9 |
+
cuda-toolkit==12.8.1
|
| 10 |
+
filelock==4.2.4
|
| 11 |
+
fsspec==2026.9.0
|
| 12 |
+
h11==0.16.0
|
| 13 |
+
hf-xet==1.8.0
|
| 14 |
+
httpcore2==2.16.2
|
| 15 |
+
httpx2==2.16.2
|
| 16 |
+
huggingface-hub==2.4.0
|
| 17 |
+
idna==3.20
|
| 18 |
+
jinja2==3.1.6
|
| 19 |
+
markdown-it-py==4.3.0
|
| 20 |
+
markupsafe==3.0.3
|
| 21 |
+
mdurl==0.1.2
|
| 22 |
+
mpmath==1.3.0
|
| 23 |
+
networkx==3.7
|
| 24 |
+
numpy==2.5.4
|
| 25 |
+
nvidia-cublas-cu12==12.8.4.1
|
| 26 |
+
nvidia-cuda-cupti-cu12==12.8.90
|
| 27 |
+
nvidia-cuda-nvrtc-cu12==12.8.93
|
| 28 |
+
nvidia-cuda-runtime-cu12==12.8.90
|
| 29 |
+
nvidia-cudnn-cu12==9.19.0.56
|
| 30 |
+
nvidia-cufft-cu12==11.3.3.83
|
| 31 |
+
nvidia-cufile-cu12==1.13.1.3
|
| 32 |
+
nvidia-curand-cu12==10.3.9.90
|
| 33 |
+
nvidia-cusolver-cu12==11.7.3.90
|
| 34 |
+
nvidia-cusparse-cu12==12.5.8.93
|
| 35 |
+
nvidia-cusparselt-cu12==0.7.1
|
| 36 |
+
nvidia-nccl-cu12==2.28.9
|
| 37 |
+
nvidia-nvjitlink-cu12==12.8.93
|
| 38 |
+
nvidia-nvshmem-cu12==3.4.5
|
| 39 |
+
nvidia-nvtx-cu12==12.8.90
|
| 40 |
+
packaging==26.3
|
| 41 |
+
pillow==13.0.0
|
| 42 |
+
protobuf==7.36.2
|
| 43 |
+
psutil==7.2.2
|
| 44 |
+
pydantic==2.14.4
|
| 45 |
+
pydantic-core==2.50.5
|
| 46 |
+
pygments==2.21.0
|
| 47 |
+
pyyaml==6.0.3
|
| 48 |
+
regex==2026.11.19
|
| 49 |
+
rich==15.0.0
|
| 50 |
+
safetensors==0.8.0
|
| 51 |
+
sentencepiece==0.2.3
|
| 52 |
+
setuptools==78.1.0
|
| 53 |
+
shellingham==1.5.4
|
| 54 |
+
sympy==1.14.0
|
| 55 |
+
tokenizers==0.23.3
|
| 56 |
+
torch==2.11.0+cu128
|
| 57 |
+
torchvision==0.26.0+cu128
|
| 58 |
+
tqdm==4.70.1
|
| 59 |
+
transformers==5.23.0
|
| 60 |
+
triton==3.6.0
|
| 61 |
+
truststore==0.10.5
|
| 62 |
+
typer==0.29.2
|
| 63 |
+
typing-extensions==4.16.0
|
| 64 |
+
typing-inspection==0.4.5
|
environments/venv_vlm_falcon_ocr.requirements
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# environment .venv_vlm_falcon_ocr, Python 3.12.13; package list from 'uv pip freeze' on 2026-11-26
|
| 2 |
+
accelerate==1.16.0
|
| 3 |
+
annotated-doc==0.0.7
|
| 4 |
+
annotated-types==0.8.0
|
| 5 |
+
anyio==4.16.0
|
| 6 |
+
certifi==2026.10.23
|
| 7 |
+
charset-normalizer==3.5.2
|
| 8 |
+
click==8.5.1
|
| 9 |
+
cuda-bindings==12.9.7
|
| 10 |
+
cuda-pathfinder==1.6.0
|
| 11 |
+
cuda-toolkit==12.8.1
|
| 12 |
+
einops==0.8.2
|
| 13 |
+
filelock==4.2.4
|
| 14 |
+
fsspec==2026.9.0
|
| 15 |
+
h11==0.16.0
|
| 16 |
+
hf-xet==1.8.0
|
| 17 |
+
httpcore2==2.16.2
|
| 18 |
+
httpx2==2.16.2
|
| 19 |
+
huggingface-hub==2.4.0
|
| 20 |
+
idna==3.20
|
| 21 |
+
jinja2==3.1.6
|
| 22 |
+
markdown-it-py==4.3.0
|
| 23 |
+
markupsafe==3.0.3
|
| 24 |
+
mdurl==0.1.2
|
| 25 |
+
mpmath==1.3.0
|
| 26 |
+
networkx==3.7
|
| 27 |
+
numpy==2.5.4
|
| 28 |
+
nvidia-cublas-cu12==12.8.4.1
|
| 29 |
+
nvidia-cuda-cupti-cu12==12.8.90
|
| 30 |
+
nvidia-cuda-nvrtc-cu12==12.8.93
|
| 31 |
+
nvidia-cuda-runtime-cu12==12.8.90
|
| 32 |
+
nvidia-cudnn-cu12==9.19.0.56
|
| 33 |
+
nvidia-cufft-cu12==11.3.3.83
|
| 34 |
+
nvidia-cufile-cu12==1.13.1.3
|
| 35 |
+
nvidia-curand-cu12==10.3.9.90
|
| 36 |
+
nvidia-cusolver-cu12==11.7.3.90
|
| 37 |
+
nvidia-cusparse-cu12==12.5.8.93
|
| 38 |
+
nvidia-cusparselt-cu12==0.7.1
|
| 39 |
+
nvidia-nccl-cu12==2.28.9
|
| 40 |
+
nvidia-nvjitlink-cu12==12.8.93
|
| 41 |
+
nvidia-nvshmem-cu12==3.4.5
|
| 42 |
+
nvidia-nvtx-cu12==12.8.90
|
| 43 |
+
packaging==26.3
|
| 44 |
+
pillow==13.0.0
|
| 45 |
+
protobuf==7.36.2
|
| 46 |
+
psutil==7.2.2
|
| 47 |
+
pydantic==2.14.4
|
| 48 |
+
pydantic-core==2.50.5
|
| 49 |
+
pygments==2.21.0
|
| 50 |
+
pyyaml==6.0.3
|
| 51 |
+
regex==2026.11.19
|
| 52 |
+
requests==2.34.2
|
| 53 |
+
rich==15.0.0
|
| 54 |
+
safetensors==0.8.0
|
| 55 |
+
sentencepiece==0.2.3
|
| 56 |
+
setuptools==78.1.0
|
| 57 |
+
shellingham==1.5.4
|
| 58 |
+
sympy==1.14.0
|
| 59 |
+
tokenizers==0.23.3
|
| 60 |
+
torch==2.11.0+cu128
|
| 61 |
+
torchvision==0.26.0+cu128
|
| 62 |
+
tqdm==4.70.1
|
| 63 |
+
transformers==5.23.0
|
| 64 |
+
triton==3.6.0
|
| 65 |
+
truststore==0.10.5
|
| 66 |
+
typer==0.29.2
|
| 67 |
+
typing-extensions==4.16.0
|
| 68 |
+
typing-inspection==0.4.5
|
| 69 |
+
urllib3==2.8.0
|
environments/venv_vlm_jina_ocr_v1.requirements
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# environment .venv_vlm_jina_ocr_v1, Python 3.12.13; package list from 'uv pip freeze' on 2026-11-26
|
| 2 |
+
accelerate==1.16.0
|
| 3 |
+
certifi==2026.11.20
|
| 4 |
+
charset-normalizer==3.5.2
|
| 5 |
+
einops==0.8.2
|
| 6 |
+
filelock==4.2.4
|
| 7 |
+
fsspec==2026.9.0
|
| 8 |
+
hf-xet==1.8.0
|
| 9 |
+
huggingface-hub==0.36.2
|
| 10 |
+
idna==3.20
|
| 11 |
+
jinja2==3.1.6
|
| 12 |
+
markupsafe==3.0.3
|
| 13 |
+
mpmath==1.3.0
|
| 14 |
+
networkx==3.7
|
| 15 |
+
numpy==2.5.4
|
| 16 |
+
nvidia-cublas-cu12==12.8.4.1
|
| 17 |
+
nvidia-cuda-cupti-cu12==12.8.90
|
| 18 |
+
nvidia-cuda-nvrtc-cu12==12.8.93
|
| 19 |
+
nvidia-cuda-runtime-cu12==12.8.90
|
| 20 |
+
nvidia-cudnn-cu12==9.10.2.21
|
| 21 |
+
nvidia-cufft-cu12==11.3.3.83
|
| 22 |
+
nvidia-cufile-cu12==1.13.1.3
|
| 23 |
+
nvidia-curand-cu12==10.3.9.90
|
| 24 |
+
nvidia-cusolver-cu12==11.7.3.90
|
| 25 |
+
nvidia-cusparse-cu12==12.5.8.93
|
| 26 |
+
nvidia-cusparselt-cu12==0.7.1
|
| 27 |
+
nvidia-nccl-cu12==2.27.3
|
| 28 |
+
nvidia-nvjitlink-cu12==12.8.93
|
| 29 |
+
nvidia-nvtx-cu12==12.8.90
|
| 30 |
+
packaging==26.3
|
| 31 |
+
pillow==13.0.0
|
| 32 |
+
psutil==7.2.2
|
| 33 |
+
pyyaml==6.0.4
|
| 34 |
+
regex==2026.11.19
|
| 35 |
+
requests==2.34.2
|
| 36 |
+
safetensors==0.8.0
|
| 37 |
+
setuptools==78.1.0
|
| 38 |
+
sympy==1.14.0
|
| 39 |
+
tokenizers==0.22.2
|
| 40 |
+
torch==2.8.0+cu128
|
| 41 |
+
torchvision==0.23.0+cu128
|
| 42 |
+
tqdm==4.70.1
|
| 43 |
+
transformers==4.57.3
|
| 44 |
+
triton==3.4.0
|
| 45 |
+
typing-extensions==4.16.0
|
| 46 |
+
urllib3==2.8.0
|
environments/venv_vlm_nemotron_3_5_parse.requirements
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# environment .venv_vlm_nemotron_3_5_parse, Python 3.12.13; package list from 'uv pip freeze' on 2026-11-26
|
| 2 |
+
accelerate==1.12.0
|
| 3 |
+
annotated-doc==0.0.7
|
| 4 |
+
annotated-types==0.8.0
|
| 5 |
+
anyio==4.16.0
|
| 6 |
+
certifi==2026.11.20
|
| 7 |
+
click==8.5.1
|
| 8 |
+
cuda-bindings==12.9.7
|
| 9 |
+
cuda-pathfinder==1.6.0
|
| 10 |
+
cuda-toolkit==12.8.1
|
| 11 |
+
einops==0.8.1
|
| 12 |
+
filelock==4.2.4
|
| 13 |
+
fsspec==2026.9.0
|
| 14 |
+
h11==0.16.0
|
| 15 |
+
hf-xet==1.8.0
|
| 16 |
+
httpcore==1.0.9
|
| 17 |
+
httpx==0.28.1
|
| 18 |
+
huggingface-hub==1.24.0
|
| 19 |
+
idna==3.20
|
| 20 |
+
jinja2==3.1.6
|
| 21 |
+
markdown-it-py==4.3.0
|
| 22 |
+
markupsafe==3.0.3
|
| 23 |
+
mdurl==0.1.2
|
| 24 |
+
mpmath==1.3.0
|
| 25 |
+
networkx==3.7
|
| 26 |
+
numpy==2.2.6
|
| 27 |
+
nvidia-cublas-cu12==12.8.4.1
|
| 28 |
+
nvidia-cuda-cupti-cu12==12.8.90
|
| 29 |
+
nvidia-cuda-nvrtc-cu12==12.8.93
|
| 30 |
+
nvidia-cuda-runtime-cu12==12.8.90
|
| 31 |
+
nvidia-cudnn-cu12==9.19.0.56
|
| 32 |
+
nvidia-cufft-cu12==11.3.3.83
|
| 33 |
+
nvidia-cufile-cu12==1.13.1.3
|
| 34 |
+
nvidia-curand-cu12==10.3.9.90
|
| 35 |
+
nvidia-cusolver-cu12==11.7.3.90
|
| 36 |
+
nvidia-cusparse-cu12==12.5.8.93
|
| 37 |
+
nvidia-cusparselt-cu12==0.7.1
|
| 38 |
+
nvidia-nccl-cu12==2.28.9
|
| 39 |
+
nvidia-nvjitlink-cu12==12.8.93
|
| 40 |
+
nvidia-nvshmem-cu12==3.4.5
|
| 41 |
+
nvidia-nvtx-cu12==12.8.90
|
| 42 |
+
packaging==26.3
|
| 43 |
+
pillow==12.2.0
|
| 44 |
+
psutil==7.2.2
|
| 45 |
+
pydantic==2.14.4
|
| 46 |
+
pydantic-core==2.50.5
|
| 47 |
+
pygments==2.21.0
|
| 48 |
+
pyyaml==6.0.4
|
| 49 |
+
regex==2026.11.19
|
| 50 |
+
rich==15.0.0
|
| 51 |
+
safetensors==0.8.0
|
| 52 |
+
setuptools==78.1.0
|
| 53 |
+
shellingham==1.5.4
|
| 54 |
+
sympy==1.14.0
|
| 55 |
+
timm==1.0.22
|
| 56 |
+
tokenizers==0.22.2
|
| 57 |
+
torch==2.11.0+cu128
|
| 58 |
+
torchvision==0.26.0+cu128
|
| 59 |
+
tqdm==4.70.1
|
| 60 |
+
transformers==5.14.1
|
| 61 |
+
triton==3.6.0
|
| 62 |
+
typer==0.29.2
|
| 63 |
+
typing-extensions==4.16.0
|
| 64 |
+
typing-inspection==0.4.5
|
environments/venv_vlm_oxr_1_0.requirements
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# environment .venv_vlm_oxr_1_0, Python 3.12.13; package list from 'uv pip freeze' on 2026-11-26
|
| 2 |
+
accelerate==1.16.0
|
| 3 |
+
annotated-doc==0.0.7
|
| 4 |
+
annotated-types==0.8.0
|
| 5 |
+
anyio==4.16.0
|
| 6 |
+
click==8.5.1
|
| 7 |
+
cuda-bindings==12.9.7
|
| 8 |
+
cuda-pathfinder==1.6.0
|
| 9 |
+
cuda-toolkit==12.8.1
|
| 10 |
+
filelock==4.2.4
|
| 11 |
+
fsspec==2026.9.0
|
| 12 |
+
h11==0.16.0
|
| 13 |
+
hf-xet==1.8.0
|
| 14 |
+
httpcore2==2.16.2
|
| 15 |
+
httpx2==2.16.2
|
| 16 |
+
huggingface-hub==2.4.0
|
| 17 |
+
idna==3.20
|
| 18 |
+
jinja2==3.1.6
|
| 19 |
+
markdown-it-py==4.3.0
|
| 20 |
+
markupsafe==3.0.3
|
| 21 |
+
mdurl==0.1.2
|
| 22 |
+
mpmath==1.3.0
|
| 23 |
+
networkx==3.7
|
| 24 |
+
numpy==2.5.4
|
| 25 |
+
nvidia-cublas-cu12==12.8.4.1
|
| 26 |
+
nvidia-cuda-cupti-cu12==12.8.90
|
| 27 |
+
nvidia-cuda-nvrtc-cu12==12.8.93
|
| 28 |
+
nvidia-cuda-runtime-cu12==12.8.90
|
| 29 |
+
nvidia-cudnn-cu12==9.19.0.56
|
| 30 |
+
nvidia-cufft-cu12==11.3.3.83
|
| 31 |
+
nvidia-cufile-cu12==1.13.1.3
|
| 32 |
+
nvidia-curand-cu12==10.3.9.90
|
| 33 |
+
nvidia-cusolver-cu12==11.7.3.90
|
| 34 |
+
nvidia-cusparse-cu12==12.5.8.93
|
| 35 |
+
nvidia-cusparselt-cu12==0.7.1
|
| 36 |
+
nvidia-nccl-cu12==2.28.9
|
| 37 |
+
nvidia-nvjitlink-cu12==12.8.93
|
| 38 |
+
nvidia-nvshmem-cu12==3.4.5
|
| 39 |
+
nvidia-nvtx-cu12==12.8.90
|
| 40 |
+
packaging==26.3
|
| 41 |
+
pillow==13.0.0
|
| 42 |
+
protobuf==7.36.2
|
| 43 |
+
psutil==7.2.2
|
| 44 |
+
pydantic==2.14.4
|
| 45 |
+
pydantic-core==2.50.5
|
| 46 |
+
pygments==2.21.0
|
| 47 |
+
pyyaml==6.0.3
|
| 48 |
+
regex==2026.11.19
|
| 49 |
+
rich==15.0.0
|
| 50 |
+
safetensors==0.8.0
|
| 51 |
+
sentencepiece==0.2.3
|
| 52 |
+
setuptools==78.1.0
|
| 53 |
+
shellingham==1.5.4
|
| 54 |
+
sympy==1.14.0
|
| 55 |
+
tokenizers==0.23.3
|
| 56 |
+
torch==2.11.0+cu128
|
| 57 |
+
torchvision==0.26.0+cu128
|
| 58 |
+
tqdm==4.70.1
|
| 59 |
+
transformers==5.23.0
|
| 60 |
+
triton==3.6.0
|
| 61 |
+
truststore==0.10.5
|
| 62 |
+
typer==0.29.2
|
| 63 |
+
typing-extensions==4.16.0
|
| 64 |
+
typing-inspection==0.4.5
|
environments/venv_vlm_teleocr.requirements
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# environment .venv_vlm_teleocr, Python 3.12.13; package list from 'uv pip freeze' on 2026-11-26
|
| 2 |
+
accelerate==1.16.0
|
| 3 |
+
certifi==2026.10.23
|
| 4 |
+
charset-normalizer==3.5.2
|
| 5 |
+
filelock==4.2.4
|
| 6 |
+
fsspec==2026.9.0
|
| 7 |
+
hf-xet==1.8.0
|
| 8 |
+
huggingface-hub==0.36.2
|
| 9 |
+
idna==3.20
|
| 10 |
+
jinja2==3.1.6
|
| 11 |
+
markupsafe==3.0.3
|
| 12 |
+
mpmath==1.3.0
|
| 13 |
+
networkx==3.7
|
| 14 |
+
numpy==2.5.4
|
| 15 |
+
nvidia-cublas-cu12==12.8.4.1
|
| 16 |
+
nvidia-cuda-cupti-cu12==12.8.90
|
| 17 |
+
nvidia-cuda-nvrtc-cu12==12.8.93
|
| 18 |
+
nvidia-cuda-runtime-cu12==12.8.90
|
| 19 |
+
nvidia-cudnn-cu12==9.10.2.21
|
| 20 |
+
nvidia-cufft-cu12==11.3.3.83
|
| 21 |
+
nvidia-cufile-cu12==1.13.1.3
|
| 22 |
+
nvidia-curand-cu12==10.3.9.90
|
| 23 |
+
nvidia-cusolver-cu12==11.7.3.90
|
| 24 |
+
nvidia-cusparse-cu12==12.5.8.93
|
| 25 |
+
nvidia-cusparselt-cu12==0.7.1
|
| 26 |
+
nvidia-nccl-cu12==2.27.3
|
| 27 |
+
nvidia-nvjitlink-cu12==12.8.93
|
| 28 |
+
nvidia-nvtx-cu12==12.8.90
|
| 29 |
+
packaging==26.3
|
| 30 |
+
pillow==13.0.0
|
| 31 |
+
psutil==7.2.2
|
| 32 |
+
pyyaml==6.0.3
|
| 33 |
+
regex==2026.11.19
|
| 34 |
+
requests==2.34.2
|
| 35 |
+
safetensors==0.8.0
|
| 36 |
+
setuptools==78.1.0
|
| 37 |
+
sympy==1.14.0
|
| 38 |
+
tokenizers==0.22.2
|
| 39 |
+
torch==2.8.0+cu128
|
| 40 |
+
torchvision==0.23.0+cu128
|
| 41 |
+
tqdm==4.70.1
|
| 42 |
+
transformers==4.57.1
|
| 43 |
+
triton==3.4.0
|
| 44 |
+
typing-extensions==4.16.0
|
| 45 |
+
urllib3==2.8.0
|
environments/venv_vlm_unlimited_ocr_2.requirements
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# environment .venv_vlm_unlimited_ocr_2, Python 3.10.20; package list from 'uv pip freeze' on 2026-11-26
|
| 2 |
+
accelerate==1.15.0
|
| 3 |
+
addict==2.4.0
|
| 4 |
+
certifi==2026.11.20
|
| 5 |
+
charset-normalizer==3.5.2
|
| 6 |
+
cuda-bindings==13.4.4
|
| 7 |
+
cuda-pathfinder==1.8.3
|
| 8 |
+
cuda-toolkit==13.0.3.0
|
| 9 |
+
easydict==1.13
|
| 10 |
+
einops==0.8.2
|
| 11 |
+
filelock==4.1.0
|
| 12 |
+
fsspec==2026.9.0
|
| 13 |
+
hf-xet==1.8.0
|
| 14 |
+
huggingface-hub==0.36.0
|
| 15 |
+
idna==3.20
|
| 16 |
+
jinja2==3.1.6
|
| 17 |
+
markupsafe==3.0.3
|
| 18 |
+
mpmath==1.3.0
|
| 19 |
+
networkx==3.4.2
|
| 20 |
+
numpy==2.2.6
|
| 21 |
+
nvidia-cublas==13.1.1.3
|
| 22 |
+
nvidia-cuda-cupti==13.0.85
|
| 23 |
+
nvidia-cuda-nvrtc==13.0.88
|
| 24 |
+
nvidia-cuda-runtime==13.0.96
|
| 25 |
+
nvidia-cudnn-cu13==9.20.0.48
|
| 26 |
+
nvidia-cufft==12.0.0.61
|
| 27 |
+
nvidia-cufile==1.15.1.6
|
| 28 |
+
nvidia-curand==10.4.0.35
|
| 29 |
+
nvidia-cusolver==12.0.4.66
|
| 30 |
+
nvidia-cusparse==12.6.3.3
|
| 31 |
+
nvidia-cusparselt-cu13==0.8.1
|
| 32 |
+
nvidia-nccl-cu13==2.29.7
|
| 33 |
+
nvidia-nvjitlink==13.4.92
|
| 34 |
+
nvidia-nvshmem-cu13==3.4.5
|
| 35 |
+
nvidia-nvtx==13.0.85
|
| 36 |
+
packaging==26.3
|
| 37 |
+
pillow==12.3.0
|
| 38 |
+
psutil==7.2.2
|
| 39 |
+
pyyaml==6.0.4
|
| 40 |
+
regex==2026.9.29
|
| 41 |
+
requests==2.34.2
|
| 42 |
+
safetensors==0.8.0
|
| 43 |
+
setuptools==78.1.0
|
| 44 |
+
sympy==1.14.0
|
| 45 |
+
tokenizers==0.21.4
|
| 46 |
+
torch==2.13.0+cu130
|
| 47 |
+
torchvision==0.28.0+cu130
|
| 48 |
+
tqdm==4.70.1
|
| 49 |
+
transformers==4.52.1
|
| 50 |
+
triton==3.7.1
|
| 51 |
+
typing-extensions==4.16.0
|
| 52 |
+
urllib3==2.8.0
|
environments/venv_vlm_youtu_parsing.requirements
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# environment .venv_vlm_youtu_parsing, Python 3.12.13; package list from 'uv pip freeze' on 2026-11-26
|
| 2 |
+
accelerate==1.16.0
|
| 3 |
+
certifi==2026.11.20
|
| 4 |
+
charset-normalizer==3.5.2
|
| 5 |
+
einops==0.8.2
|
| 6 |
+
filelock==4.2.4
|
| 7 |
+
fsspec==2026.9.0
|
| 8 |
+
hf-xet==1.8.0
|
| 9 |
+
huggingface-hub==0.36.2
|
| 10 |
+
idna==3.20
|
| 11 |
+
jinja2==3.1.6
|
| 12 |
+
markupsafe==3.0.3
|
| 13 |
+
mpmath==1.3.0
|
| 14 |
+
networkx==3.7
|
| 15 |
+
numpy==2.5.4
|
| 16 |
+
nvidia-cublas-cu12==12.8.4.1
|
| 17 |
+
nvidia-cuda-cupti-cu12==12.8.90
|
| 18 |
+
nvidia-cuda-nvrtc-cu12==12.8.93
|
| 19 |
+
nvidia-cuda-runtime-cu12==12.8.90
|
| 20 |
+
nvidia-cudnn-cu12==9.10.2.21
|
| 21 |
+
nvidia-cufft-cu12==11.3.3.83
|
| 22 |
+
nvidia-cufile-cu12==1.13.1.3
|
| 23 |
+
nvidia-curand-cu12==10.3.9.90
|
| 24 |
+
nvidia-cusolver-cu12==11.7.3.90
|
| 25 |
+
nvidia-cusparse-cu12==12.5.8.93
|
| 26 |
+
nvidia-cusparselt-cu12==0.7.1
|
| 27 |
+
nvidia-nccl-cu12==2.27.3
|
| 28 |
+
nvidia-nvjitlink-cu12==12.8.93
|
| 29 |
+
nvidia-nvtx-cu12==12.8.90
|
| 30 |
+
packaging==26.3
|
| 31 |
+
pillow==13.0.0
|
| 32 |
+
psutil==7.2.2
|
| 33 |
+
pyyaml==6.0.4
|
| 34 |
+
regex==2026.11.19
|
| 35 |
+
requests==2.34.2
|
| 36 |
+
safetensors==0.8.0
|
| 37 |
+
setuptools==78.1.0
|
| 38 |
+
sympy==1.14.0
|
| 39 |
+
tokenizers==0.22.2
|
| 40 |
+
torch==2.8.0+cu128
|
| 41 |
+
torchvision==0.23.0+cu128
|
| 42 |
+
tqdm==4.70.1
|
| 43 |
+
transformers==4.56.0
|
| 44 |
+
triton==3.4.0
|
| 45 |
+
typing-extensions==4.16.0
|
| 46 |
+
urllib3==2.8.0
|
release/page-pipeline/infer.py
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python
|
| 2 |
+
"""Read whole pages: find the text lines, cut a crop for every line, read every crop (Turkic OCR, release candidate 1).
|
| 3 |
+
|
| 4 |
+
Stage 1 runs the detector package (turkic-line-detector-yolo11s) on the page image as a subprocess, because it needs ultralytics, which
|
| 5 |
+
the reader's environment does not contain: pass --detector-python with a Python that has ultralytics (the default is this Python).
|
| 6 |
+
Stage 2 cuts one crop per box and reads every crop with the reader package (turkic-ocr-paddleocr-vl-1.6, final model of this release,
|
| 7 |
+
greedy, bfloat16, at most 192 new tokens per line, batches of 16 crops in reading order), in this process.
|
| 8 |
+
|
| 9 |
+
Crop and reading-order logic are those of our evaluation (CODE/src/linedet/det_eval.py and the page check detb1_page_check.py):
|
| 10 |
+
- reading order: boxes sorted by (centre_y // band, centre_x) in the detection image, band = 15 px in a page whose longer side is
|
| 11 |
+
1280 px (the band grows in proportion for a larger or smaller page);
|
| 12 |
+
- crop: the box widened by 1 % of its width plus 2 px on each side and heightened by 10 % of its height plus 1 px above and below,
|
| 13 |
+
clipped to the image; a crop narrower or lower than 4 px is dropped;
|
| 14 |
+
- text: the reader's normalised output; a crop whose text is empty is kept in the lines table and left out of the page text.
|
| 15 |
+
For a photograph that is much larger than the page the detector sees (our School Notebooks pages: detection on 1280 px, reading from the
|
| 16 |
+
full-resolution photograph) give the reading images with --hires-tsv.
|
| 17 |
+
|
| 18 |
+
Outputs: --out, a TSV with one row per page: id, n_lines, text (the lines in reading order joined by one space);
|
| 19 |
+
--lines-out, a TSV with one row per crop: id, line, x0, y0, x1, y1, score, text (boxes in detection-image pixels).
|
| 20 |
+
|
| 21 |
+
usage:
|
| 22 |
+
python infer.py --images page.jpg --out pages.tsv --lines-out lines.tsv
|
| 23 |
+
python infer.py --manifest pages.tsv --out pages.tsv --lines-out lines.tsv --detector-python /path/to/venv-with-ultralytics/bin/python
|
| 24 |
+
"""
|
| 25 |
+
import os
|
| 26 |
+
|
| 27 |
+
os.environ.setdefault("HF_HUB_OFFLINE", "1")
|
| 28 |
+
os.environ.setdefault("TRANSFORMERS_OFFLINE", "1")
|
| 29 |
+
|
| 30 |
+
import argparse # noqa: E402
|
| 31 |
+
import csv # noqa: E402
|
| 32 |
+
import importlib.util # noqa: E402
|
| 33 |
+
import json # noqa: E402
|
| 34 |
+
import subprocess # noqa: E402
|
| 35 |
+
import sys # noqa: E402
|
| 36 |
+
import tempfile # noqa: E402
|
| 37 |
+
import time # noqa: E402
|
| 38 |
+
|
| 39 |
+
from PIL import Image # noqa: E402
|
| 40 |
+
|
| 41 |
+
HERE = os.path.dirname(os.path.abspath(__file__))
|
| 42 |
+
IMG_EXT = (".png", ".jpg", ".jpeg", ".bmp", ".tif", ".tiff", ".webp")
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
def collect_inputs(images=None, manifest=None):
|
| 46 |
+
"""List of (id, path). A manifest is a TSV with a header and the columns id and image (other columns are ignored)."""
|
| 47 |
+
if manifest:
|
| 48 |
+
rows = []
|
| 49 |
+
with open(manifest, encoding="utf-8", newline="") as f:
|
| 50 |
+
for r in csv.DictReader(f, delimiter="\t", quoting=csv.QUOTE_NONE):
|
| 51 |
+
rows.append((r["id"], r["image"]))
|
| 52 |
+
return rows
|
| 53 |
+
if os.path.isdir(images):
|
| 54 |
+
names = sorted(n for n in os.listdir(images) if n.lower().endswith(IMG_EXT))
|
| 55 |
+
return [(n, os.path.join(images, n)) for n in names]
|
| 56 |
+
return [(os.path.basename(images), images)]
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
def load_module(name, path):
|
| 60 |
+
spec = importlib.util.spec_from_file_location(name, path)
|
| 61 |
+
mod = importlib.util.module_from_spec(spec)
|
| 62 |
+
sys.modules[name] = mod
|
| 63 |
+
spec.loader.exec_module(mod)
|
| 64 |
+
return mod
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
def reading_order(boxes, band):
|
| 68 |
+
return sorted(range(len(boxes)), key=lambda i: (int(((boxes[i][1] + boxes[i][3]) / 2) // band), (boxes[i][0] + boxes[i][2]) / 2))
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
def make_crop(big, box, sc):
|
| 72 |
+
"""The crop of one box, or None. sc: pixels of the reading image per pixel of the detection image."""
|
| 73 |
+
W, H = big.size
|
| 74 |
+
x0, y0, x1, y1 = box
|
| 75 |
+
hh = y1 - y0
|
| 76 |
+
x0, x1 = x0 - 0.01 * (x1 - x0) - 2, x1 + 0.01 * (x1 - x0) + 2
|
| 77 |
+
y0, y1 = y0 - 0.1 * hh - 1, y1 + 0.1 * hh + 1
|
| 78 |
+
X0, Y0, X1, Y1 = [int(round(v * sc)) for v in (max(x0, 0), max(y0, 0), x1, y1)]
|
| 79 |
+
X0, Y0, X1, Y1 = max(X0, 0), max(Y0, 0), min(X1, W), min(Y1, H)
|
| 80 |
+
if X1 - X0 < 4 or Y1 - Y0 < 4:
|
| 81 |
+
return None
|
| 82 |
+
return big.crop((X0, Y0, X1, Y1))
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
def read_hires(path):
|
| 86 |
+
"""TSV with a header and the columns id and image, optionally scale (reading-image pixels per detection-image pixel)."""
|
| 87 |
+
out = {}
|
| 88 |
+
with open(path, encoding="utf-8", newline="") as f:
|
| 89 |
+
for r in csv.DictReader(f, delimiter="\t", quoting=csv.QUOTE_NONE):
|
| 90 |
+
out[r["id"]] = (r["image"], float(r["scale"]) if r.get("scale") else None)
|
| 91 |
+
return out
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
def main():
|
| 95 |
+
ap = argparse.ArgumentParser(description=__doc__.split("\n")[0])
|
| 96 |
+
g = ap.add_mutually_exclusive_group(required=True)
|
| 97 |
+
g.add_argument("--images", help="one page image or a folder of page images (ids are the file names)")
|
| 98 |
+
g.add_argument("--manifest", help="TSV with a header and the columns id and image (the detection images)")
|
| 99 |
+
ap.add_argument("--out", required=True, help="page TSV: id, n_lines, text")
|
| 100 |
+
ap.add_argument("--lines-out", default=None, help="line TSV: id, line, x0, y0, x1, y1, score, text")
|
| 101 |
+
ap.add_argument("--detector-dir", default=os.path.join(HERE, "..", "turkic-line-detector-yolo11s"))
|
| 102 |
+
ap.add_argument("--reader-dir", default=os.path.join(HERE, "..", "turkic-ocr-paddleocr-vl-1.6"))
|
| 103 |
+
ap.add_argument("--detector-python", default=sys.executable, help="Python with ultralytics installed (runs the detector package)")
|
| 104 |
+
ap.add_argument("--device", default="auto", help="auto, cpu or cuda: used for the detector and the reader")
|
| 105 |
+
ap.add_argument("--conf", type=float, default=0.25, help="detector confidence threshold")
|
| 106 |
+
ap.add_argument("--hires-tsv", default=None, help="TSV (id, image, optional scale): the image to cut crops from, for pages whose detection image is a downscaled copy")
|
| 107 |
+
ap.add_argument("--band-px", type=float, default=None, help="reading-order row height in detection-image pixels (default: 15 for a 1280 px page)")
|
| 108 |
+
ap.add_argument("--batch-size", type=int, default=16)
|
| 109 |
+
ap.add_argument("--threads", type=int, default=0)
|
| 110 |
+
ap.add_argument("--keep-boxes", default=None, help="also write the detector's boxes TSV here")
|
| 111 |
+
ap.add_argument("--report-modules", default=None, help="write the file paths of all loaded Python modules to this JSON (checks)")
|
| 112 |
+
a = ap.parse_args()
|
| 113 |
+
items = collect_inputs(a.images, a.manifest)
|
| 114 |
+
det_dir = os.path.abspath(a.detector_dir)
|
| 115 |
+
rd_dir = os.path.abspath(a.reader_dir)
|
| 116 |
+
hires = read_hires(a.hires_tsv) if a.hires_tsv else {}
|
| 117 |
+
t_all = time.time()
|
| 118 |
+
|
| 119 |
+
# stage 1: boxes
|
| 120 |
+
work = tempfile.mkdtemp(prefix="turkic_ocr_pages_")
|
| 121 |
+
man = os.path.join(work, "pages_manifest.tsv")
|
| 122 |
+
with open(man, "w", encoding="utf-8", newline="") as f:
|
| 123 |
+
f.write("id\timage\n")
|
| 124 |
+
for rid, p in items:
|
| 125 |
+
f.write("%s\t%s\n" % (rid, os.path.abspath(p)))
|
| 126 |
+
boxes_tsv = a.keep_boxes or os.path.join(work, "boxes.tsv")
|
| 127 |
+
det_dev = {"cuda": "0", "auto": "auto"}.get(a.device, a.device)
|
| 128 |
+
cmd = [a.detector_python, "-B", os.path.join(det_dir, "infer.py"), "--manifest", man, "--out", boxes_tsv, "--device", det_dev,
|
| 129 |
+
"--conf", str(a.conf), "--weights", os.path.join(det_dir, "best.pt")]
|
| 130 |
+
t0 = time.time()
|
| 131 |
+
r = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
| 132 |
+
sys.stderr.write(r.stderr[-600:])
|
| 133 |
+
if r.returncode != 0:
|
| 134 |
+
raise SystemExit("the detector failed (exit %d): %s" % (r.returncode, r.stderr[-1500:]))
|
| 135 |
+
t_det = time.time() - t0
|
| 136 |
+
boxes = {}
|
| 137 |
+
with open(boxes_tsv, encoding="utf-8", newline="") as f:
|
| 138 |
+
for row in csv.DictReader(f, delimiter="\t", quoting=csv.QUOTE_NONE):
|
| 139 |
+
boxes[row["id"]] = (json.loads(row["boxes"]), json.loads(row["scores"]))
|
| 140 |
+
|
| 141 |
+
# stage 2: crops and reading
|
| 142 |
+
rdr = load_module("turkic_reader_infer", os.path.join(rd_dir, "infer.py"))
|
| 143 |
+
reader = rdr.Reader(os.path.join(rd_dir, "model"), a.device, "bfloat16", a.threads)
|
| 144 |
+
fp = open(a.out, "w", encoding="utf-8", newline="")
|
| 145 |
+
fp.write("id\tn_lines\ttext\n")
|
| 146 |
+
fl = open(a.lines_out, "w", encoding="utf-8", newline="") if a.lines_out else None
|
| 147 |
+
if fl:
|
| 148 |
+
fl.write("id\tline\tx0\ty0\tx1\ty1\tscore\ttext\n")
|
| 149 |
+
t_read = 0.0
|
| 150 |
+
for rid, path in items:
|
| 151 |
+
bx, sc_list = boxes.get(rid, ([], []))
|
| 152 |
+
det_img = Image.open(path)
|
| 153 |
+
dw, dh = det_img.size
|
| 154 |
+
if rid in hires:
|
| 155 |
+
hp, hs = hires[rid]
|
| 156 |
+
big = Image.open(hp).convert("RGB")
|
| 157 |
+
sc = hs if hs else big.size[0] / float(dw)
|
| 158 |
+
else:
|
| 159 |
+
big, sc = det_img.convert("RGB"), 1.0
|
| 160 |
+
band = a.band_px if a.band_px else 15.0 * max(dw, dh) / 1280.0
|
| 161 |
+
order = reading_order(bx, band)
|
| 162 |
+
crops, idxs = [], []
|
| 163 |
+
for i in order:
|
| 164 |
+
c = make_crop(big, bx[i], sc)
|
| 165 |
+
if c is not None:
|
| 166 |
+
crops.append(c)
|
| 167 |
+
idxs.append(i)
|
| 168 |
+
t1 = time.time()
|
| 169 |
+
recs = reader.read(crops, "line", a.batch_size) if crops else []
|
| 170 |
+
t_read += time.time() - t1
|
| 171 |
+
texts = [x["text"] for x in recs]
|
| 172 |
+
if fl:
|
| 173 |
+
for k, (i, t) in enumerate(zip(idxs, texts)):
|
| 174 |
+
b = bx[i]
|
| 175 |
+
fl.write("%s\t%d\t%.1f\t%.1f\t%.1f\t%.1f\t%.4f\t%s\n" % (rid, k, b[0], b[1], b[2], b[3], sc_list[i], t))
|
| 176 |
+
kept = [t for t in texts if t]
|
| 177 |
+
fp.write("%s\t%d\t%s\n" % (rid, len(kept), " ".join(kept)))
|
| 178 |
+
fp.flush()
|
| 179 |
+
fp.close()
|
| 180 |
+
if fl:
|
| 181 |
+
fl.close()
|
| 182 |
+
sys.stderr.write("pages %d; detector %.1f s, reading %.1f s, total %.1f s\n" % (len(items), t_det, t_read, time.time() - t_all))
|
| 183 |
+
if a.report_modules:
|
| 184 |
+
mods = sorted({getattr(m, "__file__", None) for m in sys.modules.values() if getattr(m, "__file__", None)})
|
| 185 |
+
with open(a.report_modules, "w", encoding="utf-8") as f:
|
| 186 |
+
json.dump({"script": os.path.abspath(__file__), "modules": mods, "sys_path": sys.path}, f, indent=1)
|
| 187 |
+
|
| 188 |
+
|
| 189 |
+
if __name__ == "__main__":
|
| 190 |
+
main()
|
release/page-pipeline/requirements.txt
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# The page pipeline runs in the READER's environment (infer.py here and the reader's code): exact package versions of CODE/.venv_vlm,
|
| 2 |
+
# Python 3.12.13. The detector needs ultralytics, which this environment does not have: install the requirements.txt of
|
| 3 |
+
# turkic-line-detector-yolo11s in a second environment and pass its Python as --detector-python (one environment holding both also works).
|
| 4 |
+
# Frozen with `uv pip freeze` on 2026-11-25 (cluster job 55104, file DATA/tmp/rc1_check/freeze_vlm.txt).
|
| 5 |
+
# torch and torchvision are the CUDA 12.8 builds ("+cu128"); the index line below lets pip find them. On a machine without a GPU the same
|
| 6 |
+
# versions run on the CPU (bfloat16 matrix products are used on CPU as well), or install torch==2.11.0 and torchvision==0.26.0 from PyPI.
|
| 7 |
+
--extra-index-url https://download.pytorch.org/whl/cu128
|
| 8 |
+
accelerate==1.16.0
|
| 9 |
+
annotated-doc==0.0.7
|
| 10 |
+
annotated-types==0.8.0
|
| 11 |
+
anyio==4.16.0
|
| 12 |
+
click==8.5.1
|
| 13 |
+
cuda-bindings==12.9.7
|
| 14 |
+
cuda-pathfinder==1.6.0
|
| 15 |
+
cuda-toolkit==12.8.1
|
| 16 |
+
filelock==4.2.4
|
| 17 |
+
fsspec==2026.9.0
|
| 18 |
+
h11==0.16.0
|
| 19 |
+
hf-xet==1.8.0
|
| 20 |
+
httpcore2==2.16.2
|
| 21 |
+
httpx2==2.16.2
|
| 22 |
+
huggingface-hub==2.4.0
|
| 23 |
+
idna==3.20
|
| 24 |
+
jinja2==3.1.6
|
| 25 |
+
markdown-it-py==4.3.0
|
| 26 |
+
markupsafe==3.0.3
|
| 27 |
+
mdurl==0.1.2
|
| 28 |
+
mpmath==1.3.0
|
| 29 |
+
networkx==3.7
|
| 30 |
+
numpy==2.5.4
|
| 31 |
+
nvidia-cublas-cu12==12.8.4.1
|
| 32 |
+
nvidia-cuda-cupti-cu12==12.8.90
|
| 33 |
+
nvidia-cuda-nvrtc-cu12==12.8.93
|
| 34 |
+
nvidia-cuda-runtime-cu12==12.8.90
|
| 35 |
+
nvidia-cudnn-cu12==9.19.0.56
|
| 36 |
+
nvidia-cufft-cu12==11.3.3.83
|
| 37 |
+
nvidia-cufile-cu12==1.13.1.3
|
| 38 |
+
nvidia-curand-cu12==10.3.9.90
|
| 39 |
+
nvidia-cusolver-cu12==11.7.3.90
|
| 40 |
+
nvidia-cusparse-cu12==12.5.8.93
|
| 41 |
+
nvidia-cusparselt-cu12==0.7.1
|
| 42 |
+
nvidia-nccl-cu12==2.28.9
|
| 43 |
+
nvidia-nvjitlink-cu12==12.8.93
|
| 44 |
+
nvidia-nvshmem-cu12==3.4.5
|
| 45 |
+
nvidia-nvtx-cu12==12.8.90
|
| 46 |
+
packaging==26.3
|
| 47 |
+
pillow==13.0.0
|
| 48 |
+
protobuf==7.36.2
|
| 49 |
+
psutil==7.2.2
|
| 50 |
+
pydantic==2.14.4
|
| 51 |
+
pydantic-core==2.50.5
|
| 52 |
+
pygments==2.21.0
|
| 53 |
+
pyyaml==6.0.3
|
| 54 |
+
regex==2026.11.19
|
| 55 |
+
rich==15.0.0
|
| 56 |
+
safetensors==0.8.0
|
| 57 |
+
sentencepiece==0.2.3
|
| 58 |
+
setuptools==78.1.0
|
| 59 |
+
shellingham==1.5.4
|
| 60 |
+
sympy==1.14.0
|
| 61 |
+
tokenizers==0.23.3
|
| 62 |
+
torch==2.11.0+cu128
|
| 63 |
+
torchvision==0.26.0+cu128
|
| 64 |
+
tqdm==4.70.1
|
| 65 |
+
transformers==5.23.0
|
| 66 |
+
triton==3.6.0
|
| 67 |
+
truststore==0.10.5
|
| 68 |
+
typer==0.29.2
|
| 69 |
+
typing-extensions==4.16.0
|
| 70 |
+
typing-inspection==0.4.5
|
release/turkic-line-detector-yolo11s/infer.py
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python
|
| 2 |
+
"""Find text lines on page images with the YOLO11s line detector of Turkic OCR (release candidate 1, stage-2 weights best.pt).
|
| 3 |
+
|
| 4 |
+
Input: one image, a folder of images, or a TSV manifest (columns id, image). Output: a TSV with one row per page image and the columns
|
| 5 |
+
id, n_lines, boxes, scores
|
| 6 |
+
where boxes is a JSON list of [x0, y0, x1, y1] in pixels of the input image (rounded to 0.1) and scores a JSON list of the detection
|
| 7 |
+
confidences (rounded to 0.0001), in the detector's own order. A detector finds boxes, not text, so this TSV replaces the (id, text) table
|
| 8 |
+
of the readers; the reader of the page-pipeline package turns the boxes into text.
|
| 9 |
+
The settings are those of our detection evaluation (CODE/src/linedet/det_eval.py): the image file is passed to ultralytics, image size
|
| 10 |
+
1280, confidence threshold 0.25, NMS IoU 0.6, at most 300 boxes, one class "text_line".
|
| 11 |
+
|
| 12 |
+
usage:
|
| 13 |
+
python infer.py --images page.jpg --out boxes.tsv
|
| 14 |
+
python infer.py --manifest pages.tsv --out boxes.tsv --device cpu
|
| 15 |
+
"""
|
| 16 |
+
import os
|
| 17 |
+
import tempfile
|
| 18 |
+
|
| 19 |
+
os.environ.setdefault("YOLO_OFFLINE", "1") # no network access, no analytics, no font download
|
| 20 |
+
os.environ.setdefault("YOLO_CONFIG_DIR", os.path.join(tempfile.gettempdir(), "ultralytics_cfg_turkic_ocr"))
|
| 21 |
+
|
| 22 |
+
import argparse # noqa: E402
|
| 23 |
+
import csv # noqa: E402
|
| 24 |
+
import json # noqa: E402
|
| 25 |
+
import sys # noqa: E402
|
| 26 |
+
import time # noqa: E402
|
| 27 |
+
|
| 28 |
+
HERE = os.path.dirname(os.path.abspath(__file__))
|
| 29 |
+
IMG_EXT = (".png", ".jpg", ".jpeg", ".bmp", ".tif", ".tiff", ".webp")
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
def collect_inputs(images=None, manifest=None):
|
| 33 |
+
"""List of (id, path). A manifest is a TSV with a header and the columns id and image (other columns are ignored)."""
|
| 34 |
+
if manifest:
|
| 35 |
+
rows = []
|
| 36 |
+
with open(manifest, encoding="utf-8", newline="") as f:
|
| 37 |
+
for r in csv.DictReader(f, delimiter="\t", quoting=csv.QUOTE_NONE):
|
| 38 |
+
rows.append((r["id"], r["image"]))
|
| 39 |
+
return rows
|
| 40 |
+
if os.path.isdir(images):
|
| 41 |
+
names = sorted(n for n in os.listdir(images) if n.lower().endswith(IMG_EXT))
|
| 42 |
+
return [(n, os.path.join(images, n)) for n in names]
|
| 43 |
+
return [(os.path.basename(images), images)]
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
def main():
|
| 47 |
+
ap = argparse.ArgumentParser(description=__doc__.split("\n")[0])
|
| 48 |
+
g = ap.add_mutually_exclusive_group(required=True)
|
| 49 |
+
g.add_argument("--images", help="one image file or a folder of images (ids are the file names)")
|
| 50 |
+
g.add_argument("--manifest", help="TSV with a header and the columns id and image")
|
| 51 |
+
ap.add_argument("--out", default="-", help="output TSV (default: standard output)")
|
| 52 |
+
ap.add_argument("--device", default="auto", help="auto (GPU 0 if there is one, else cpu), cpu, 0, 1, ...")
|
| 53 |
+
ap.add_argument("--conf", type=float, default=0.25)
|
| 54 |
+
ap.add_argument("--weights", default=os.path.join(HERE, "best.pt"))
|
| 55 |
+
ap.add_argument("--report-modules", default=None, help="write the file paths of all loaded Python modules to this JSON (checks)")
|
| 56 |
+
a = ap.parse_args()
|
| 57 |
+
import torch
|
| 58 |
+
from ultralytics import YOLO
|
| 59 |
+
dev = a.device
|
| 60 |
+
if dev == "auto":
|
| 61 |
+
dev = 0 if torch.cuda.is_available() else "cpu"
|
| 62 |
+
elif dev.isdigit():
|
| 63 |
+
dev = int(dev)
|
| 64 |
+
items = collect_inputs(a.images, a.manifest)
|
| 65 |
+
t0 = time.time()
|
| 66 |
+
det = YOLO(a.weights)
|
| 67 |
+
t_load = time.time() - t0
|
| 68 |
+
fo = sys.stdout if a.out == "-" else open(a.out, "w", encoding="utf-8", newline="")
|
| 69 |
+
fo.write("id\tn_lines\tboxes\tscores\n")
|
| 70 |
+
t1 = time.time()
|
| 71 |
+
for rid, path in items:
|
| 72 |
+
try:
|
| 73 |
+
r = det.predict(path, imgsz=1280, conf=a.conf, iou=0.6, max_det=300, device=dev, verbose=False)[0]
|
| 74 |
+
except Exception as ex: # noqa: BLE001
|
| 75 |
+
sys.stderr.write("cannot read %s: %s\n" % (path, repr(ex)[:120]))
|
| 76 |
+
fo.write("%s\t0\t[]\t[]\n" % rid)
|
| 77 |
+
continue
|
| 78 |
+
boxes = [[round(v, 1) for v in b] for b in r.boxes.xyxy.cpu().numpy().tolist()]
|
| 79 |
+
scores = [round(float(s), 4) for s in r.boxes.conf.cpu().numpy().tolist()]
|
| 80 |
+
fo.write("%s\t%d\t%s\t%s\n" % (rid, len(boxes), json.dumps(boxes), json.dumps(scores)))
|
| 81 |
+
if fo is not sys.stdout:
|
| 82 |
+
fo.close()
|
| 83 |
+
sys.stderr.write("detected on %d images (device %s) in %.1f s (load %.1f s)\n" % (len(items), dev, time.time() - t1, t_load))
|
| 84 |
+
if a.report_modules:
|
| 85 |
+
mods = sorted({getattr(m, "__file__", None) for m in sys.modules.values() if getattr(m, "__file__", None)})
|
| 86 |
+
with open(a.report_modules, "w", encoding="utf-8") as f:
|
| 87 |
+
json.dump({"script": os.path.abspath(__file__), "modules": mods, "sys_path": sys.path}, f, indent=1)
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
if __name__ == "__main__":
|
| 91 |
+
main()
|
release/turkic-line-detector-yolo11s/requirements.txt
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Exact package versions of the environment this detector was trained and evaluated in: CODE/.venv_kraken, Python 3.12.13.
|
| 2 |
+
# Frozen with `uv pip freeze` on 2026-11-25 (cluster job 55104, file DATA/tmp/rc1_check/freeze_kraken.txt).
|
| 3 |
+
# What infer.py imports directly: ultralytics (8.4.216; AGPL-3.0), torch, and through ultralytics numpy, opencv-python, pillow, scipy, pyyaml.
|
| 4 |
+
# torch and torchvision are the CUDA 12.8 builds ("+cu128"); the index line below lets pip find them. On a machine without a GPU the same
|
| 5 |
+
# versions run on the CPU.
|
| 6 |
+
--extra-index-url https://download.pytorch.org/whl/cu128
|
| 7 |
+
aiohappyeyeballs==2.7.1
|
| 8 |
+
aiohttp==3.14.5
|
| 9 |
+
aiosignal==1.4.0
|
| 10 |
+
anyio==4.16.0
|
| 11 |
+
atpublic==9.0.0
|
| 12 |
+
attrs==26.1.0
|
| 13 |
+
cattrs==26.2.1
|
| 14 |
+
certifi==2026.10.23
|
| 15 |
+
charset-normalizer==3.5.2
|
| 16 |
+
click==8.2.1
|
| 17 |
+
cloudpickle==3.1.3
|
| 18 |
+
contourpy==1.4.0
|
| 19 |
+
coremltools==9.0
|
| 20 |
+
cuda-bindings==12.9.7
|
| 21 |
+
cuda-pathfinder==1.6.0
|
| 22 |
+
cuda-toolkit==12.8.1
|
| 23 |
+
cycler==0.12.1
|
| 24 |
+
filelock==4.2.4
|
| 25 |
+
flufl-lock==10.0.0
|
| 26 |
+
fonttools==4.68.0
|
| 27 |
+
frozenlist==1.8.0
|
| 28 |
+
fsspec==2026.9.0
|
| 29 |
+
h11==0.16.0
|
| 30 |
+
htrmopo==0.6
|
| 31 |
+
httpcore==1.0.9
|
| 32 |
+
httpx==0.28.1
|
| 33 |
+
idna==3.20
|
| 34 |
+
imageio==2.38.2
|
| 35 |
+
iso639-lang==2.6.3
|
| 36 |
+
jinja2==3.1.6
|
| 37 |
+
joblib==1.6.0
|
| 38 |
+
jsonschema==4.26.0
|
| 39 |
+
jsonschema-specifications==2025.9.1
|
| 40 |
+
kenlm==0.3.0
|
| 41 |
+
kiwisolver==1.5.1
|
| 42 |
+
kraken==7.2
|
| 43 |
+
lazy-loader==0.6
|
| 44 |
+
lightning==2.6.6
|
| 45 |
+
lightning-utilities==0.15.3
|
| 46 |
+
lxml==6.1.3
|
| 47 |
+
markdown==3.11.3
|
| 48 |
+
markdown-it-py==4.3.0
|
| 49 |
+
markupsafe==3.0.3
|
| 50 |
+
matplotlib==3.11.2
|
| 51 |
+
mdurl==0.1.2
|
| 52 |
+
mpmath==1.3.0
|
| 53 |
+
multidict==7.2.1
|
| 54 |
+
networkx==3.7
|
| 55 |
+
numpy==2.4.6
|
| 56 |
+
nvidia-cublas-cu12==12.8.4.1
|
| 57 |
+
nvidia-cuda-cupti-cu12==12.8.90
|
| 58 |
+
nvidia-cuda-nvrtc-cu12==12.8.93
|
| 59 |
+
nvidia-cuda-runtime-cu12==12.8.90
|
| 60 |
+
nvidia-cudnn-cu12==9.19.0.56
|
| 61 |
+
nvidia-cufft-cu12==11.3.3.83
|
| 62 |
+
nvidia-cufile-cu12==1.13.1.3
|
| 63 |
+
nvidia-curand-cu12==10.3.9.90
|
| 64 |
+
nvidia-cusolver-cu12==11.7.3.90
|
| 65 |
+
nvidia-cusparse-cu12==12.5.8.93
|
| 66 |
+
nvidia-cusparselt-cu12==0.7.1
|
| 67 |
+
nvidia-ml-py==13.615.71
|
| 68 |
+
nvidia-nccl-cu12==2.28.9
|
| 69 |
+
nvidia-nvjitlink-cu12==12.8.93
|
| 70 |
+
nvidia-nvshmem-cu12==3.4.5
|
| 71 |
+
nvidia-nvtx-cu12==12.8.90
|
| 72 |
+
opencv-python==5.1.0.95
|
| 73 |
+
packaging==26.3
|
| 74 |
+
pillow==13.0.0
|
| 75 |
+
platformdirs==4.14.8
|
| 76 |
+
polars==2.1.0
|
| 77 |
+
polars-runtime-32==2.1.0
|
| 78 |
+
propcache==0.5.4
|
| 79 |
+
protobuf==7.36.2
|
| 80 |
+
psutil==7.2.2
|
| 81 |
+
pyaml==26.7.0
|
| 82 |
+
pyarrow==26.0.1
|
| 83 |
+
pygments==2.21.0
|
| 84 |
+
pyparsing==3.3.3
|
| 85 |
+
python-dateutil==4.0.0
|
| 86 |
+
pytorch-lightning==2.6.6
|
| 87 |
+
pyyaml==6.0.3
|
| 88 |
+
rapidfuzz==3.14.6
|
| 89 |
+
referencing==0.37.0
|
| 90 |
+
regex==2026.11.19
|
| 91 |
+
requests==2.34.2
|
| 92 |
+
rich==14.0.0
|
| 93 |
+
rpds-py==2026.9.1
|
| 94 |
+
safetensors==0.7.0
|
| 95 |
+
scikit-image==0.26.0
|
| 96 |
+
scikit-learn==1.7.2
|
| 97 |
+
scipy==1.16.3
|
| 98 |
+
setuptools==78.1.0
|
| 99 |
+
shapely==2.1.2
|
| 100 |
+
sickle==0.7.0
|
| 101 |
+
sympy==1.14.0
|
| 102 |
+
threadpoolctl==3.6.0
|
| 103 |
+
tifffile==2026.11.16
|
| 104 |
+
torch==2.11.0+cu128
|
| 105 |
+
torchmetrics==1.9.0
|
| 106 |
+
torchvision==0.26.0+cu128
|
| 107 |
+
tqdm==4.70.1
|
| 108 |
+
triton==3.6.0
|
| 109 |
+
typing-extensions==4.16.0
|
| 110 |
+
tzdata==2026.6
|
| 111 |
+
ultralytics==8.4.216
|
| 112 |
+
ultralytics-platform==0.1.119
|
| 113 |
+
ultralytics-thop==2.2.5
|
| 114 |
+
urllib3==2.8.0
|
| 115 |
+
yarl==1.25.1
|
release/turkic-ocr-paddleocr-vl-1.6/infer.py
ADDED
|
@@ -0,0 +1,260 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python
|
| 2 |
+
"""Read word or line crops with the vision-language model in ./model (Turkic OCR, release candidate 1).
|
| 3 |
+
|
| 4 |
+
Input: one image, a folder of images, or a TSV manifest (columns id, image). Output: a TSV with the columns id and text.
|
| 5 |
+
The decoding is the one of our evaluation (CODE/scripts/r5_vlma/vlm_common.py and eval_vlm.py), copied here so the package stands alone:
|
| 6 |
+
- the single instruction "Transcribe the text in this image exactly." with one image, the model's own chat template,
|
| 7 |
+
generation prompt on, chat-template variables and answer-end token read from model/r5_export.json;
|
| 8 |
+
- greedy decoding, one beam, no repetition penalty, left padding, stop on the generation-config end ids, the tokenizer end id and
|
| 9 |
+
the trained answer-end token; at most 48 new tokens for a word crop (--unit word) or 192 for a line crop (--unit line);
|
| 10 |
+
- bfloat16 weights and inputs, scaled dot-product attention; the same code runs on CPU and on a GPU;
|
| 11 |
+
- the text written is the raw output with Unicode NFC, every run of white space turned into one space, outer white space stripped.
|
| 12 |
+
Not part of this release: the cap-retry rule of the evaluation (sampling at temperature 0.3 when the 48 or 192 token cap is hit),
|
| 13 |
+
which was a separate post-processed figure; --with-conf writes hit_cap so such rows can be found.
|
| 14 |
+
|
| 15 |
+
usage:
|
| 16 |
+
python infer.py --images crop.png --out out.tsv --unit line
|
| 17 |
+
python infer.py --images folder/ --out out.tsv --unit word --device cuda
|
| 18 |
+
python infer.py --manifest crops.tsv --out out.tsv --unit word --with-conf
|
| 19 |
+
"""
|
| 20 |
+
import os
|
| 21 |
+
|
| 22 |
+
for _k in ("HF_TOKEN", "HUGGING_FACE_HUB_TOKEN"):
|
| 23 |
+
os.environ.pop(_k, None)
|
| 24 |
+
os.environ.setdefault("HF_HUB_OFFLINE", "1")
|
| 25 |
+
os.environ.setdefault("TRANSFORMERS_OFFLINE", "1")
|
| 26 |
+
os.environ.setdefault("TOKENIZERS_PARALLELISM", "false")
|
| 27 |
+
|
| 28 |
+
import argparse # noqa: E402
|
| 29 |
+
import copy # noqa: E402
|
| 30 |
+
import csv # noqa: E402
|
| 31 |
+
import json # noqa: E402
|
| 32 |
+
import re # noqa: E402
|
| 33 |
+
import sys # noqa: E402
|
| 34 |
+
import time # noqa: E402
|
| 35 |
+
import unicodedata # noqa: E402
|
| 36 |
+
|
| 37 |
+
import torch # noqa: E402
|
| 38 |
+
import transformers # noqa: E402
|
| 39 |
+
from PIL import Image # noqa: E402
|
| 40 |
+
|
| 41 |
+
HERE = os.path.dirname(os.path.abspath(__file__))
|
| 42 |
+
INSTR = "Transcribe the text in this image exactly."
|
| 43 |
+
MAXNEW = {"word": 48, "line": 192}
|
| 44 |
+
IMG_EXT = (".png", ".jpg", ".jpeg", ".bmp", ".tif", ".tiff", ".webp")
|
| 45 |
+
_WS = re.compile(r"\s+")
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
def norm(text):
|
| 49 |
+
"""postproc.plain_output of the evaluation: NFC, white space runs to one space, outer white space stripped."""
|
| 50 |
+
return _WS.sub(" ", unicodedata.normalize("NFC", text or "")).strip()
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
# ----------------------------------------------------------------------------------------- copied from vlm_common.py
|
| 54 |
+
def template_kwargs(proc, tok):
|
| 55 |
+
"""enable_thinking=False for every model whose chat template uses that variable; others get no extra variable."""
|
| 56 |
+
texts = []
|
| 57 |
+
for o in (proc, tok):
|
| 58 |
+
ct = getattr(o, "chat_template", None)
|
| 59 |
+
if isinstance(ct, dict):
|
| 60 |
+
texts.extend(str(v) for v in ct.values())
|
| 61 |
+
elif ct:
|
| 62 |
+
texts.append(str(ct))
|
| 63 |
+
return {"enable_thinking": False} if any("enable_thinking" in t for t in texts) else {}
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
def prompt_batch(proc, imgs, tmpl_kw):
|
| 67 |
+
"""The one prompt builder (training and evaluation): user turn = one image + INSTR, generation prompt on."""
|
| 68 |
+
convs = [[{"role": "user", "content": [{"type": "image", "image": im}, {"type": "text", "text": INSTR}]}] for im in imgs]
|
| 69 |
+
return proc.apply_chat_template(convs, add_generation_prompt=True, tokenize=True, return_dict=True,
|
| 70 |
+
return_tensors="pt", padding=True, **tmpl_kw)
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
def stop_ids(model_gen_cfg, tok):
|
| 74 |
+
s = set()
|
| 75 |
+
for e in (getattr(model_gen_cfg, "eos_token_id", None), getattr(tok, "eos_token_id", None)):
|
| 76 |
+
if isinstance(e, (list, tuple)):
|
| 77 |
+
s.update(int(x) for x in e)
|
| 78 |
+
elif e is not None:
|
| 79 |
+
s.add(int(e))
|
| 80 |
+
return s
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
def gen_setup(model, tok, suffix_ids=None):
|
| 84 |
+
"""Greedy generation config. Stops on the generation-config end ids, the tokenizer eos and the trained answer-end token."""
|
| 85 |
+
gc = copy.deepcopy(model.generation_config)
|
| 86 |
+
gc.do_sample = False
|
| 87 |
+
gc.num_beams = 1
|
| 88 |
+
gc.repetition_penalty = 1.0
|
| 89 |
+
gc.no_repeat_ngram_size = 0
|
| 90 |
+
gc.temperature = None
|
| 91 |
+
gc.top_p = None
|
| 92 |
+
gc.top_k = None
|
| 93 |
+
gc.use_cache = True
|
| 94 |
+
if gc.pad_token_id is None:
|
| 95 |
+
gc.pad_token_id = tok.pad_token_id
|
| 96 |
+
stops = stop_ids(model.generation_config, tok)
|
| 97 |
+
if suffix_ids:
|
| 98 |
+
stops.add(int(suffix_ids[-1]))
|
| 99 |
+
gc.eos_token_id = sorted(stops)
|
| 100 |
+
stop_set = set(stops)
|
| 101 |
+
if gc.pad_token_id is not None:
|
| 102 |
+
stop_set.add(gc.pad_token_id)
|
| 103 |
+
return gc, sorted(stops), stop_set
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
def generate_batch(model, proc, tok, imgs, max_new, tmpl_kw, gc, stop_set, dev, dtype):
|
| 107 |
+
"""Greedy reading of a batch (tokenizer padding side must be 'left'). Returns per image: raw text, n_new, hit_cap, conf, conf_min.
|
| 108 |
+
conf = mean natural-log probability of the generated tokens up to and including the first stop token; hit_cap = generation
|
| 109 |
+
reached max_new_tokens without a stop token. (Same as vlm_common.generate_batch; the dtype of the inputs is a parameter here,
|
| 110 |
+
bfloat16 in the evaluation.)"""
|
| 111 |
+
inputs = prompt_batch(proc, imgs, tmpl_kw)
|
| 112 |
+
am = inputs["attention_mask"]
|
| 113 |
+
assert bool(am[:, -1].all()), "padding is not on the left"
|
| 114 |
+
inputs = inputs.to(dev, dtype=dtype)
|
| 115 |
+
g = copy.deepcopy(gc)
|
| 116 |
+
g.max_new_tokens = max_new
|
| 117 |
+
with torch.inference_mode():
|
| 118 |
+
out = model.generate(**inputs, generation_config=g, output_scores=True, return_dict_in_generate=True)
|
| 119 |
+
new = out.sequences[:, inputs["input_ids"].shape[1]:]
|
| 120 |
+
lp = torch.stack([torch.log_softmax(s.float(), dim=-1).gather(1, new[:, t:t + 1]).squeeze(1)
|
| 121 |
+
for t, s in enumerate(out.scores[: new.shape[1]])], dim=1).cpu()
|
| 122 |
+
texts = tok.batch_decode(new, skip_special_tokens=True, clean_up_tokenization_spaces=False)
|
| 123 |
+
recs = []
|
| 124 |
+
for r in range(new.shape[0]):
|
| 125 |
+
row = new[r].tolist()
|
| 126 |
+
n_new, hit = len(row), False
|
| 127 |
+
for j, t in enumerate(row):
|
| 128 |
+
if t in stop_set:
|
| 129 |
+
n_new, hit = j + 1, True
|
| 130 |
+
break
|
| 131 |
+
v = lp[r, :n_new]
|
| 132 |
+
recs.append({"raw": texts[r], "n_new": n_new, "hit_cap": (not hit) and n_new >= max_new,
|
| 133 |
+
"conf": round(float(v.mean()), 6) if n_new else None,
|
| 134 |
+
"conf_min": round(float(v.min()), 6) if n_new else None})
|
| 135 |
+
return recs
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
# ----------------------------------------------------------------------------------------- the reader
|
| 139 |
+
class Reader:
|
| 140 |
+
"""Loads the model of this package once; read() turns PIL images into texts."""
|
| 141 |
+
|
| 142 |
+
def __init__(self, model_dir=None, device="auto", dtype="bfloat16", threads=0):
|
| 143 |
+
self.model_dir = model_dir or os.path.join(HERE, "model")
|
| 144 |
+
if device == "auto":
|
| 145 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 146 |
+
self.dev = device
|
| 147 |
+
self.dtype = {"bfloat16": torch.bfloat16, "float32": torch.float32}[dtype]
|
| 148 |
+
if threads:
|
| 149 |
+
torch.set_num_threads(threads)
|
| 150 |
+
if device.startswith("cuda"):
|
| 151 |
+
# performance only, as in the evaluation: the cuDNN backend of scaled_dot_product_attention builds a new plan for every
|
| 152 |
+
# new sequence shape; the flash / memory-efficient / math backends are used instead
|
| 153 |
+
torch.backends.cuda.enable_cudnn_sdp(False)
|
| 154 |
+
assert not any(f.endswith(".py") for f in os.listdir(self.model_dir)), "a .py file in the model folder"
|
| 155 |
+
self.proc = transformers.AutoProcessor.from_pretrained(self.model_dir, trust_remote_code=False)
|
| 156 |
+
self.tok = getattr(self.proc, "tokenizer", self.proc)
|
| 157 |
+
if getattr(self.tok, "pad_token_id", None) is None:
|
| 158 |
+
self.tok.pad_token = self.tok.eos_token
|
| 159 |
+
self.tok.padding_side = "left"
|
| 160 |
+
with open(os.path.join(self.model_dir, "r5_export.json"), encoding="utf-8") as f:
|
| 161 |
+
self.export = json.load(f)
|
| 162 |
+
self.tmpl_kw = self.export.get("chat_template_kwargs", template_kwargs(self.proc, self.tok))
|
| 163 |
+
model, info = transformers.AutoModelForImageTextToText.from_pretrained(
|
| 164 |
+
self.model_dir, dtype=self.dtype, trust_remote_code=False, use_safetensors=True, attn_implementation="sdpa",
|
| 165 |
+
output_loading_info=True)
|
| 166 |
+
bad = {k: list(info.get(k, []))[:10] for k in ("missing_keys", "unexpected_keys", "mismatched_keys") if info.get(k)}
|
| 167 |
+
if bad:
|
| 168 |
+
raise RuntimeError("the exported checkpoint does not reload exactly: " + json.dumps(bad)[:600])
|
| 169 |
+
self.model = model.to(self.dev).eval()
|
| 170 |
+
self.gc, self.stops, self.stop_set = gen_setup(self.model, self.tok, self.export.get("answer_suffix_ids"))
|
| 171 |
+
|
| 172 |
+
def read(self, images, unit="line", batch_size=16):
|
| 173 |
+
"""images: list of PIL images (RGB). Returns a list of dicts (raw, text, n_new, hit_cap, conf, conf_min), same order."""
|
| 174 |
+
max_new = MAXNEW[unit]
|
| 175 |
+
out = []
|
| 176 |
+
for b in range(0, len(images), batch_size):
|
| 177 |
+
chunk = images[b:b + batch_size]
|
| 178 |
+
try:
|
| 179 |
+
recs = generate_batch(self.model, self.proc, self.tok, chunk, max_new, self.tmpl_kw, self.gc, self.stop_set,
|
| 180 |
+
self.dev, self.dtype)
|
| 181 |
+
except Exception as ex: # noqa: BLE001 (as in the evaluation: one at a time, an unreadable image gives an empty text)
|
| 182 |
+
sys.stderr.write("batch failed (%s); reading one image at a time\n" % repr(ex)[:150])
|
| 183 |
+
recs = []
|
| 184 |
+
for im in chunk:
|
| 185 |
+
try:
|
| 186 |
+
recs += generate_batch(self.model, self.proc, self.tok, [im], max_new, self.tmpl_kw, self.gc, self.stop_set,
|
| 187 |
+
self.dev, self.dtype)
|
| 188 |
+
except Exception as ex2: # noqa: BLE001
|
| 189 |
+
recs.append({"raw": "", "n_new": 0, "hit_cap": False, "conf": None, "conf_min": None, "error": repr(ex2)[:200]})
|
| 190 |
+
for r in recs:
|
| 191 |
+
r["text"] = norm(r["raw"])
|
| 192 |
+
out += recs
|
| 193 |
+
return out
|
| 194 |
+
|
| 195 |
+
|
| 196 |
+
# ----------------------------------------------------------------------------------------- input and output
|
| 197 |
+
def collect_inputs(images=None, manifest=None):
|
| 198 |
+
"""List of (id, path). A manifest is a TSV with a header and the columns id and image (other columns are ignored)."""
|
| 199 |
+
if manifest:
|
| 200 |
+
rows = []
|
| 201 |
+
with open(manifest, encoding="utf-8", newline="") as f:
|
| 202 |
+
for r in csv.DictReader(f, delimiter="\t", quoting=csv.QUOTE_NONE):
|
| 203 |
+
rows.append((r["id"], r["image"]))
|
| 204 |
+
return rows
|
| 205 |
+
if os.path.isdir(images):
|
| 206 |
+
names = sorted(n for n in os.listdir(images) if n.lower().endswith(IMG_EXT))
|
| 207 |
+
return [(n, os.path.join(images, n)) for n in names]
|
| 208 |
+
return [(os.path.basename(images), images)]
|
| 209 |
+
|
| 210 |
+
|
| 211 |
+
def main():
|
| 212 |
+
ap = argparse.ArgumentParser(description=__doc__.split("\n")[0])
|
| 213 |
+
g = ap.add_mutually_exclusive_group(required=True)
|
| 214 |
+
g.add_argument("--images", help="one image file or a folder of images (ids are the file names)")
|
| 215 |
+
g.add_argument("--manifest", help="TSV with a header and the columns id and image")
|
| 216 |
+
ap.add_argument("--out", default="-", help="output TSV (default: standard output)")
|
| 217 |
+
ap.add_argument("--unit", choices=["word", "line"], default="line", help="word crop: at most 48 new tokens; line crop: 192")
|
| 218 |
+
ap.add_argument("--batch-size", type=int, default=16)
|
| 219 |
+
ap.add_argument("--device", default="auto", help="auto, cpu, cuda or cuda:N")
|
| 220 |
+
ap.add_argument("--dtype", choices=["bfloat16", "float32"], default="bfloat16", help="bfloat16 is what was evaluated")
|
| 221 |
+
ap.add_argument("--threads", type=int, default=0, help="CPU threads (0 = torch default)")
|
| 222 |
+
ap.add_argument("--model-dir", default=None, help="default: the model folder next to this script")
|
| 223 |
+
ap.add_argument("--with-conf", action="store_true", help="add the columns conf and hit_cap")
|
| 224 |
+
ap.add_argument("--report-modules", default=None, help="write the file paths of all loaded Python modules to this JSON (checks)")
|
| 225 |
+
a = ap.parse_args()
|
| 226 |
+
items = collect_inputs(a.images, a.manifest)
|
| 227 |
+
t0 = time.time()
|
| 228 |
+
reader = Reader(a.model_dir, a.device, a.dtype, a.threads)
|
| 229 |
+
t_load = time.time() - t0
|
| 230 |
+
imgs, keep = [], []
|
| 231 |
+
for i, (rid, p) in enumerate(items):
|
| 232 |
+
try:
|
| 233 |
+
imgs.append(Image.open(p).convert("RGB"))
|
| 234 |
+
keep.append(i)
|
| 235 |
+
except Exception as ex: # noqa: BLE001
|
| 236 |
+
sys.stderr.write("cannot read %s: %s\n" % (p, repr(ex)[:120]))
|
| 237 |
+
t1 = time.time()
|
| 238 |
+
recs = reader.read(imgs, a.unit, a.batch_size)
|
| 239 |
+
res = {items[i][0]: r for i, r in zip(keep, recs)}
|
| 240 |
+
fo = sys.stdout if a.out == "-" else open(a.out, "w", encoding="utf-8", newline="")
|
| 241 |
+
fo.write("id\ttext" + ("\tconf\thit_cap" if a.with_conf else "") + "\n")
|
| 242 |
+
for rid, _ in items:
|
| 243 |
+
r = res.get(rid)
|
| 244 |
+
text = r["text"] if r else ""
|
| 245 |
+
if a.with_conf:
|
| 246 |
+
fo.write("%s\t%s\t%s\t%d\n" % (rid, text, "" if not r or r["conf"] is None else r["conf"], int(bool(r and r["hit_cap"]))))
|
| 247 |
+
else:
|
| 248 |
+
fo.write("%s\t%s\n" % (rid, text))
|
| 249 |
+
if fo is not sys.stdout:
|
| 250 |
+
fo.close()
|
| 251 |
+
sys.stderr.write("read %d images on %s (%s) in %.1f s (model load %.1f s); transformers %s, torch %s\n" % (
|
| 252 |
+
len(imgs), reader.dev, a.dtype, time.time() - t1, t_load, transformers.__version__, torch.__version__))
|
| 253 |
+
if a.report_modules:
|
| 254 |
+
mods = sorted({getattr(m, "__file__", None) for m in sys.modules.values() if getattr(m, "__file__", None)})
|
| 255 |
+
with open(a.report_modules, "w", encoding="utf-8") as f:
|
| 256 |
+
json.dump({"script": os.path.abspath(__file__), "modules": mods, "sys_path": sys.path}, f, indent=1)
|
| 257 |
+
|
| 258 |
+
|
| 259 |
+
if __name__ == "__main__":
|
| 260 |
+
main()
|
release/turkic-ocr-paddleocr-vl-1.6/requirements.txt
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Exact package versions of the environment this model was evaluated in: CODE/.venv_vlm, Python 3.12.13.
|
| 2 |
+
# Frozen with `uv pip freeze` on 2026-11-25 (cluster job 55104, file DATA/tmp/rc1_check/freeze_vlm.txt).
|
| 3 |
+
# torch and torchvision are the CUDA 12.8 builds ("+cu128"); the index line below lets pip find them. On a machine without a GPU the same
|
| 4 |
+
# versions run on the CPU (bfloat16 matrix products are used on CPU as well), or install torch==2.11.0 and torchvision==0.26.0 from PyPI.
|
| 5 |
+
--extra-index-url https://download.pytorch.org/whl/cu128
|
| 6 |
+
accelerate==1.16.0
|
| 7 |
+
annotated-doc==0.0.7
|
| 8 |
+
annotated-types==0.8.0
|
| 9 |
+
anyio==4.16.0
|
| 10 |
+
click==8.5.1
|
| 11 |
+
cuda-bindings==12.9.7
|
| 12 |
+
cuda-pathfinder==1.6.0
|
| 13 |
+
cuda-toolkit==12.8.1
|
| 14 |
+
filelock==4.2.4
|
| 15 |
+
fsspec==2026.9.0
|
| 16 |
+
h11==0.16.0
|
| 17 |
+
hf-xet==1.8.0
|
| 18 |
+
httpcore2==2.16.2
|
| 19 |
+
httpx2==2.16.2
|
| 20 |
+
huggingface-hub==2.4.0
|
| 21 |
+
idna==3.20
|
| 22 |
+
jinja2==3.1.6
|
| 23 |
+
markdown-it-py==4.3.0
|
| 24 |
+
markupsafe==3.0.3
|
| 25 |
+
mdurl==0.1.2
|
| 26 |
+
mpmath==1.3.0
|
| 27 |
+
networkx==3.7
|
| 28 |
+
numpy==2.5.4
|
| 29 |
+
nvidia-cublas-cu12==12.8.4.1
|
| 30 |
+
nvidia-cuda-cupti-cu12==12.8.90
|
| 31 |
+
nvidia-cuda-nvrtc-cu12==12.8.93
|
| 32 |
+
nvidia-cuda-runtime-cu12==12.8.90
|
| 33 |
+
nvidia-cudnn-cu12==9.19.0.56
|
| 34 |
+
nvidia-cufft-cu12==11.3.3.83
|
| 35 |
+
nvidia-cufile-cu12==1.13.1.3
|
| 36 |
+
nvidia-curand-cu12==10.3.9.90
|
| 37 |
+
nvidia-cusolver-cu12==11.7.3.90
|
| 38 |
+
nvidia-cusparse-cu12==12.5.8.93
|
| 39 |
+
nvidia-cusparselt-cu12==0.7.1
|
| 40 |
+
nvidia-nccl-cu12==2.28.9
|
| 41 |
+
nvidia-nvjitlink-cu12==12.8.93
|
| 42 |
+
nvidia-nvshmem-cu12==3.4.5
|
| 43 |
+
nvidia-nvtx-cu12==12.8.90
|
| 44 |
+
packaging==26.3
|
| 45 |
+
pillow==13.0.0
|
| 46 |
+
protobuf==7.36.2
|
| 47 |
+
psutil==7.2.2
|
| 48 |
+
pydantic==2.14.4
|
| 49 |
+
pydantic-core==2.50.5
|
| 50 |
+
pygments==2.21.0
|
| 51 |
+
pyyaml==6.0.3
|
| 52 |
+
regex==2026.11.19
|
| 53 |
+
rich==15.0.0
|
| 54 |
+
safetensors==0.8.0
|
| 55 |
+
sentencepiece==0.2.3
|
| 56 |
+
setuptools==78.1.0
|
| 57 |
+
shellingham==1.5.4
|
| 58 |
+
sympy==1.14.0
|
| 59 |
+
tokenizers==0.23.3
|
| 60 |
+
torch==2.11.0+cu128
|
| 61 |
+
torchvision==0.26.0+cu128
|
| 62 |
+
tqdm==4.70.1
|
| 63 |
+
transformers==5.23.0
|
| 64 |
+
triton==3.6.0
|
| 65 |
+
truststore==0.10.5
|
| 66 |
+
typer==0.29.2
|
| 67 |
+
typing-extensions==4.16.0
|
| 68 |
+
typing-inspection==0.4.5
|
release/turkic-ocr-ppocrv6-medium/infer.py
ADDED
|
@@ -0,0 +1,363 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python
|
| 2 |
+
"""Read word or line crops with the small recognizer A1 (kraken PP-OCRv6 medium, our checkpoint long2x) - Turkic OCR, release candidate 1.
|
| 3 |
+
|
| 4 |
+
Input: one image, a folder of images, or a TSV manifest (columns id, image). Output: a TSV with the columns id and text.
|
| 5 |
+
The code path is the one of our evaluation (CODE/src/linedet/data.py, models.py, predict.py, lm_decode.py, lm_gate.py), copied here so
|
| 6 |
+
the package stands alone:
|
| 7 |
+
- image: RGB, scaled to 96 px height with Lanczos (width keeps the aspect ratio), 16 px white padding left and right, scaled to
|
| 8 |
+
[0, 1], inverted (ink bright); a batch is padded with zeros on the right to its widest image;
|
| 9 |
+
- BATCH PADDING MATTERS (read this before using the output): the network is NOT invariant to the zero padding of a batch. The
|
| 10 |
+
squeeze-and-excite layers of kraken's backbone average over the whole padded width (kraken/lib/ppocr/backbone.py, SELayer), while only
|
| 11 |
+
the attention of the neck masks the padded columns (network.py, _lengths_and_mask). The evaluation read batches of 32 sorted by
|
| 12 |
+
LABEL length, so every batch carried white margin on its narrower crops, and the network was trained that way; without labels that
|
| 13 |
+
cannot be repeated. Measured on the 3,678 KOHTD validation crops V1 (greedy, CPU float32, character error rate; jobs 55155 and
|
| 14 |
+
55176): evaluation batches 6.2% (the recorded GPU file: 6.2%); batches sorted by width 14.1%; every crop alone 14.2%; batches in
|
| 15 |
+
manifest order 7.9%; in a seeded shuffle 7.3%; sorted by width plus 64, 128, 256, 512, 1024 extra zero columns: 10.4%, 8.1%, 6.55%,
|
| 16 |
+
6.50%, 7.5%. This script therefore sorts by width and appends --batch-pad (default 256) zero columns to every batch: a label-free
|
| 17 |
+
approximation chosen on V1 (word crops; the value for line crops is untested), not the evaluation's own condition. To reproduce the
|
| 18 |
+
evaluation use --sort none --batch-pad 0 --batch-size 32 with the crops listed in the order of their label length (stable sort);
|
| 19 |
+
- network: kraken 7.2 PP-OCRv6 medium (weights in model/model.safetensors, character codec in model/codec.json); on a GPU the
|
| 20 |
+
forward pass runs under bfloat16 autocast as in the evaluation, on the CPU in float32;
|
| 21 |
+
- --decode greedy (default): CTC greedy decoding (argmax per frame, collapse repeats, drop the blank), NFC;
|
| 22 |
+
- --decode lm: CTC prefix beam search, beam 16, with the KenLM character 6-gram in lm/char6.klm, alpha 0.40, beta 1.00, the top 6
|
| 23 |
+
labels of every frame (stored as int16 and float16 as in the evaluation), prune -10;
|
| 24 |
+
- --decode lm_gated: as lm, but a row whose greedy output is empty or only white space gets the empty text (the gate "H9" of the
|
| 25 |
+
evaluation). This is the decoding named long2x_lm_gated in our result files.
|
| 26 |
+
|
| 27 |
+
usage:
|
| 28 |
+
python infer.py --images crop.png --out out.tsv
|
| 29 |
+
python infer.py --images folder/ --out out.tsv --decode lm_gated --device cuda
|
| 30 |
+
python infer.py --manifest crops.tsv --out out.tsv --decode lm_gated --with-conf
|
| 31 |
+
"""
|
| 32 |
+
import os
|
| 33 |
+
|
| 34 |
+
os.environ.setdefault("HF_HUB_OFFLINE", "1")
|
| 35 |
+
|
| 36 |
+
import argparse # noqa: E402
|
| 37 |
+
import csv # noqa: E402
|
| 38 |
+
import json # noqa: E402
|
| 39 |
+
import math # noqa: E402
|
| 40 |
+
import sys # noqa: E402
|
| 41 |
+
import time # noqa: E402
|
| 42 |
+
import unicodedata # noqa: E402
|
| 43 |
+
|
| 44 |
+
import numpy as np # noqa: E402
|
| 45 |
+
import torch # noqa: E402
|
| 46 |
+
import torch.nn.functional as F # noqa: E402
|
| 47 |
+
from PIL import Image # noqa: E402
|
| 48 |
+
from safetensors.torch import load_file # noqa: E402
|
| 49 |
+
|
| 50 |
+
HERE = os.path.dirname(os.path.abspath(__file__))
|
| 51 |
+
IMG_EXT = (".png", ".jpg", ".jpeg", ".bmp", ".tif", ".tiff", ".webp")
|
| 52 |
+
PAD = 16
|
| 53 |
+
BATCH_PAD_DEFAULT = 256 # extra zero columns per batch, chosen on V1 from {0, 64, 128, 256, 512, 1024} (job 55176)
|
| 54 |
+
TOPK = 6
|
| 55 |
+
BEAM = 16
|
| 56 |
+
ALPHA, BETA = 0.40, 1.00
|
| 57 |
+
SP_TOKEN = "▁"
|
| 58 |
+
NEG = -1e30
|
| 59 |
+
LN10 = math.log(10.0)
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
# ----------------------------------------------------------------------------------------- images (data.py pil_tensor, collate)
|
| 63 |
+
def pil_tensor(im, height):
|
| 64 |
+
im = im.convert("RGB")
|
| 65 |
+
w, h = im.size
|
| 66 |
+
nw = max(int(w * height / h), 1)
|
| 67 |
+
im = im.resize((nw, height), Image.LANCZOS)
|
| 68 |
+
arr = np.asarray(im, dtype=np.uint8)
|
| 69 |
+
arr = np.pad(arr, ((0, 0), (PAD, PAD), (0, 0)), constant_values=255)
|
| 70 |
+
t = torch.from_numpy(arr).permute(2, 0, 1).float().div_(255.0)
|
| 71 |
+
return t.max() - t
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
def collate(tensors):
|
| 75 |
+
seq_lens = torch.LongTensor([s.shape[2] for s in tensors])
|
| 76 |
+
wmax = int(seq_lens.max())
|
| 77 |
+
return torch.stack([F.pad(s, (0, wmax - s.shape[2])) for s in tensors]), seq_lens
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
# ----------------------------------------------------------------------------------------- network (models.py PPOCRArm.infer)
|
| 81 |
+
class Recognizer:
|
| 82 |
+
def __init__(self, model_dir=None, device="auto", threads=0):
|
| 83 |
+
from kraken.lib.codec import PytorchCodec
|
| 84 |
+
from kraken.lib.ppocr import PPOCRv6Model
|
| 85 |
+
self.model_dir = model_dir or os.path.join(HERE, "model")
|
| 86 |
+
if device == "auto":
|
| 87 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 88 |
+
self.dev = torch.device(device)
|
| 89 |
+
if threads:
|
| 90 |
+
torch.set_num_threads(threads)
|
| 91 |
+
with open(os.path.join(self.model_dir, "config.json"), encoding="utf-8") as f:
|
| 92 |
+
self.cfg = json.load(f)
|
| 93 |
+
with open(os.path.join(self.model_dir, "codec.json"), encoding="utf-8") as f:
|
| 94 |
+
self.c2l = json.load(f)["c2l"]
|
| 95 |
+
self.codec = PytorchCodec(self.c2l)
|
| 96 |
+
self.l2c_single = self.codec.l2c_single
|
| 97 |
+
net = PPOCRv6Model(variant=self.cfg["variant"], num_classes=self.codec.max_label + 1, height=self.cfg["height"],
|
| 98 |
+
codec=self.codec.c2l, seg_type=self.cfg["seg_type"], one_channel_mode=self.cfg["one_channel_mode"],
|
| 99 |
+
legacy_polygons=self.cfg["legacy_polygons"])
|
| 100 |
+
net.load_state_dict(load_file(os.path.join(self.model_dir, "model.safetensors")), strict=True)
|
| 101 |
+
self.net = net.to(self.dev).eval()
|
| 102 |
+
self.height = self.cfg["height"]
|
| 103 |
+
|
| 104 |
+
@torch.no_grad()
|
| 105 |
+
def log_probs(self, images, seq_lens):
|
| 106 |
+
with torch.autocast("cuda", dtype=torch.bfloat16, enabled=(self.dev.type == "cuda")):
|
| 107 |
+
logits, out_lens = self.net.nn(images.to(self.dev), seq_lens.to(self.dev))
|
| 108 |
+
lp = logits.float().log_softmax(1).squeeze(2).permute(0, 2, 1) # B, T, C
|
| 109 |
+
return lp.cpu().numpy(), out_lens.cpu().numpy()
|
| 110 |
+
|
| 111 |
+
def greedy(self, lp, out_lens):
|
| 112 |
+
"""predict.greedy_strings: strings (NFD, as the codec), mean and minimum frame probability of the emitted characters."""
|
| 113 |
+
best = lp.argmax(-1)
|
| 114 |
+
bestp = np.exp(lp.max(-1))
|
| 115 |
+
res = []
|
| 116 |
+
for b in range(lp.shape[0]):
|
| 117 |
+
T = int(out_lens[b])
|
| 118 |
+
row = best[b, :T]
|
| 119 |
+
prev = 0
|
| 120 |
+
chars, confs = [], []
|
| 121 |
+
for t in range(T):
|
| 122 |
+
k = int(row[t])
|
| 123 |
+
if k != prev and k != 0:
|
| 124 |
+
chars.append(self.l2c_single.get(k, ""))
|
| 125 |
+
confs.append(float(bestp[b, t]))
|
| 126 |
+
prev = k
|
| 127 |
+
res.append(("".join(chars), float(np.mean(confs)) if confs else 1.0, float(np.min(confs)) if confs else 1.0))
|
| 128 |
+
return res
|
| 129 |
+
|
| 130 |
+
@staticmethod
|
| 131 |
+
def topk(lp, out_lens):
|
| 132 |
+
"""predict.run_set: the top-6 labels per frame, stored as int16 labels and float16 log-probabilities."""
|
| 133 |
+
k = min(TOPK, lp.shape[-1])
|
| 134 |
+
idx = np.argpartition(-lp, k - 1, axis=-1)[..., :k]
|
| 135 |
+
vals = np.take_along_axis(lp, idx, axis=-1)
|
| 136 |
+
return [(idx[j, :int(out_lens[j])].astype(np.int16), vals[j, :int(out_lens[j])].astype(np.float16)) for j in range(lp.shape[0])]
|
| 137 |
+
|
| 138 |
+
def read(self, images, batch_size=32, decode="greedy", lm=None, workers=1, sort="width", batch_pad=BATCH_PAD_DEFAULT):
|
| 139 |
+
"""images: list of PIL images. Returns a list of dicts (same order as images): text (NFC, as written), greedy (NFC), conf.
|
| 140 |
+
sort="width": the images are read in batches of similar width (narrowest first); sort="none": batches are consecutive images of
|
| 141 |
+
the input order. batch_pad: zero columns (white margin) appended on the right of every batch, on top of the padding to the
|
| 142 |
+
widest image of the batch; the real widths are passed on, so the attention of the neck ignores them, but the squeeze-and-excite
|
| 143 |
+
layers of the backbone average over them. The network is NOT invariant to this padding (see the docstring of this file), so
|
| 144 |
+
the batch and batch_pad matter."""
|
| 145 |
+
tens = [pil_tensor(im, self.height) for im in images]
|
| 146 |
+
out = [None] * len(images)
|
| 147 |
+
tops = [None] * len(images)
|
| 148 |
+
order = sorted(range(len(tens)), key=lambda i: tens[i].shape[-1]) if sort == "width" else list(range(len(tens)))
|
| 149 |
+
for b in range(0, len(order), batch_size):
|
| 150 |
+
idx = order[b:b + batch_size]
|
| 151 |
+
x, sl = collate([tens[i] for i in idx])
|
| 152 |
+
if batch_pad:
|
| 153 |
+
x = F.pad(x, (0, int(batch_pad)))
|
| 154 |
+
lp, ol = self.log_probs(x, sl)
|
| 155 |
+
res = self.greedy(lp, ol)
|
| 156 |
+
tk = self.topk(lp, ol) if decode != "greedy" else None
|
| 157 |
+
for j, i in enumerate(idx):
|
| 158 |
+
g = unicodedata.normalize("NFC", res[j][0])
|
| 159 |
+
out[i] = {"greedy": g, "text": g, "conf": res[j][1]}
|
| 160 |
+
if tk is not None:
|
| 161 |
+
tops[i] = tk[j]
|
| 162 |
+
if decode != "greedy":
|
| 163 |
+
dec = lm.decode_many([(t[0].astype(np.int64), t[1].astype(np.float32)) for t in tops], workers)
|
| 164 |
+
for i, (h, sc) in enumerate(dec):
|
| 165 |
+
hn = unicodedata.normalize("NFC", h)
|
| 166 |
+
if decode == "lm_gated" and out[i]["greedy"].strip() == "":
|
| 167 |
+
out[i]["text"] = ""
|
| 168 |
+
else:
|
| 169 |
+
out[i]["text"] = hn
|
| 170 |
+
out[i]["conf"] = sc
|
| 171 |
+
out[i]["lm_raw"] = hn
|
| 172 |
+
return out
|
| 173 |
+
|
| 174 |
+
|
| 175 |
+
# ----------------------------------------------------------------------------------------- character language model (lm_decode.py)
|
| 176 |
+
_LM = None
|
| 177 |
+
_L2C = None
|
| 178 |
+
|
| 179 |
+
|
| 180 |
+
def _init_lm(lm_path, c2l):
|
| 181 |
+
global _LM, _L2C
|
| 182 |
+
import kenlm
|
| 183 |
+
_LM = kenlm.Model(lm_path)
|
| 184 |
+
_L2C = {v[0]: k for k, v in c2l.items() if len(v) == 1}
|
| 185 |
+
|
| 186 |
+
|
| 187 |
+
def _lse(a, b):
|
| 188 |
+
if a < b:
|
| 189 |
+
a, b = b, a
|
| 190 |
+
if b <= NEG:
|
| 191 |
+
return a
|
| 192 |
+
return a + math.log1p(math.exp(b - a))
|
| 193 |
+
|
| 194 |
+
|
| 195 |
+
def beam_search(idx, lp, alpha, beta, beam=BEAM, prune=-10.0):
|
| 196 |
+
"""CTC prefix beam search with a KenLM character model. idx (T,K) int labels, lp (T,K) natural-log probabilities (the top-K of
|
| 197 |
+
each frame), blank is label 0. Returns (best prefix as a string in NFD, normalised score). lm_decode.beam_search, unchanged."""
|
| 198 |
+
import kenlm
|
| 199 |
+
lm = _LM
|
| 200 |
+
st0 = kenlm.State()
|
| 201 |
+
lm.BeginSentenceWrite(st0)
|
| 202 |
+
beams = {(): [0.0, NEG, 0.0, st0]} # prefix -> [p_blank, p_nonblank, lm_total(weighted), state]
|
| 203 |
+
lm_cache = {}
|
| 204 |
+
|
| 205 |
+
def lm_extend(prefix, c):
|
| 206 |
+
key = (prefix, c)
|
| 207 |
+
r = lm_cache.get(key)
|
| 208 |
+
if r is None:
|
| 209 |
+
parent = beams.get(prefix)
|
| 210 |
+
pstate = parent[3] if parent is not None else lm_cache[("state", prefix)]
|
| 211 |
+
out = kenlm.State()
|
| 212 |
+
tok = _L2C.get(c, "")
|
| 213 |
+
tok = SP_TOKEN if tok == " " else tok
|
| 214 |
+
s = lm.BaseScore(pstate, tok, out) * LN10
|
| 215 |
+
r = (alpha * s + beta, out)
|
| 216 |
+
lm_cache[key] = r
|
| 217 |
+
return r
|
| 218 |
+
|
| 219 |
+
for t in range(idx.shape[0]):
|
| 220 |
+
cand = {}
|
| 221 |
+
ids = idx[t]
|
| 222 |
+
lps = lp[t].astype(np.float64)
|
| 223 |
+
pb_t = None
|
| 224 |
+
for j in range(len(ids)):
|
| 225 |
+
if int(ids[j]) == 0:
|
| 226 |
+
pb_t = float(lps[j])
|
| 227 |
+
if pb_t is None:
|
| 228 |
+
pb_t = -20.0
|
| 229 |
+
for prefix, (pb, pnb, lmt, st) in beams.items():
|
| 230 |
+
tot = _lse(pb, pnb)
|
| 231 |
+
e = cand.get(prefix)
|
| 232 |
+
if e is None:
|
| 233 |
+
cand[prefix] = [tot + pb_t, NEG, lmt, st]
|
| 234 |
+
else:
|
| 235 |
+
e[0] = _lse(e[0], tot + pb_t)
|
| 236 |
+
for j in range(len(ids)):
|
| 237 |
+
c = int(ids[j])
|
| 238 |
+
if c == 0:
|
| 239 |
+
continue
|
| 240 |
+
p = float(lps[j])
|
| 241 |
+
if p < prune:
|
| 242 |
+
continue
|
| 243 |
+
last = prefix[-1] if prefix else None
|
| 244 |
+
if c == last:
|
| 245 |
+
e = cand.get(prefix)
|
| 246 |
+
if e is None:
|
| 247 |
+
cand[prefix] = [NEG, pnb + p, lmt, st]
|
| 248 |
+
else:
|
| 249 |
+
e[1] = _lse(e[1], pnb + p)
|
| 250 |
+
src = pb
|
| 251 |
+
else:
|
| 252 |
+
src = tot
|
| 253 |
+
if src <= NEG:
|
| 254 |
+
continue
|
| 255 |
+
newp = prefix + (c,)
|
| 256 |
+
lm_cache[("state", prefix)] = st
|
| 257 |
+
add, nst = lm_extend(prefix, c)
|
| 258 |
+
e = cand.get(newp)
|
| 259 |
+
if e is None:
|
| 260 |
+
cand[newp] = [NEG, src + p, lmt + add, nst]
|
| 261 |
+
else:
|
| 262 |
+
e[1] = _lse(e[1], src + p)
|
| 263 |
+
items = sorted(cand.items(), key=lambda kv: _lse(kv[1][0], kv[1][1]) + kv[1][2], reverse=True)[:beam]
|
| 264 |
+
beams = {k: v for k, v in items}
|
| 265 |
+
best, best_s = (), NEG
|
| 266 |
+
for prefix, (pb, pnb, lmt, st) in beams.items():
|
| 267 |
+
out = kenlm.State()
|
| 268 |
+
eos = lm.BaseScore(st, "</s>", out) * LN10
|
| 269 |
+
s = _lse(pb, pnb) + lmt + alpha * eos
|
| 270 |
+
if s > best_s:
|
| 271 |
+
best, best_s = prefix, s
|
| 272 |
+
text = "".join(_L2C.get(c, "") for c in best)
|
| 273 |
+
return text, (best_s / max(len(best), 1) if best_s > NEG else float("nan"))
|
| 274 |
+
|
| 275 |
+
|
| 276 |
+
def _decode_one(args):
|
| 277 |
+
idx, lp, alpha, beta = args
|
| 278 |
+
return beam_search(idx, lp, alpha, beta)
|
| 279 |
+
|
| 280 |
+
|
| 281 |
+
class CharLM:
|
| 282 |
+
def __init__(self, lm_path, c2l, alpha=ALPHA, beta=BETA):
|
| 283 |
+
self.lm_path, self.c2l, self.alpha, self.beta = lm_path, c2l, alpha, beta
|
| 284 |
+
_init_lm(lm_path, c2l)
|
| 285 |
+
|
| 286 |
+
def decode_many(self, items, workers=1):
|
| 287 |
+
jobs = [(i, l, self.alpha, self.beta) for i, l in items]
|
| 288 |
+
if workers > 1 and len(jobs) > 1:
|
| 289 |
+
import multiprocessing as mp
|
| 290 |
+
with mp.get_context("spawn").Pool(workers, initializer=_init_lm, initargs=(self.lm_path, self.c2l)) as pool:
|
| 291 |
+
return pool.map(_decode_one, jobs, chunksize=8)
|
| 292 |
+
return [_decode_one(j) for j in jobs]
|
| 293 |
+
|
| 294 |
+
|
| 295 |
+
# ----------------------------------------------------------------------------------------- input and output
|
| 296 |
+
def collect_inputs(images=None, manifest=None):
|
| 297 |
+
"""List of (id, path). A manifest is a TSV with a header and the columns id and image (other columns are ignored)."""
|
| 298 |
+
if manifest:
|
| 299 |
+
rows = []
|
| 300 |
+
with open(manifest, encoding="utf-8", newline="") as f:
|
| 301 |
+
for r in csv.DictReader(f, delimiter="\t", quoting=csv.QUOTE_NONE):
|
| 302 |
+
rows.append((r["id"], r["image"]))
|
| 303 |
+
return rows
|
| 304 |
+
if os.path.isdir(images):
|
| 305 |
+
names = sorted(n for n in os.listdir(images) if n.lower().endswith(IMG_EXT))
|
| 306 |
+
return [(n, os.path.join(images, n)) for n in names]
|
| 307 |
+
return [(os.path.basename(images), images)]
|
| 308 |
+
|
| 309 |
+
|
| 310 |
+
def main():
|
| 311 |
+
ap = argparse.ArgumentParser(description=__doc__.split("\n")[0])
|
| 312 |
+
g = ap.add_mutually_exclusive_group(required=True)
|
| 313 |
+
g.add_argument("--images", help="one image file or a folder of images (ids are the file names)")
|
| 314 |
+
g.add_argument("--manifest", help="TSV with a header and the columns id and image")
|
| 315 |
+
ap.add_argument("--out", default="-", help="output TSV (default: standard output)")
|
| 316 |
+
ap.add_argument("--decode", choices=["greedy", "lm", "lm_gated"], default="greedy")
|
| 317 |
+
ap.add_argument("--batch-size", type=int, default=32)
|
| 318 |
+
ap.add_argument("--sort", choices=["width", "none"], default="width",
|
| 319 |
+
help="width (default): read images of similar width together, narrowest first; none: batches follow the input order. "
|
| 320 |
+
"The network's output can depend on the batch (padding), see the limits in model_card.json")
|
| 321 |
+
ap.add_argument("--batch-pad", type=int, default=BATCH_PAD_DEFAULT,
|
| 322 |
+
help="zero columns appended on the right of every batch (default %d); 0 = only the padding to the widest image of the batch" % BATCH_PAD_DEFAULT)
|
| 323 |
+
ap.add_argument("--device", default="auto", help="auto, cpu, cuda or cuda:N")
|
| 324 |
+
ap.add_argument("--threads", type=int, default=0, help="CPU threads (0 = torch default)")
|
| 325 |
+
ap.add_argument("--workers", type=int, default=1, help="processes for the language-model beam search")
|
| 326 |
+
ap.add_argument("--model-dir", default=None, help="default: the model folder next to this script")
|
| 327 |
+
ap.add_argument("--lm", default=None, help="default: lm/char6.klm next to this script")
|
| 328 |
+
ap.add_argument("--with-conf", action="store_true",
|
| 329 |
+
help="add the column conf (greedy: mean frame probability of the emitted characters; lm: beam score per character)")
|
| 330 |
+
ap.add_argument("--report-modules", default=None, help="write the file paths of all loaded Python modules to this JSON (checks)")
|
| 331 |
+
a = ap.parse_args()
|
| 332 |
+
items = collect_inputs(a.images, a.manifest)
|
| 333 |
+
t0 = time.time()
|
| 334 |
+
rec = Recognizer(a.model_dir, a.device, a.threads)
|
| 335 |
+
lm = CharLM(a.lm or os.path.join(HERE, "lm", "char6.klm"), rec.c2l) if a.decode != "greedy" else None
|
| 336 |
+
t_load = time.time() - t0
|
| 337 |
+
imgs, keep = [], []
|
| 338 |
+
for i, (rid, p) in enumerate(items):
|
| 339 |
+
try:
|
| 340 |
+
imgs.append(Image.open(p).convert("RGB"))
|
| 341 |
+
keep.append(i)
|
| 342 |
+
except Exception as ex: # noqa: BLE001
|
| 343 |
+
sys.stderr.write("cannot read %s: %s\n" % (p, repr(ex)[:120]))
|
| 344 |
+
t1 = time.time()
|
| 345 |
+
outs = rec.read(imgs, a.batch_size, a.decode, lm, a.workers, a.sort, a.batch_pad)
|
| 346 |
+
res = {items[i][0]: r for i, r in zip(keep, outs)}
|
| 347 |
+
fo = sys.stdout if a.out == "-" else open(a.out, "w", encoding="utf-8", newline="")
|
| 348 |
+
fo.write("id\ttext" + ("\tconf" if a.with_conf else "") + "\n")
|
| 349 |
+
for rid, _ in items:
|
| 350 |
+
r = res.get(rid)
|
| 351 |
+
text = (r["text"] if r else "").replace("\t", " ").replace("\n", " ")
|
| 352 |
+
fo.write("%s\t%s%s\n" % (rid, text, ("\t%.4f" % r["conf"]) if (a.with_conf and r) else ("\t" if a.with_conf else "")))
|
| 353 |
+
if fo is not sys.stdout:
|
| 354 |
+
fo.close()
|
| 355 |
+
sys.stderr.write("read %d images on %s, decode %s, in %.1f s (load %.1f s)\n" % (len(imgs), rec.dev, a.decode, time.time() - t1, t_load))
|
| 356 |
+
if a.report_modules:
|
| 357 |
+
mods = sorted({getattr(m, "__file__", None) for m in sys.modules.values() if getattr(m, "__file__", None)})
|
| 358 |
+
with open(a.report_modules, "w", encoding="utf-8") as f:
|
| 359 |
+
json.dump({"script": os.path.abspath(__file__), "modules": mods, "sys_path": sys.path}, f, indent=1)
|
| 360 |
+
|
| 361 |
+
|
| 362 |
+
if __name__ == "__main__":
|
| 363 |
+
main()
|
release/turkic-ocr-ppocrv6-medium/requirements.txt
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Exact package versions of the environment this model was trained and evaluated in: CODE/.venv_kraken, Python 3.12.13.
|
| 2 |
+
# Frozen with `uv pip freeze` on 2026-11-25 (cluster job 55104, file DATA/tmp/rc1_check/freeze_kraken.txt).
|
| 3 |
+
# What infer.py imports directly: kraken (PPOCRv6Model, PytorchCodec), torch, numpy, pillow, safetensors, and kenlm for --decode lm and lm_gated.
|
| 4 |
+
# kenlm==0.3.0 is built from source on installation (needs a C++ compiler). torch and torchvision are the CUDA 12.8 builds ("+cu128"); the
|
| 5 |
+
# index line below lets pip find them. On a machine without a GPU the same versions run on the CPU (float32 there).
|
| 6 |
+
--extra-index-url https://download.pytorch.org/whl/cu128
|
| 7 |
+
aiohappyeyeballs==2.7.1
|
| 8 |
+
aiohttp==3.14.5
|
| 9 |
+
aiosignal==1.4.0
|
| 10 |
+
anyio==4.16.0
|
| 11 |
+
atpublic==9.0.0
|
| 12 |
+
attrs==26.1.0
|
| 13 |
+
cattrs==26.2.1
|
| 14 |
+
certifi==2026.10.23
|
| 15 |
+
charset-normalizer==3.5.2
|
| 16 |
+
click==8.2.1
|
| 17 |
+
cloudpickle==3.1.3
|
| 18 |
+
contourpy==1.4.0
|
| 19 |
+
coremltools==9.0
|
| 20 |
+
cuda-bindings==12.9.7
|
| 21 |
+
cuda-pathfinder==1.6.0
|
| 22 |
+
cuda-toolkit==12.8.1
|
| 23 |
+
cycler==0.12.1
|
| 24 |
+
filelock==4.2.4
|
| 25 |
+
flufl-lock==10.0.0
|
| 26 |
+
fonttools==4.68.0
|
| 27 |
+
frozenlist==1.8.0
|
| 28 |
+
fsspec==2026.9.0
|
| 29 |
+
h11==0.16.0
|
| 30 |
+
htrmopo==0.6
|
| 31 |
+
httpcore==1.0.9
|
| 32 |
+
httpx==0.28.1
|
| 33 |
+
idna==3.20
|
| 34 |
+
imageio==2.38.2
|
| 35 |
+
iso639-lang==2.6.3
|
| 36 |
+
jinja2==3.1.6
|
| 37 |
+
joblib==1.6.0
|
| 38 |
+
jsonschema==4.26.0
|
| 39 |
+
jsonschema-specifications==2025.9.1
|
| 40 |
+
kenlm==0.3.0
|
| 41 |
+
kiwisolver==1.5.1
|
| 42 |
+
kraken==7.2
|
| 43 |
+
lazy-loader==0.6
|
| 44 |
+
lightning==2.6.6
|
| 45 |
+
lightning-utilities==0.15.3
|
| 46 |
+
lxml==6.1.3
|
| 47 |
+
markdown==3.11.3
|
| 48 |
+
markdown-it-py==4.3.0
|
| 49 |
+
markupsafe==3.0.3
|
| 50 |
+
matplotlib==3.11.2
|
| 51 |
+
mdurl==0.1.2
|
| 52 |
+
mpmath==1.3.0
|
| 53 |
+
multidict==7.2.1
|
| 54 |
+
networkx==3.7
|
| 55 |
+
numpy==2.4.6
|
| 56 |
+
nvidia-cublas-cu12==12.8.4.1
|
| 57 |
+
nvidia-cuda-cupti-cu12==12.8.90
|
| 58 |
+
nvidia-cuda-nvrtc-cu12==12.8.93
|
| 59 |
+
nvidia-cuda-runtime-cu12==12.8.90
|
| 60 |
+
nvidia-cudnn-cu12==9.19.0.56
|
| 61 |
+
nvidia-cufft-cu12==11.3.3.83
|
| 62 |
+
nvidia-cufile-cu12==1.13.1.3
|
| 63 |
+
nvidia-curand-cu12==10.3.9.90
|
| 64 |
+
nvidia-cusolver-cu12==11.7.3.90
|
| 65 |
+
nvidia-cusparse-cu12==12.5.8.93
|
| 66 |
+
nvidia-cusparselt-cu12==0.7.1
|
| 67 |
+
nvidia-ml-py==13.615.71
|
| 68 |
+
nvidia-nccl-cu12==2.28.9
|
| 69 |
+
nvidia-nvjitlink-cu12==12.8.93
|
| 70 |
+
nvidia-nvshmem-cu12==3.4.5
|
| 71 |
+
nvidia-nvtx-cu12==12.8.90
|
| 72 |
+
opencv-python==5.1.0.95
|
| 73 |
+
packaging==26.3
|
| 74 |
+
pillow==13.0.0
|
| 75 |
+
platformdirs==4.14.8
|
| 76 |
+
polars==2.1.0
|
| 77 |
+
polars-runtime-32==2.1.0
|
| 78 |
+
propcache==0.5.4
|
| 79 |
+
protobuf==7.36.2
|
| 80 |
+
psutil==7.2.2
|
| 81 |
+
pyaml==26.7.0
|
| 82 |
+
pyarrow==26.0.1
|
| 83 |
+
pygments==2.21.0
|
| 84 |
+
pyparsing==3.3.3
|
| 85 |
+
python-dateutil==4.0.0
|
| 86 |
+
pytorch-lightning==2.6.6
|
| 87 |
+
pyyaml==6.0.3
|
| 88 |
+
rapidfuzz==3.14.6
|
| 89 |
+
referencing==0.37.0
|
| 90 |
+
regex==2026.11.19
|
| 91 |
+
requests==2.34.2
|
| 92 |
+
rich==14.0.0
|
| 93 |
+
rpds-py==2026.9.1
|
| 94 |
+
safetensors==0.7.0
|
| 95 |
+
scikit-image==0.26.0
|
| 96 |
+
scikit-learn==1.7.2
|
| 97 |
+
scipy==1.16.3
|
| 98 |
+
setuptools==78.1.0
|
| 99 |
+
shapely==2.1.2
|
| 100 |
+
sickle==0.7.0
|
| 101 |
+
sympy==1.14.0
|
| 102 |
+
threadpoolctl==3.6.0
|
| 103 |
+
tifffile==2026.11.16
|
| 104 |
+
torch==2.11.0+cu128
|
| 105 |
+
torchmetrics==1.9.0
|
| 106 |
+
torchvision==0.26.0+cu128
|
| 107 |
+
tqdm==4.70.1
|
| 108 |
+
triton==3.6.0
|
| 109 |
+
typing-extensions==4.16.0
|
| 110 |
+
tzdata==2026.6
|
| 111 |
+
ultralytics==8.4.216
|
| 112 |
+
ultralytics-platform==0.1.119
|
| 113 |
+
ultralytics-thop==2.2.5
|
| 114 |
+
urllib3==2.8.0
|
| 115 |
+
yarl==1.25.1
|
release/turkic-ocr-qwen3-vl-2b/infer.py
ADDED
|
@@ -0,0 +1,260 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python
|
| 2 |
+
"""Read word or line crops with the vision-language model in ./model (Turkic OCR, release candidate 1).
|
| 3 |
+
|
| 4 |
+
Input: one image, a folder of images, or a TSV manifest (columns id, image). Output: a TSV with the columns id and text.
|
| 5 |
+
The decoding is the one of our evaluation (CODE/scripts/r5_vlma/vlm_common.py and eval_vlm.py), copied here so the package stands alone:
|
| 6 |
+
- the single instruction "Transcribe the text in this image exactly." with one image, the model's own chat template,
|
| 7 |
+
generation prompt on, chat-template variables and answer-end token read from model/r5_export.json;
|
| 8 |
+
- greedy decoding, one beam, no repetition penalty, left padding, stop on the generation-config end ids, the tokenizer end id and
|
| 9 |
+
the trained answer-end token; at most 48 new tokens for a word crop (--unit word) or 192 for a line crop (--unit line);
|
| 10 |
+
- bfloat16 weights and inputs, scaled dot-product attention; the same code runs on CPU and on a GPU;
|
| 11 |
+
- the text written is the raw output with Unicode NFC, every run of white space turned into one space, outer white space stripped.
|
| 12 |
+
Not part of this release: the cap-retry rule of the evaluation (sampling at temperature 0.3 when the 48 or 192 token cap is hit),
|
| 13 |
+
which was a separate post-processed figure; --with-conf writes hit_cap so such rows can be found.
|
| 14 |
+
|
| 15 |
+
usage:
|
| 16 |
+
python infer.py --images crop.png --out out.tsv --unit line
|
| 17 |
+
python infer.py --images folder/ --out out.tsv --unit word --device cuda
|
| 18 |
+
python infer.py --manifest crops.tsv --out out.tsv --unit word --with-conf
|
| 19 |
+
"""
|
| 20 |
+
import os
|
| 21 |
+
|
| 22 |
+
for _k in ("HF_TOKEN", "HUGGING_FACE_HUB_TOKEN"):
|
| 23 |
+
os.environ.pop(_k, None)
|
| 24 |
+
os.environ.setdefault("HF_HUB_OFFLINE", "1")
|
| 25 |
+
os.environ.setdefault("TRANSFORMERS_OFFLINE", "1")
|
| 26 |
+
os.environ.setdefault("TOKENIZERS_PARALLELISM", "false")
|
| 27 |
+
|
| 28 |
+
import argparse # noqa: E402
|
| 29 |
+
import copy # noqa: E402
|
| 30 |
+
import csv # noqa: E402
|
| 31 |
+
import json # noqa: E402
|
| 32 |
+
import re # noqa: E402
|
| 33 |
+
import sys # noqa: E402
|
| 34 |
+
import time # noqa: E402
|
| 35 |
+
import unicodedata # noqa: E402
|
| 36 |
+
|
| 37 |
+
import torch # noqa: E402
|
| 38 |
+
import transformers # noqa: E402
|
| 39 |
+
from PIL import Image # noqa: E402
|
| 40 |
+
|
| 41 |
+
HERE = os.path.dirname(os.path.abspath(__file__))
|
| 42 |
+
INSTR = "Transcribe the text in this image exactly."
|
| 43 |
+
MAXNEW = {"word": 48, "line": 192}
|
| 44 |
+
IMG_EXT = (".png", ".jpg", ".jpeg", ".bmp", ".tif", ".tiff", ".webp")
|
| 45 |
+
_WS = re.compile(r"\s+")
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
def norm(text):
|
| 49 |
+
"""postproc.plain_output of the evaluation: NFC, white space runs to one space, outer white space stripped."""
|
| 50 |
+
return _WS.sub(" ", unicodedata.normalize("NFC", text or "")).strip()
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
# ----------------------------------------------------------------------------------------- copied from vlm_common.py
|
| 54 |
+
def template_kwargs(proc, tok):
|
| 55 |
+
"""enable_thinking=False for every model whose chat template uses that variable; others get no extra variable."""
|
| 56 |
+
texts = []
|
| 57 |
+
for o in (proc, tok):
|
| 58 |
+
ct = getattr(o, "chat_template", None)
|
| 59 |
+
if isinstance(ct, dict):
|
| 60 |
+
texts.extend(str(v) for v in ct.values())
|
| 61 |
+
elif ct:
|
| 62 |
+
texts.append(str(ct))
|
| 63 |
+
return {"enable_thinking": False} if any("enable_thinking" in t for t in texts) else {}
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
def prompt_batch(proc, imgs, tmpl_kw):
|
| 67 |
+
"""The one prompt builder (training and evaluation): user turn = one image + INSTR, generation prompt on."""
|
| 68 |
+
convs = [[{"role": "user", "content": [{"type": "image", "image": im}, {"type": "text", "text": INSTR}]}] for im in imgs]
|
| 69 |
+
return proc.apply_chat_template(convs, add_generation_prompt=True, tokenize=True, return_dict=True,
|
| 70 |
+
return_tensors="pt", padding=True, **tmpl_kw)
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
def stop_ids(model_gen_cfg, tok):
|
| 74 |
+
s = set()
|
| 75 |
+
for e in (getattr(model_gen_cfg, "eos_token_id", None), getattr(tok, "eos_token_id", None)):
|
| 76 |
+
if isinstance(e, (list, tuple)):
|
| 77 |
+
s.update(int(x) for x in e)
|
| 78 |
+
elif e is not None:
|
| 79 |
+
s.add(int(e))
|
| 80 |
+
return s
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
def gen_setup(model, tok, suffix_ids=None):
|
| 84 |
+
"""Greedy generation config. Stops on the generation-config end ids, the tokenizer eos and the trained answer-end token."""
|
| 85 |
+
gc = copy.deepcopy(model.generation_config)
|
| 86 |
+
gc.do_sample = False
|
| 87 |
+
gc.num_beams = 1
|
| 88 |
+
gc.repetition_penalty = 1.0
|
| 89 |
+
gc.no_repeat_ngram_size = 0
|
| 90 |
+
gc.temperature = None
|
| 91 |
+
gc.top_p = None
|
| 92 |
+
gc.top_k = None
|
| 93 |
+
gc.use_cache = True
|
| 94 |
+
if gc.pad_token_id is None:
|
| 95 |
+
gc.pad_token_id = tok.pad_token_id
|
| 96 |
+
stops = stop_ids(model.generation_config, tok)
|
| 97 |
+
if suffix_ids:
|
| 98 |
+
stops.add(int(suffix_ids[-1]))
|
| 99 |
+
gc.eos_token_id = sorted(stops)
|
| 100 |
+
stop_set = set(stops)
|
| 101 |
+
if gc.pad_token_id is not None:
|
| 102 |
+
stop_set.add(gc.pad_token_id)
|
| 103 |
+
return gc, sorted(stops), stop_set
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
def generate_batch(model, proc, tok, imgs, max_new, tmpl_kw, gc, stop_set, dev, dtype):
|
| 107 |
+
"""Greedy reading of a batch (tokenizer padding side must be 'left'). Returns per image: raw text, n_new, hit_cap, conf, conf_min.
|
| 108 |
+
conf = mean natural-log probability of the generated tokens up to and including the first stop token; hit_cap = generation
|
| 109 |
+
reached max_new_tokens without a stop token. (Same as vlm_common.generate_batch; the dtype of the inputs is a parameter here,
|
| 110 |
+
bfloat16 in the evaluation.)"""
|
| 111 |
+
inputs = prompt_batch(proc, imgs, tmpl_kw)
|
| 112 |
+
am = inputs["attention_mask"]
|
| 113 |
+
assert bool(am[:, -1].all()), "padding is not on the left"
|
| 114 |
+
inputs = inputs.to(dev, dtype=dtype)
|
| 115 |
+
g = copy.deepcopy(gc)
|
| 116 |
+
g.max_new_tokens = max_new
|
| 117 |
+
with torch.inference_mode():
|
| 118 |
+
out = model.generate(**inputs, generation_config=g, output_scores=True, return_dict_in_generate=True)
|
| 119 |
+
new = out.sequences[:, inputs["input_ids"].shape[1]:]
|
| 120 |
+
lp = torch.stack([torch.log_softmax(s.float(), dim=-1).gather(1, new[:, t:t + 1]).squeeze(1)
|
| 121 |
+
for t, s in enumerate(out.scores[: new.shape[1]])], dim=1).cpu()
|
| 122 |
+
texts = tok.batch_decode(new, skip_special_tokens=True, clean_up_tokenization_spaces=False)
|
| 123 |
+
recs = []
|
| 124 |
+
for r in range(new.shape[0]):
|
| 125 |
+
row = new[r].tolist()
|
| 126 |
+
n_new, hit = len(row), False
|
| 127 |
+
for j, t in enumerate(row):
|
| 128 |
+
if t in stop_set:
|
| 129 |
+
n_new, hit = j + 1, True
|
| 130 |
+
break
|
| 131 |
+
v = lp[r, :n_new]
|
| 132 |
+
recs.append({"raw": texts[r], "n_new": n_new, "hit_cap": (not hit) and n_new >= max_new,
|
| 133 |
+
"conf": round(float(v.mean()), 6) if n_new else None,
|
| 134 |
+
"conf_min": round(float(v.min()), 6) if n_new else None})
|
| 135 |
+
return recs
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
# ----------------------------------------------------------------------------------------- the reader
|
| 139 |
+
class Reader:
|
| 140 |
+
"""Loads the model of this package once; read() turns PIL images into texts."""
|
| 141 |
+
|
| 142 |
+
def __init__(self, model_dir=None, device="auto", dtype="bfloat16", threads=0):
|
| 143 |
+
self.model_dir = model_dir or os.path.join(HERE, "model")
|
| 144 |
+
if device == "auto":
|
| 145 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 146 |
+
self.dev = device
|
| 147 |
+
self.dtype = {"bfloat16": torch.bfloat16, "float32": torch.float32}[dtype]
|
| 148 |
+
if threads:
|
| 149 |
+
torch.set_num_threads(threads)
|
| 150 |
+
if device.startswith("cuda"):
|
| 151 |
+
# performance only, as in the evaluation: the cuDNN backend of scaled_dot_product_attention builds a new plan for every
|
| 152 |
+
# new sequence shape; the flash / memory-efficient / math backends are used instead
|
| 153 |
+
torch.backends.cuda.enable_cudnn_sdp(False)
|
| 154 |
+
assert not any(f.endswith(".py") for f in os.listdir(self.model_dir)), "a .py file in the model folder"
|
| 155 |
+
self.proc = transformers.AutoProcessor.from_pretrained(self.model_dir, trust_remote_code=False)
|
| 156 |
+
self.tok = getattr(self.proc, "tokenizer", self.proc)
|
| 157 |
+
if getattr(self.tok, "pad_token_id", None) is None:
|
| 158 |
+
self.tok.pad_token = self.tok.eos_token
|
| 159 |
+
self.tok.padding_side = "left"
|
| 160 |
+
with open(os.path.join(self.model_dir, "r5_export.json"), encoding="utf-8") as f:
|
| 161 |
+
self.export = json.load(f)
|
| 162 |
+
self.tmpl_kw = self.export.get("chat_template_kwargs", template_kwargs(self.proc, self.tok))
|
| 163 |
+
model, info = transformers.AutoModelForImageTextToText.from_pretrained(
|
| 164 |
+
self.model_dir, dtype=self.dtype, trust_remote_code=False, use_safetensors=True, attn_implementation="sdpa",
|
| 165 |
+
output_loading_info=True)
|
| 166 |
+
bad = {k: list(info.get(k, []))[:10] for k in ("missing_keys", "unexpected_keys", "mismatched_keys") if info.get(k)}
|
| 167 |
+
if bad:
|
| 168 |
+
raise RuntimeError("the exported checkpoint does not reload exactly: " + json.dumps(bad)[:600])
|
| 169 |
+
self.model = model.to(self.dev).eval()
|
| 170 |
+
self.gc, self.stops, self.stop_set = gen_setup(self.model, self.tok, self.export.get("answer_suffix_ids"))
|
| 171 |
+
|
| 172 |
+
def read(self, images, unit="line", batch_size=16):
|
| 173 |
+
"""images: list of PIL images (RGB). Returns a list of dicts (raw, text, n_new, hit_cap, conf, conf_min), same order."""
|
| 174 |
+
max_new = MAXNEW[unit]
|
| 175 |
+
out = []
|
| 176 |
+
for b in range(0, len(images), batch_size):
|
| 177 |
+
chunk = images[b:b + batch_size]
|
| 178 |
+
try:
|
| 179 |
+
recs = generate_batch(self.model, self.proc, self.tok, chunk, max_new, self.tmpl_kw, self.gc, self.stop_set,
|
| 180 |
+
self.dev, self.dtype)
|
| 181 |
+
except Exception as ex: # noqa: BLE001 (as in the evaluation: one at a time, an unreadable image gives an empty text)
|
| 182 |
+
sys.stderr.write("batch failed (%s); reading one image at a time\n" % repr(ex)[:150])
|
| 183 |
+
recs = []
|
| 184 |
+
for im in chunk:
|
| 185 |
+
try:
|
| 186 |
+
recs += generate_batch(self.model, self.proc, self.tok, [im], max_new, self.tmpl_kw, self.gc, self.stop_set,
|
| 187 |
+
self.dev, self.dtype)
|
| 188 |
+
except Exception as ex2: # noqa: BLE001
|
| 189 |
+
recs.append({"raw": "", "n_new": 0, "hit_cap": False, "conf": None, "conf_min": None, "error": repr(ex2)[:200]})
|
| 190 |
+
for r in recs:
|
| 191 |
+
r["text"] = norm(r["raw"])
|
| 192 |
+
out += recs
|
| 193 |
+
return out
|
| 194 |
+
|
| 195 |
+
|
| 196 |
+
# ----------------------------------------------------------------------------------------- input and output
|
| 197 |
+
def collect_inputs(images=None, manifest=None):
|
| 198 |
+
"""List of (id, path). A manifest is a TSV with a header and the columns id and image (other columns are ignored)."""
|
| 199 |
+
if manifest:
|
| 200 |
+
rows = []
|
| 201 |
+
with open(manifest, encoding="utf-8", newline="") as f:
|
| 202 |
+
for r in csv.DictReader(f, delimiter="\t", quoting=csv.QUOTE_NONE):
|
| 203 |
+
rows.append((r["id"], r["image"]))
|
| 204 |
+
return rows
|
| 205 |
+
if os.path.isdir(images):
|
| 206 |
+
names = sorted(n for n in os.listdir(images) if n.lower().endswith(IMG_EXT))
|
| 207 |
+
return [(n, os.path.join(images, n)) for n in names]
|
| 208 |
+
return [(os.path.basename(images), images)]
|
| 209 |
+
|
| 210 |
+
|
| 211 |
+
def main():
|
| 212 |
+
ap = argparse.ArgumentParser(description=__doc__.split("\n")[0])
|
| 213 |
+
g = ap.add_mutually_exclusive_group(required=True)
|
| 214 |
+
g.add_argument("--images", help="one image file or a folder of images (ids are the file names)")
|
| 215 |
+
g.add_argument("--manifest", help="TSV with a header and the columns id and image")
|
| 216 |
+
ap.add_argument("--out", default="-", help="output TSV (default: standard output)")
|
| 217 |
+
ap.add_argument("--unit", choices=["word", "line"], default="line", help="word crop: at most 48 new tokens; line crop: 192")
|
| 218 |
+
ap.add_argument("--batch-size", type=int, default=16)
|
| 219 |
+
ap.add_argument("--device", default="auto", help="auto, cpu, cuda or cuda:N")
|
| 220 |
+
ap.add_argument("--dtype", choices=["bfloat16", "float32"], default="bfloat16", help="bfloat16 is what was evaluated")
|
| 221 |
+
ap.add_argument("--threads", type=int, default=0, help="CPU threads (0 = torch default)")
|
| 222 |
+
ap.add_argument("--model-dir", default=None, help="default: the model folder next to this script")
|
| 223 |
+
ap.add_argument("--with-conf", action="store_true", help="add the columns conf and hit_cap")
|
| 224 |
+
ap.add_argument("--report-modules", default=None, help="write the file paths of all loaded Python modules to this JSON (checks)")
|
| 225 |
+
a = ap.parse_args()
|
| 226 |
+
items = collect_inputs(a.images, a.manifest)
|
| 227 |
+
t0 = time.time()
|
| 228 |
+
reader = Reader(a.model_dir, a.device, a.dtype, a.threads)
|
| 229 |
+
t_load = time.time() - t0
|
| 230 |
+
imgs, keep = [], []
|
| 231 |
+
for i, (rid, p) in enumerate(items):
|
| 232 |
+
try:
|
| 233 |
+
imgs.append(Image.open(p).convert("RGB"))
|
| 234 |
+
keep.append(i)
|
| 235 |
+
except Exception as ex: # noqa: BLE001
|
| 236 |
+
sys.stderr.write("cannot read %s: %s\n" % (p, repr(ex)[:120]))
|
| 237 |
+
t1 = time.time()
|
| 238 |
+
recs = reader.read(imgs, a.unit, a.batch_size)
|
| 239 |
+
res = {items[i][0]: r for i, r in zip(keep, recs)}
|
| 240 |
+
fo = sys.stdout if a.out == "-" else open(a.out, "w", encoding="utf-8", newline="")
|
| 241 |
+
fo.write("id\ttext" + ("\tconf\thit_cap" if a.with_conf else "") + "\n")
|
| 242 |
+
for rid, _ in items:
|
| 243 |
+
r = res.get(rid)
|
| 244 |
+
text = r["text"] if r else ""
|
| 245 |
+
if a.with_conf:
|
| 246 |
+
fo.write("%s\t%s\t%s\t%d\n" % (rid, text, "" if not r or r["conf"] is None else r["conf"], int(bool(r and r["hit_cap"]))))
|
| 247 |
+
else:
|
| 248 |
+
fo.write("%s\t%s\n" % (rid, text))
|
| 249 |
+
if fo is not sys.stdout:
|
| 250 |
+
fo.close()
|
| 251 |
+
sys.stderr.write("read %d images on %s (%s) in %.1f s (model load %.1f s); transformers %s, torch %s\n" % (
|
| 252 |
+
len(imgs), reader.dev, a.dtype, time.time() - t1, t_load, transformers.__version__, torch.__version__))
|
| 253 |
+
if a.report_modules:
|
| 254 |
+
mods = sorted({getattr(m, "__file__", None) for m in sys.modules.values() if getattr(m, "__file__", None)})
|
| 255 |
+
with open(a.report_modules, "w", encoding="utf-8") as f:
|
| 256 |
+
json.dump({"script": os.path.abspath(__file__), "modules": mods, "sys_path": sys.path}, f, indent=1)
|
| 257 |
+
|
| 258 |
+
|
| 259 |
+
if __name__ == "__main__":
|
| 260 |
+
main()
|
release/turkic-ocr-qwen3-vl-2b/requirements.txt
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Exact package versions of the environment this model was evaluated in: CODE/.venv_vlm, Python 3.12.13.
|
| 2 |
+
# Frozen with `uv pip freeze` on 2026-11-25 (cluster job 55104, file DATA/tmp/rc1_check/freeze_vlm.txt).
|
| 3 |
+
# torch and torchvision are the CUDA 12.8 builds ("+cu128"); the index line below lets pip find them. On a machine without a GPU the same
|
| 4 |
+
# versions run on the CPU (bfloat16 matrix products are used on CPU as well), or install torch==2.11.0 and torchvision==0.26.0 from PyPI.
|
| 5 |
+
--extra-index-url https://download.pytorch.org/whl/cu128
|
| 6 |
+
accelerate==1.16.0
|
| 7 |
+
annotated-doc==0.0.7
|
| 8 |
+
annotated-types==0.8.0
|
| 9 |
+
anyio==4.16.0
|
| 10 |
+
click==8.5.1
|
| 11 |
+
cuda-bindings==12.9.7
|
| 12 |
+
cuda-pathfinder==1.6.0
|
| 13 |
+
cuda-toolkit==12.8.1
|
| 14 |
+
filelock==4.2.4
|
| 15 |
+
fsspec==2026.9.0
|
| 16 |
+
h11==0.16.0
|
| 17 |
+
hf-xet==1.8.0
|
| 18 |
+
httpcore2==2.16.2
|
| 19 |
+
httpx2==2.16.2
|
| 20 |
+
huggingface-hub==2.4.0
|
| 21 |
+
idna==3.20
|
| 22 |
+
jinja2==3.1.6
|
| 23 |
+
markdown-it-py==4.3.0
|
| 24 |
+
markupsafe==3.0.3
|
| 25 |
+
mdurl==0.1.2
|
| 26 |
+
mpmath==1.3.0
|
| 27 |
+
networkx==3.7
|
| 28 |
+
numpy==2.5.4
|
| 29 |
+
nvidia-cublas-cu12==12.8.4.1
|
| 30 |
+
nvidia-cuda-cupti-cu12==12.8.90
|
| 31 |
+
nvidia-cuda-nvrtc-cu12==12.8.93
|
| 32 |
+
nvidia-cuda-runtime-cu12==12.8.90
|
| 33 |
+
nvidia-cudnn-cu12==9.19.0.56
|
| 34 |
+
nvidia-cufft-cu12==11.3.3.83
|
| 35 |
+
nvidia-cufile-cu12==1.13.1.3
|
| 36 |
+
nvidia-curand-cu12==10.3.9.90
|
| 37 |
+
nvidia-cusolver-cu12==11.7.3.90
|
| 38 |
+
nvidia-cusparse-cu12==12.5.8.93
|
| 39 |
+
nvidia-cusparselt-cu12==0.7.1
|
| 40 |
+
nvidia-nccl-cu12==2.28.9
|
| 41 |
+
nvidia-nvjitlink-cu12==12.8.93
|
| 42 |
+
nvidia-nvshmem-cu12==3.4.5
|
| 43 |
+
nvidia-nvtx-cu12==12.8.90
|
| 44 |
+
packaging==26.3
|
| 45 |
+
pillow==13.0.0
|
| 46 |
+
protobuf==7.36.2
|
| 47 |
+
psutil==7.2.2
|
| 48 |
+
pydantic==2.14.4
|
| 49 |
+
pydantic-core==2.50.5
|
| 50 |
+
pygments==2.21.0
|
| 51 |
+
pyyaml==6.0.3
|
| 52 |
+
regex==2026.11.19
|
| 53 |
+
rich==15.0.0
|
| 54 |
+
safetensors==0.8.0
|
| 55 |
+
sentencepiece==0.2.3
|
| 56 |
+
setuptools==78.1.0
|
| 57 |
+
shellingham==1.5.4
|
| 58 |
+
sympy==1.14.0
|
| 59 |
+
tokenizers==0.23.3
|
| 60 |
+
torch==2.11.0+cu128
|
| 61 |
+
torchvision==0.26.0+cu128
|
| 62 |
+
tqdm==4.70.1
|
| 63 |
+
transformers==5.23.0
|
| 64 |
+
triton==3.6.0
|
| 65 |
+
truststore==0.10.5
|
| 66 |
+
typer==0.29.2
|
| 67 |
+
typing-extensions==4.16.0
|
| 68 |
+
typing-inspection==0.4.5
|
scripts/b1_page_check/b1_page_check.py
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Quick whole-page check of B1 (PaddleOCR-VL 1.6 R5 leader) on CPU: one prompt, a few validation pages.
|
| 2 |
+
|
| 3 |
+
Not a benchmark: a smoke sample before a deadline. Validation pages only. Reuses the R5 loader and prompt builder
|
| 4 |
+
(CODE/scripts/r5_vlma/vlm_common.py) with the instruction swapped, greedy decoding, bf16 as in the R5 evaluation.
|
| 5 |
+
Writes one JSON line per page as soon as it is read, and stops before --stop_utc.
|
| 6 |
+
|
| 7 |
+
usage: b1_page_check.py --model DIR --pages TSV --start K --n N --prompt spot|instr|ocr --out JSONL --stop_utc HH:MM
|
| 8 |
+
"""
|
| 9 |
+
import argparse
|
| 10 |
+
import json
|
| 11 |
+
import os
|
| 12 |
+
import re
|
| 13 |
+
import sys
|
| 14 |
+
import time
|
| 15 |
+
import unicodedata
|
| 16 |
+
from datetime import datetime, timezone
|
| 17 |
+
|
| 18 |
+
ap = argparse.ArgumentParser()
|
| 19 |
+
ap.add_argument("--model", required=True)
|
| 20 |
+
ap.add_argument("--pages", required=True)
|
| 21 |
+
ap.add_argument("--stride", type=int, default=1)
|
| 22 |
+
ap.add_argument("--n", type=int, default=10)
|
| 23 |
+
ap.add_argument("--chunk", type=int, default=0)
|
| 24 |
+
ap.add_argument("--chunks", type=int, default=1)
|
| 25 |
+
ap.add_argument("--prompt", choices=["spot", "instr", "ocr"], required=True)
|
| 26 |
+
ap.add_argument("--out", required=True)
|
| 27 |
+
ap.add_argument("--stop_utc", required=True)
|
| 28 |
+
ap.add_argument("--max_new", type=int, default=2048)
|
| 29 |
+
ap.add_argument("--threads", type=int, default=16)
|
| 30 |
+
ap.add_argument("--vlma", default="/path/to/TURKIC_OCR_CODE/scripts/r5_vlma")
|
| 31 |
+
a = ap.parse_args()
|
| 32 |
+
assert "test" not in os.path.basename(a.pages).lower(), "refusing a test page list"
|
| 33 |
+
|
| 34 |
+
sys.path.insert(0, a.vlma)
|
| 35 |
+
import torch # noqa: E402
|
| 36 |
+
from PIL import Image # noqa: E402
|
| 37 |
+
|
| 38 |
+
import vlm_common as vc # noqa: E402
|
| 39 |
+
|
| 40 |
+
torch.set_num_threads(a.threads)
|
| 41 |
+
PROMPTS = {"spot": "Spotting:", "ocr": "OCR:", "instr": vc.INSTR}
|
| 42 |
+
vc.INSTR = PROMPTS[a.prompt] # prompt_batch reads the module global at call time
|
| 43 |
+
SCHOOL = "/path/to/TURKIC_OCR_DATA/data/raw/school_notebooks_ru"
|
| 44 |
+
LOC = re.compile(r"<\|LOC_\d+\|>")
|
| 45 |
+
SPECIAL = re.compile(r"<\|[A-Za-z_]+\|>|</s>|<s>")
|
| 46 |
+
|
| 47 |
+
stop_h, stop_m = (int(x) for x in a.stop_utc.split(":"))
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
def now():
|
| 51 |
+
return datetime.now(timezone.utc)
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
def past_stop():
|
| 55 |
+
t = now()
|
| 56 |
+
return (t.hour, t.minute) >= (stop_h, stop_m)
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
def school_orig(pid):
|
| 60 |
+
# same lookup as linedet.det_eval.school_orig: the full-resolution photograph of a school val page
|
| 61 |
+
sp, num = pid.split("_")[1], int(pid.split("_")[2])
|
| 62 |
+
d = json.load(open("%s/annotations_%s.json" % (SCHOOL, sp), encoding="utf-8"))
|
| 63 |
+
fn = {im["id"]: im["file_name"] for im in d["images"]}[num]
|
| 64 |
+
return "%s/val_test_images/%s/%s" % (SCHOOL, sp, fn)
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
def lines_from(raw_special):
|
| 68 |
+
"""Page text lines from the raw output: location tokens and other special tokens removed, one line per newline."""
|
| 69 |
+
out = []
|
| 70 |
+
for ln in raw_special.split("\n"):
|
| 71 |
+
t = SPECIAL.sub("", LOC.sub("", ln))
|
| 72 |
+
t = " ".join(unicodedata.normalize("NFC", t).split())
|
| 73 |
+
if t:
|
| 74 |
+
out.append(t)
|
| 75 |
+
return out
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
with open(a.pages, encoding="utf-8") as f:
|
| 79 |
+
hdr = f.readline().rstrip("\n").split("\t")
|
| 80 |
+
pages = [dict(zip(hdr, ln.rstrip("\n").split("\t"))) for ln in f]
|
| 81 |
+
# every stride-th page spreads the sample over page kinds and languages (the lists are sorted by kind, then language)
|
| 82 |
+
sel = pages[::a.stride][:a.n]
|
| 83 |
+
pages = sel[a.chunk::a.chunks]
|
| 84 |
+
|
| 85 |
+
t0 = time.time()
|
| 86 |
+
proc, tok = vc.load_processor("paddleocr_vl_1_6", a.model)
|
| 87 |
+
tok.padding_side = "left"
|
| 88 |
+
model = vc.load_model("paddleocr_vl_1_6", a.model, torch.bfloat16)
|
| 89 |
+
model.eval()
|
| 90 |
+
gc, stops, stop_set = vc.gen_setup(model, tok)
|
| 91 |
+
tmpl_kw = vc.template_kwargs(proc, tok)
|
| 92 |
+
load_s = time.time() - t0
|
| 93 |
+
print("loaded in %.1f s; prompt %r; %d pages" % (load_s, vc.INSTR, len(pages)), flush=True)
|
| 94 |
+
|
| 95 |
+
dev = torch.device("cpu")
|
| 96 |
+
with open(a.out, "a", encoding="utf-8") as fo:
|
| 97 |
+
for pg in pages:
|
| 98 |
+
if past_stop():
|
| 99 |
+
print("stop time reached before page", pg["id"], flush=True)
|
| 100 |
+
break
|
| 101 |
+
path = school_orig(pg["id"]) if pg["id"].startswith("school_") else pg["image"]
|
| 102 |
+
im = Image.open(path).convert("RGB")
|
| 103 |
+
t1 = time.time()
|
| 104 |
+
inputs = vc.prompt_batch("paddleocr_vl_1_6", proc, [im], tmpl_kw).to(dev, dtype=torch.bfloat16)
|
| 105 |
+
g = __import__("copy").deepcopy(gc)
|
| 106 |
+
g.max_new_tokens = a.max_new
|
| 107 |
+
with torch.inference_mode():
|
| 108 |
+
out = model.generate(**inputs, generation_config=g)
|
| 109 |
+
new = out[0, inputs["input_ids"].shape[1]:].tolist()
|
| 110 |
+
hit = any(t in stop_set for t in new)
|
| 111 |
+
raw_sp = tok.decode(new, skip_special_tokens=False, clean_up_tokenization_spaces=False)
|
| 112 |
+
rec = {"id": pg["id"], "prompt": a.prompt, "image": path, "image_size": list(im.size),
|
| 113 |
+
"n_visual_tokens": int((inputs["input_ids"][0] == getattr(model.config, "image_token_id", -1)).sum()),
|
| 114 |
+
"n_new": len(new), "stopped": hit, "seconds": round(time.time() - t1, 1),
|
| 115 |
+
"hyp_lines": lines_from(raw_sp), "ref_lines": json.loads(pg["ref_lines_json"]) if pg.get("ref_lines_json") else [],
|
| 116 |
+
"raw": raw_sp}
|
| 117 |
+
fo.write(json.dumps(rec, ensure_ascii=False) + "\n")
|
| 118 |
+
fo.flush()
|
| 119 |
+
print(pg["id"], "%.1f s" % rec["seconds"], "new", len(new), "stopped", hit, "lines", len(rec["hyp_lines"]), flush=True)
|
| 120 |
+
print("done", now().isoformat(), flush=True)
|
scripts/b1_page_check/b1_page_check.sbatch
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
#SBATCH --job-name=b1_page_check
|
| 3 |
+
#SBATCH --partition=ZEN4
|
| 4 |
+
#SBATCH --cpus-per-task=16
|
| 5 |
+
#SBATCH --mem=48G
|
| 6 |
+
#SBATCH --time=00:45:00
|
| 7 |
+
#SBATCH --array=0-7
|
| 8 |
+
#SBATCH --output=/path/to/TURKIC_OCR_DATA/logs/%x_%A_%a.out
|
| 9 |
+
# Task t: prompt = spot (t<4) or instr; set = gen (t%4<2) or school; chunk = t%2 of 2 (5 pages each).
|
| 10 |
+
set -u
|
| 11 |
+
CODE=/path/to/TURKIC_OCR_CODE
|
| 12 |
+
D=/path/to/TURKIC_OCR_DATA
|
| 13 |
+
P=$D/data/processed/r5_linedet_det
|
| 14 |
+
OUT=$D/outputs/r5/b1_page_check
|
| 15 |
+
mkdir -p $OUT
|
| 16 |
+
t=$SLURM_ARRAY_TASK_ID
|
| 17 |
+
if [ $t -lt 4 ]; then PR=spot; else PR=instr; fi
|
| 18 |
+
if [ $((t % 4)) -lt 2 ]; then S=gen; PAGES=$P/gen/pages_gen_val.tsv; STRIDE=30; else S=school; PAGES=$P/school2/pages_school_val.tsv; STRIDE=15; fi
|
| 19 |
+
C=$((t % 2))
|
| 20 |
+
export HF_HUB_OFFLINE=1 TRANSFORMERS_OFFLINE=1 OMP_NUM_THREADS=16
|
| 21 |
+
hostname; date -u
|
| 22 |
+
$CODE/.venv_vlm/bin/python -I $CODE/scripts/b1_page_check/b1_page_check.py --model $D/checkpoints/r5/paddleocr_vl_1_6/leader \
|
| 23 |
+
--pages $PAGES --stride $STRIDE --n 10 --chunk $C --chunks 2 --prompt $PR --out $OUT/${S}_${PR}_c${C}.jsonl --stop_utc 03:42 --threads 16
|
| 24 |
+
echo "=== exit $? $(date -u)"
|
scripts/b1_page_check/b1_page_score.py
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Score the B1 whole-page check, and route A (YOLO11s stage 2 + A1 long) on the SAME pages for comparison.
|
| 2 |
+
|
| 3 |
+
Page CER exactly as linedet.det_eval.page_cers (metric M28 reading order: lines joined by one space; M29 order free:
|
| 4 |
+
lines matched one to one by minimum edit distance, unmatched lines count in full). Micro average: summed edits over
|
| 5 |
+
summed reference characters. B1 lines keep the model's own output order.
|
| 6 |
+
|
| 7 |
+
usage: b1_page_score.py --dir OUT_DIR --routeA_dir DET_EVAL_DIR --out JSON
|
| 8 |
+
"""
|
| 9 |
+
import argparse
|
| 10 |
+
import glob
|
| 11 |
+
import json
|
| 12 |
+
import os
|
| 13 |
+
|
| 14 |
+
import numpy as np
|
| 15 |
+
from rapidfuzz import process
|
| 16 |
+
from rapidfuzz.distance import Levenshtein
|
| 17 |
+
from scipy.optimize import linear_sum_assignment
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
def page_cers(hyp_lines, ref_lines):
|
| 21 |
+
# copied from linedet.det_eval.page_cers so the figures are comparable with route A's 0.16 and 0.43
|
| 22 |
+
nref = sum(len(r) for r in ref_lines)
|
| 23 |
+
ro = Levenshtein.distance(" ".join(hyp_lines), " ".join(ref_lines))
|
| 24 |
+
if not hyp_lines or not ref_lines:
|
| 25 |
+
of = sum(len(h) for h in hyp_lines) + nref
|
| 26 |
+
else:
|
| 27 |
+
C = process.cdist(hyp_lines, ref_lines, scorer=Levenshtein.distance, dtype=np.int32)
|
| 28 |
+
ri, ci = linear_sum_assignment(C)
|
| 29 |
+
matched = int(C[ri, ci].sum())
|
| 30 |
+
un_h = sum(len(hyp_lines[i]) for i in range(len(hyp_lines)) if i not in set(ri.tolist()))
|
| 31 |
+
un_r = sum(len(ref_lines[j]) for j in range(len(ref_lines)) if j not in set(ci.tolist()))
|
| 32 |
+
of = matched + un_h + un_r
|
| 33 |
+
return ro, of, nref
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
ap = argparse.ArgumentParser()
|
| 37 |
+
ap.add_argument("--dir", required=True)
|
| 38 |
+
ap.add_argument("--routeA_dir", required=True)
|
| 39 |
+
ap.add_argument("--out", required=True)
|
| 40 |
+
a = ap.parse_args()
|
| 41 |
+
|
| 42 |
+
recs = {}
|
| 43 |
+
for fn in sorted(glob.glob(os.path.join(a.dir, "*.jsonl"))):
|
| 44 |
+
s, pr = os.path.basename(fn).split("_")[:2]
|
| 45 |
+
for ln in open(fn, encoding="utf-8"):
|
| 46 |
+
r = json.loads(ln)
|
| 47 |
+
recs.setdefault((s, pr), {})[r["id"]] = r
|
| 48 |
+
|
| 49 |
+
routeA = {}
|
| 50 |
+
for s, name in (("gen", "e2e_yolo_s2_gen_val_A1_long"), ("school", "e2e_yolo_s2_school_val_A1_long")):
|
| 51 |
+
p = os.path.join(a.routeA_dir, name + "_pages.jsonl")
|
| 52 |
+
if os.path.exists(p):
|
| 53 |
+
routeA[s] = {json.loads(ln)["id"]: json.loads(ln) for ln in open(p, encoding="utf-8")}
|
| 54 |
+
|
| 55 |
+
res = {"note": "smoke sample of validation pages, not a benchmark; B1 = PaddleOCR-VL 1.6 R5 leader, bf16 on CPU, greedy, "
|
| 56 |
+
"default processor size (at most 1,003,520 pixels)", "cells": []}
|
| 57 |
+
for (s, pr), pages in sorted(recs.items()):
|
| 58 |
+
ro = of = n = 0
|
| 59 |
+
aro = aof = an = 0
|
| 60 |
+
per = []
|
| 61 |
+
for pid, r in sorted(pages.items()):
|
| 62 |
+
e_ro, e_of, nr = page_cers(r["hyp_lines"], r["ref_lines"])
|
| 63 |
+
ro, of, n = ro + e_ro, of + e_of, n + nr
|
| 64 |
+
row = {"id": pid, "ref_chars": nr, "ro_cer": round(e_ro / max(nr, 1), 4), "of_cer": round(e_of / max(nr, 1), 4),
|
| 65 |
+
"n_hyp_lines": len(r["hyp_lines"]), "n_ref_lines": len(r["ref_lines"]), "stopped": r["stopped"],
|
| 66 |
+
"n_new": r["n_new"], "seconds": r["seconds"]}
|
| 67 |
+
A = routeA.get(s, {}).get(pid)
|
| 68 |
+
if A is not None and "hyp_lines" in A:
|
| 69 |
+
x_ro, x_of, _ = page_cers(A["hyp_lines"], r["ref_lines"])
|
| 70 |
+
aro, aof, an = aro + x_ro, aof + x_of, an + nr
|
| 71 |
+
row["routeA_ro_cer"] = round(x_ro / max(nr, 1), 4)
|
| 72 |
+
row["routeA_of_cer"] = round(x_of / max(nr, 1), 4)
|
| 73 |
+
per.append(row)
|
| 74 |
+
res["cells"].append({"set": s, "prompt": pr, "pages": len(pages), "ref_chars": n,
|
| 75 |
+
"B1_reading_order_cer": round(ro / max(n, 1), 4), "B1_order_free_cer": round(of / max(n, 1), 4),
|
| 76 |
+
"routeA_same_pages_reading_order_cer": round(aro / an, 4) if an else None,
|
| 77 |
+
"routeA_same_pages_order_free_cer": round(aof / an, 4) if an else None,
|
| 78 |
+
"per_page": per})
|
| 79 |
+
json.dump(res, open(a.out, "w", encoding="utf-8"), ensure_ascii=False, indent=1)
|
| 80 |
+
for c in res["cells"]:
|
| 81 |
+
print(c["set"], c["prompt"], "pages", c["pages"], "B1 ro/of", c["B1_reading_order_cer"], c["B1_order_free_cer"],
|
| 82 |
+
"routeA ro/of", c["routeA_same_pages_reading_order_cer"], c["routeA_same_pages_order_free_cer"])
|
scripts/b1_page_check/b1_page_score.sbatch
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
#SBATCH --job-name=b1_page_score
|
| 3 |
+
#SBATCH --partition=ZEN4
|
| 4 |
+
#SBATCH --cpus-per-task=2
|
| 5 |
+
#SBATCH --mem=8G
|
| 6 |
+
#SBATCH --time=00:10:00
|
| 7 |
+
#SBATCH --output=/path/to/TURKIC_OCR_DATA/logs/%x_%j.out
|
| 8 |
+
set -u
|
| 9 |
+
CODE=/path/to/TURKIC_OCR_CODE
|
| 10 |
+
D=/path/to/TURKIC_OCR_DATA
|
| 11 |
+
$CODE/.venv_kraken/bin/python -I $CODE/scripts/b1_page_check/b1_page_score.py --dir $D/outputs/r5/b1_page_check \
|
| 12 |
+
--routeA_dir $D/outputs/r5/linedet/det_eval --out $D/outputs/r5/b1_page_check/score.json
|
| 13 |
+
echo "=== exit $? $(date -u)"
|
scripts/b1_page_check/base_page_check.sbatch
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
#SBATCH --job-name=base_page_check
|
| 3 |
+
#SBATCH --partition=ZEN4
|
| 4 |
+
#SBATCH --cpus-per-task=16
|
| 5 |
+
#SBATCH --mem=48G
|
| 6 |
+
#SBATCH --time=00:40:00
|
| 7 |
+
#SBATCH --array=0-5
|
| 8 |
+
#SBATCH --output=/path/to/TURKIC_OCR_DATA/logs/%x_%A_%a.out
|
| 9 |
+
# The original PaddleOCR-VL 1.6 (the pinned copy B1 was fine-tuned from) on the same pages as b1_page_check.
|
| 10 |
+
# Task t: prompt = spot (t<4) or ocr (t>=4, generated pages only); set = gen (t%4<2) or school; chunk = t%2.
|
| 11 |
+
set -u
|
| 12 |
+
CODE=/path/to/TURKIC_OCR_CODE
|
| 13 |
+
D=/path/to/TURKIC_OCR_DATA
|
| 14 |
+
P=$D/data/processed/r5_linedet_det
|
| 15 |
+
OUT=$D/outputs/r5/b1_page_check
|
| 16 |
+
mkdir -p $OUT
|
| 17 |
+
t=$SLURM_ARRAY_TASK_ID
|
| 18 |
+
if [ $t -lt 4 ]; then PR=spot; else PR=ocr; fi
|
| 19 |
+
if [ $((t % 4)) -lt 2 ]; then S=gen; PAGES=$P/gen/pages_gen_val.tsv; STRIDE=30; else S=school; PAGES=$P/school2/pages_school_val.tsv; STRIDE=15; fi
|
| 20 |
+
C=$((t % 2))
|
| 21 |
+
export HF_HUB_OFFLINE=1 TRANSFORMERS_OFFLINE=1 OMP_NUM_THREADS=16
|
| 22 |
+
hostname; date -u
|
| 23 |
+
$CODE/.venv_vlm/bin/python -I $CODE/scripts/b1_page_check/b1_page_check.py --model $D/hf_cache/j2_models/paddleocr_vl_1_6 \
|
| 24 |
+
--pages $PAGES --stride $STRIDE --n 10 --chunk $C --chunks 2 --prompt $PR --out $OUT/${S}_base${PR}_c${C}.jsonl --stop_utc 03:42 --threads 16
|
| 25 |
+
echo "=== exit $? $(date -u)"
|
scripts/b1_page_check/detb1_page_check.py
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Line detector + B1 on the same sampled validation pages as b1_page_check.py.
|
| 2 |
+
|
| 3 |
+
The detector boxes are the stored YOLO11s stage-2 boxes from the route A run (det_eval e2e_yolo_s2_*_A1_long_pages.jsonl),
|
| 4 |
+
so detection is identical to route A and only the reader changes (A1 -> B1). Reading order, crop margins and the school
|
| 5 |
+
full-resolution lookup are copied from linedet.det_eval. B1 reads each crop with its training instruction, greedy, bf16 on
|
| 6 |
+
CPU, at most 192 new tokens per line (vlm_common.MAXNEW['line']).
|
| 7 |
+
|
| 8 |
+
usage: detb1_page_check.py --set gen|school --pages TSV --stride K --n 10 --chunk C --chunks 2 --routeA JSONL --out JSONL
|
| 9 |
+
"""
|
| 10 |
+
import argparse
|
| 11 |
+
import json
|
| 12 |
+
import os
|
| 13 |
+
import sys
|
| 14 |
+
import time
|
| 15 |
+
import unicodedata
|
| 16 |
+
|
| 17 |
+
ap = argparse.ArgumentParser()
|
| 18 |
+
ap.add_argument("--set", required=True)
|
| 19 |
+
ap.add_argument("--pages", required=True)
|
| 20 |
+
ap.add_argument("--stride", type=int, required=True)
|
| 21 |
+
ap.add_argument("--n", type=int, default=10)
|
| 22 |
+
ap.add_argument("--chunk", type=int, default=0)
|
| 23 |
+
ap.add_argument("--chunks", type=int, default=1)
|
| 24 |
+
ap.add_argument("--routeA", required=True)
|
| 25 |
+
ap.add_argument("--model", required=True)
|
| 26 |
+
ap.add_argument("--out", required=True)
|
| 27 |
+
ap.add_argument("--threads", type=int, default=16)
|
| 28 |
+
ap.add_argument("--vlma", default="/path/to/TURKIC_OCR_CODE/scripts/r5_vlma")
|
| 29 |
+
a = ap.parse_args()
|
| 30 |
+
assert "test" not in os.path.basename(a.pages).lower()
|
| 31 |
+
|
| 32 |
+
sys.path.insert(0, a.vlma)
|
| 33 |
+
import torch # noqa: E402
|
| 34 |
+
from PIL import Image # noqa: E402
|
| 35 |
+
|
| 36 |
+
import vlm_common as vc # noqa: E402
|
| 37 |
+
|
| 38 |
+
torch.set_num_threads(a.threads)
|
| 39 |
+
SCHOOL = "/path/to/TURKIC_OCR_DATA/data/raw/school_notebooks_ru"
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
def school_orig(pid):
|
| 43 |
+
sp, num = pid.split("_")[1], int(pid.split("_")[2])
|
| 44 |
+
d = json.load(open("%s/annotations_%s.json" % (SCHOOL, sp), encoding="utf-8"))
|
| 45 |
+
fn = {im["id"]: im["file_name"] for im in d["images"]}[num]
|
| 46 |
+
return "%s/val_test_images/%s/%s" % (SCHOOL, sp, fn)
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
with open(a.pages, encoding="utf-8") as f:
|
| 50 |
+
hdr = f.readline().rstrip("\n").split("\t")
|
| 51 |
+
pages = [dict(zip(hdr, ln.rstrip("\n").split("\t"))) for ln in f]
|
| 52 |
+
pages = pages[::a.stride][:a.n][a.chunk::a.chunks]
|
| 53 |
+
det = {}
|
| 54 |
+
for ln in open(a.routeA, encoding="utf-8"):
|
| 55 |
+
r = json.loads(ln)
|
| 56 |
+
det[r["id"]] = r["boxes"]
|
| 57 |
+
|
| 58 |
+
proc, tok = vc.load_processor("paddleocr_vl_1_6", a.model)
|
| 59 |
+
tok.padding_side = "left"
|
| 60 |
+
model = vc.load_model("paddleocr_vl_1_6", a.model, torch.bfloat16)
|
| 61 |
+
model.eval()
|
| 62 |
+
gc, stops, stop_set = vc.gen_setup(model, tok)
|
| 63 |
+
tmpl_kw = vc.template_kwargs(proc, tok)
|
| 64 |
+
dev = torch.device("cpu")
|
| 65 |
+
|
| 66 |
+
with open(a.out, "a", encoding="utf-8") as fo:
|
| 67 |
+
for pg in pages:
|
| 68 |
+
t1 = time.time()
|
| 69 |
+
boxes = det[pg["id"]]
|
| 70 |
+
if pg["id"].startswith("school_"):
|
| 71 |
+
big = Image.open(school_orig(pg["id"])).convert("RGB")
|
| 72 |
+
sc = 1.0 / float(pg["scale"])
|
| 73 |
+
else:
|
| 74 |
+
big, sc = Image.open(pg["image"]).convert("RGB"), 1.0
|
| 75 |
+
W, H = big.size
|
| 76 |
+
# M28 reading order, as det_eval: (centre_y // 15, centre_x) in the 1280 px page
|
| 77 |
+
order = sorted(range(len(boxes)), key=lambda i: (int(((boxes[i][1] + boxes[i][3]) / 2) // 15), (boxes[i][0] + boxes[i][2]) / 2))
|
| 78 |
+
crops = []
|
| 79 |
+
for i in order:
|
| 80 |
+
x0, y0, x1, y1 = boxes[i]
|
| 81 |
+
hh = y1 - y0
|
| 82 |
+
x0, x1 = x0 - 0.01 * (x1 - x0) - 2, x1 + 0.01 * (x1 - x0) + 2
|
| 83 |
+
y0, y1 = y0 - 0.1 * hh - 1, y1 + 0.1 * hh + 1
|
| 84 |
+
X0, Y0, X1, Y1 = [int(round(v * sc)) for v in (max(x0, 0), max(y0, 0), x1, y1)]
|
| 85 |
+
X0, Y0, X1, Y1 = max(X0, 0), max(Y0, 0), min(X1, W), min(Y1, H)
|
| 86 |
+
if X1 - X0 < 4 or Y1 - Y0 < 4:
|
| 87 |
+
continue
|
| 88 |
+
crops.append(big.crop((X0, Y0, X1, Y1)))
|
| 89 |
+
hyp = []
|
| 90 |
+
for s0 in range(0, len(crops), 16):
|
| 91 |
+
recs = vc.generate_batch("paddleocr_vl_1_6", model, proc, tok, crops[s0:s0 + 16], vc.MAXNEW["line"], tmpl_kw, gc, stop_set, dev)
|
| 92 |
+
hyp += [" ".join(unicodedata.normalize("NFC", r["raw"]).split()) for r in recs]
|
| 93 |
+
rec = {"id": pg["id"], "prompt": "detB1", "n_boxes": len(boxes), "n_new": 0, "stopped": True,
|
| 94 |
+
"seconds": round(time.time() - t1, 1), "hyp_lines": [h for h in hyp if h],
|
| 95 |
+
"ref_lines": json.loads(pg["ref_lines_json"]) if pg.get("ref_lines_json") else []}
|
| 96 |
+
fo.write(json.dumps(rec, ensure_ascii=False) + "\n")
|
| 97 |
+
fo.flush()
|
| 98 |
+
print(pg["id"], "boxes", len(boxes), "%.1f s" % rec["seconds"], flush=True)
|
| 99 |
+
print("done", flush=True)
|
scripts/b1_page_check/detb1_page_check.sbatch
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
#SBATCH --job-name=detb1_page_check
|
| 3 |
+
#SBATCH --partition=ZEN4
|
| 4 |
+
#SBATCH --cpus-per-task=16
|
| 5 |
+
#SBATCH --mem=48G
|
| 6 |
+
#SBATCH --time=00:35:00
|
| 7 |
+
#SBATCH --array=0-7
|
| 8 |
+
#SBATCH --output=/path/to/TURKIC_OCR_DATA/logs/%x_%A_%a.out
|
| 9 |
+
# Task t: set = gen (t<4) or school; chunk = t%4 of 4 (2-3 pages each).
|
| 10 |
+
set -u
|
| 11 |
+
CODE=/path/to/TURKIC_OCR_CODE
|
| 12 |
+
D=/path/to/TURKIC_OCR_DATA
|
| 13 |
+
P=$D/data/processed/r5_linedet_det
|
| 14 |
+
E=$D/outputs/r5/linedet/det_eval
|
| 15 |
+
OUT=$D/outputs/r5/b1_page_check
|
| 16 |
+
t=$SLURM_ARRAY_TASK_ID
|
| 17 |
+
if [ $t -lt 4 ]; then S=gen; PAGES=$P/gen/pages_gen_val.tsv; STRIDE=30; else S=school; PAGES=$P/school2/pages_school_val.tsv; STRIDE=15; fi
|
| 18 |
+
C=$((t % 4))
|
| 19 |
+
export HF_HUB_OFFLINE=1 TRANSFORMERS_OFFLINE=1 OMP_NUM_THREADS=16
|
| 20 |
+
hostname; date -u
|
| 21 |
+
$CODE/.venv_vlm/bin/python -I $CODE/scripts/b1_page_check/detb1_page_check.py --set $S --pages $PAGES --stride $STRIDE --n 10 \
|
| 22 |
+
--chunk $C --chunks 4 --routeA $E/e2e_yolo_s2_${S}_val_A1_long_pages.jsonl --model $D/checkpoints/r5/paddleocr_vl_1_6/leader \
|
| 23 |
+
--out $OUT/${S}_detB1_c${C}.jsonl --threads 16
|
| 24 |
+
echo "=== exit $? $(date -u)"
|
scripts/j2/build_screen_set.py
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Build screen_set_v1.tsv by screen_rule_v1.txt. Reads only validation.tsv.
|
| 2 |
+
|
| 3 |
+
usage: build_screen_set.py VALIDATION_TSV OUT_TSV
|
| 4 |
+
"""
|
| 5 |
+
import collections
|
| 6 |
+
import hashlib
|
| 7 |
+
import sys
|
| 8 |
+
|
| 9 |
+
val_path, out_path = sys.argv[1], sys.argv[2]
|
| 10 |
+
assert val_path.endswith("kohtd_split_v1/validation.tsv"), "only the validation split may be read"
|
| 11 |
+
|
| 12 |
+
rows = []
|
| 13 |
+
with open(val_path, encoding="utf-8", newline="") as f:
|
| 14 |
+
hdr = f.readline().rstrip("\n").split("\t")
|
| 15 |
+
assert hdr == ["crop_file", "form_id", "label", "key_type"], hdr
|
| 16 |
+
for line in f:
|
| 17 |
+
parts = line.rstrip("\n").split("\t")
|
| 18 |
+
assert len(parts) == 4, repr(line)
|
| 19 |
+
rows.append(parts)
|
| 20 |
+
|
| 21 |
+
by_form = collections.defaultdict(list)
|
| 22 |
+
for crop_file, form_id, label, key_type in rows:
|
| 23 |
+
h = hashlib.sha256(("J11-screen-v1:" + crop_file).encode("utf-8")).hexdigest()
|
| 24 |
+
by_form[form_id].append((h, crop_file, label))
|
| 25 |
+
|
| 26 |
+
out = []
|
| 27 |
+
for form_id in sorted(by_form, key=lambda x: int(x)):
|
| 28 |
+
items = sorted(by_form[form_id]) # ascending hex digest as text
|
| 29 |
+
for h, crop_file, label in items[:15]:
|
| 30 |
+
out.append((crop_file, form_id, label))
|
| 31 |
+
|
| 32 |
+
with open(out_path, "w", encoding="utf-8", newline="") as f:
|
| 33 |
+
f.write("crop_file\tform_id\tlabel\n")
|
| 34 |
+
for crop_file, form_id, label in out:
|
| 35 |
+
f.write(f"{crop_file}\t{form_id}\t{label}\n")
|
| 36 |
+
|
| 37 |
+
print("forms", len(by_form), "crops in list", len(out))
|
| 38 |
+
print("forms with fewer than 15 crops", sum(1 for v in by_form.values() if len(v) < 15))
|
scripts/j2/check_images_kwargs.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Does images_kwargs (size) reach the image processor in apply_chat_template? Processor only, one crop, no model.
|
| 2 |
+
usage: check_images_kwargs.py MODELS_DIR PROMPTS_JSON IMG_DIR CROP_FILE short [short ...]"""
|
| 3 |
+
import json
|
| 4 |
+
import os
|
| 5 |
+
import sys
|
| 6 |
+
|
| 7 |
+
os.environ["HF_HUB_OFFLINE"] = "1"
|
| 8 |
+
import transformers
|
| 9 |
+
from PIL import Image
|
| 10 |
+
|
| 11 |
+
models_dir, prompts_json, img_dir, crop = sys.argv[1:5]
|
| 12 |
+
P = json.load(open(prompts_json, encoding="utf-8"))
|
| 13 |
+
im = Image.open(os.path.join(img_dir, crop)).convert("RGB")
|
| 14 |
+
print("crop size", im.size)
|
| 15 |
+
for short in sys.argv[5:]:
|
| 16 |
+
proc = transformers.AutoProcessor.from_pretrained(os.path.join(models_dir, short), trust_remote_code=False)
|
| 17 |
+
ik = P[short].get("images_kwargs")
|
| 18 |
+
if ik and ik["size"]["shortest_edge"] == "MIN_PIXELS_FROM_PROCESSOR":
|
| 19 |
+
sz = proc.image_processor.size
|
| 20 |
+
ik["size"]["shortest_edge"] = int(sz["shortest_edge"] if isinstance(sz, dict) else sz.shortest_edge)
|
| 21 |
+
txt = [{"type": "text", "text": P[short]["prompt"]}] if P[short]["prompt"] else []
|
| 22 |
+
conv = [[{"role": "user", "content": [{"type": "image", "image": im}] + txt}]]
|
| 23 |
+
for label, kw in (("without images_kwargs", {}), ("with images_kwargs", {"images_kwargs": ik} if ik else {})):
|
| 24 |
+
out = proc.apply_chat_template(conv, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", padding=True, **kw)
|
| 25 |
+
grid = out.get("image_grid_thw")
|
| 26 |
+
print(short, label, "input_ids", tuple(out["input_ids"].shape), "image_grid_thw", None if grid is None else grid.tolist(), "ik", ik)
|
scripts/j2/codec_238.json
ADDED
|
@@ -0,0 +1,244 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"source": "project records R3/O1_golden_middle/work/codec_count.json, key designed_codepoints (own count of 18-19 Nov, O1; listed in docs/research_artifacts/round_2026-11-19/O1_golden_middle/variants.json planning_number as 238 output symbols, NFC form)",
|
| 3 |
+
"count": 238,
|
| 4 |
+
"codepoints": [
|
| 5 |
+
"U+0020",
|
| 6 |
+
"U+0021",
|
| 7 |
+
"U+0022",
|
| 8 |
+
"U+0023",
|
| 9 |
+
"U+0024",
|
| 10 |
+
"U+0025",
|
| 11 |
+
"U+0026",
|
| 12 |
+
"U+0027",
|
| 13 |
+
"U+0028",
|
| 14 |
+
"U+0029",
|
| 15 |
+
"U+002A",
|
| 16 |
+
"U+002B",
|
| 17 |
+
"U+002C",
|
| 18 |
+
"U+002D",
|
| 19 |
+
"U+002E",
|
| 20 |
+
"U+002F",
|
| 21 |
+
"U+0030",
|
| 22 |
+
"U+0031",
|
| 23 |
+
"U+0032",
|
| 24 |
+
"U+0033",
|
| 25 |
+
"U+0034",
|
| 26 |
+
"U+0035",
|
| 27 |
+
"U+0036",
|
| 28 |
+
"U+0037",
|
| 29 |
+
"U+0038",
|
| 30 |
+
"U+0039",
|
| 31 |
+
"U+003A",
|
| 32 |
+
"U+003B",
|
| 33 |
+
"U+003C",
|
| 34 |
+
"U+003D",
|
| 35 |
+
"U+003E",
|
| 36 |
+
"U+003F",
|
| 37 |
+
"U+0040",
|
| 38 |
+
"U+0041",
|
| 39 |
+
"U+0042",
|
| 40 |
+
"U+0043",
|
| 41 |
+
"U+0044",
|
| 42 |
+
"U+0045",
|
| 43 |
+
"U+0046",
|
| 44 |
+
"U+0047",
|
| 45 |
+
"U+0048",
|
| 46 |
+
"U+0049",
|
| 47 |
+
"U+004A",
|
| 48 |
+
"U+004B",
|
| 49 |
+
"U+004C",
|
| 50 |
+
"U+004D",
|
| 51 |
+
"U+004E",
|
| 52 |
+
"U+004F",
|
| 53 |
+
"U+0050",
|
| 54 |
+
"U+0051",
|
| 55 |
+
"U+0052",
|
| 56 |
+
"U+0053",
|
| 57 |
+
"U+0054",
|
| 58 |
+
"U+0055",
|
| 59 |
+
"U+0056",
|
| 60 |
+
"U+0057",
|
| 61 |
+
"U+0058",
|
| 62 |
+
"U+0059",
|
| 63 |
+
"U+005A",
|
| 64 |
+
"U+005B",
|
| 65 |
+
"U+005C",
|
| 66 |
+
"U+005D",
|
| 67 |
+
"U+005E",
|
| 68 |
+
"U+005F",
|
| 69 |
+
"U+0060",
|
| 70 |
+
"U+0061",
|
| 71 |
+
"U+0062",
|
| 72 |
+
"U+0063",
|
| 73 |
+
"U+0064",
|
| 74 |
+
"U+0065",
|
| 75 |
+
"U+0066",
|
| 76 |
+
"U+0067",
|
| 77 |
+
"U+0068",
|
| 78 |
+
"U+0069",
|
| 79 |
+
"U+006A",
|
| 80 |
+
"U+006B",
|
| 81 |
+
"U+006C",
|
| 82 |
+
"U+006D",
|
| 83 |
+
"U+006E",
|
| 84 |
+
"U+006F",
|
| 85 |
+
"U+0070",
|
| 86 |
+
"U+0071",
|
| 87 |
+
"U+0072",
|
| 88 |
+
"U+0073",
|
| 89 |
+
"U+0074",
|
| 90 |
+
"U+0075",
|
| 91 |
+
"U+0076",
|
| 92 |
+
"U+0077",
|
| 93 |
+
"U+0078",
|
| 94 |
+
"U+0079",
|
| 95 |
+
"U+007A",
|
| 96 |
+
"U+007B",
|
| 97 |
+
"U+007C",
|
| 98 |
+
"U+007D",
|
| 99 |
+
"U+007E",
|
| 100 |
+
"U+00A7",
|
| 101 |
+
"U+00AB",
|
| 102 |
+
"U+00B0",
|
| 103 |
+
"U+00BB",
|
| 104 |
+
"U+00C4",
|
| 105 |
+
"U+00C7",
|
| 106 |
+
"U+00D6",
|
| 107 |
+
"U+00DC",
|
| 108 |
+
"U+00DD",
|
| 109 |
+
"U+00E4",
|
| 110 |
+
"U+00E7",
|
| 111 |
+
"U+00F6",
|
| 112 |
+
"U+00FC",
|
| 113 |
+
"U+00FD",
|
| 114 |
+
"U+011E",
|
| 115 |
+
"U+011F",
|
| 116 |
+
"U+0130",
|
| 117 |
+
"U+0131",
|
| 118 |
+
"U+0147",
|
| 119 |
+
"U+0148",
|
| 120 |
+
"U+015E",
|
| 121 |
+
"U+015F",
|
| 122 |
+
"U+017D",
|
| 123 |
+
"U+017E",
|
| 124 |
+
"U+018F",
|
| 125 |
+
"U+0259",
|
| 126 |
+
"U+02BB",
|
| 127 |
+
"U+02BC",
|
| 128 |
+
"U+0401",
|
| 129 |
+
"U+0404",
|
| 130 |
+
"U+0406",
|
| 131 |
+
"U+0407",
|
| 132 |
+
"U+040E",
|
| 133 |
+
"U+0410",
|
| 134 |
+
"U+0411",
|
| 135 |
+
"U+0412",
|
| 136 |
+
"U+0413",
|
| 137 |
+
"U+0414",
|
| 138 |
+
"U+0415",
|
| 139 |
+
"U+0416",
|
| 140 |
+
"U+0417",
|
| 141 |
+
"U+0418",
|
| 142 |
+
"U+0419",
|
| 143 |
+
"U+041A",
|
| 144 |
+
"U+041B",
|
| 145 |
+
"U+041C",
|
| 146 |
+
"U+041D",
|
| 147 |
+
"U+041E",
|
| 148 |
+
"U+041F",
|
| 149 |
+
"U+0420",
|
| 150 |
+
"U+0421",
|
| 151 |
+
"U+0422",
|
| 152 |
+
"U+0423",
|
| 153 |
+
"U+0424",
|
| 154 |
+
"U+0425",
|
| 155 |
+
"U+0426",
|
| 156 |
+
"U+0427",
|
| 157 |
+
"U+0428",
|
| 158 |
+
"U+0429",
|
| 159 |
+
"U+042A",
|
| 160 |
+
"U+042B",
|
| 161 |
+
"U+042C",
|
| 162 |
+
"U+042D",
|
| 163 |
+
"U+042E",
|
| 164 |
+
"U+042F",
|
| 165 |
+
"U+0430",
|
| 166 |
+
"U+0431",
|
| 167 |
+
"U+0432",
|
| 168 |
+
"U+0433",
|
| 169 |
+
"U+0434",
|
| 170 |
+
"U+0435",
|
| 171 |
+
"U+0436",
|
| 172 |
+
"U+0437",
|
| 173 |
+
"U+0438",
|
| 174 |
+
"U+0439",
|
| 175 |
+
"U+043A",
|
| 176 |
+
"U+043B",
|
| 177 |
+
"U+043C",
|
| 178 |
+
"U+043D",
|
| 179 |
+
"U+043E",
|
| 180 |
+
"U+043F",
|
| 181 |
+
"U+0440",
|
| 182 |
+
"U+0441",
|
| 183 |
+
"U+0442",
|
| 184 |
+
"U+0443",
|
| 185 |
+
"U+0444",
|
| 186 |
+
"U+0445",
|
| 187 |
+
"U+0446",
|
| 188 |
+
"U+0447",
|
| 189 |
+
"U+0448",
|
| 190 |
+
"U+0449",
|
| 191 |
+
"U+044A",
|
| 192 |
+
"U+044B",
|
| 193 |
+
"U+044C",
|
| 194 |
+
"U+044D",
|
| 195 |
+
"U+044E",
|
| 196 |
+
"U+044F",
|
| 197 |
+
"U+0451",
|
| 198 |
+
"U+0454",
|
| 199 |
+
"U+0456",
|
| 200 |
+
"U+0457",
|
| 201 |
+
"U+045E",
|
| 202 |
+
"U+0490",
|
| 203 |
+
"U+0491",
|
| 204 |
+
"U+0492",
|
| 205 |
+
"U+0493",
|
| 206 |
+
"U+0494",
|
| 207 |
+
"U+0495",
|
| 208 |
+
"U+0496",
|
| 209 |
+
"U+0497",
|
| 210 |
+
"U+0498",
|
| 211 |
+
"U+0499",
|
| 212 |
+
"U+049A",
|
| 213 |
+
"U+049B",
|
| 214 |
+
"U+04A0",
|
| 215 |
+
"U+04A1",
|
| 216 |
+
"U+04A2",
|
| 217 |
+
"U+04A3",
|
| 218 |
+
"U+04A4",
|
| 219 |
+
"U+04A5",
|
| 220 |
+
"U+04AA",
|
| 221 |
+
"U+04AB",
|
| 222 |
+
"U+04AE",
|
| 223 |
+
"U+04AF",
|
| 224 |
+
"U+04B0",
|
| 225 |
+
"U+04B1",
|
| 226 |
+
"U+04B2",
|
| 227 |
+
"U+04B3",
|
| 228 |
+
"U+04BA",
|
| 229 |
+
"U+04BB",
|
| 230 |
+
"U+04D8",
|
| 231 |
+
"U+04D9",
|
| 232 |
+
"U+04E8",
|
| 233 |
+
"U+04E9",
|
| 234 |
+
"U+2013",
|
| 235 |
+
"U+2014",
|
| 236 |
+
"U+2018",
|
| 237 |
+
"U+2019",
|
| 238 |
+
"U+201C",
|
| 239 |
+
"U+201D",
|
| 240 |
+
"U+201E",
|
| 241 |
+
"U+2026",
|
| 242 |
+
"U+2116"
|
| 243 |
+
]
|
| 244 |
+
}
|