Add raw-only rc8 release with ONNX dynamic q8
Browse files- .gitattributes +0 -30
- .gitignore +3 -0
- LICENSE +73 -0
- NOTICE +9 -0
- README.md +177 -0
- common.py +443 -0
- config.json +353 -0
- eval/benchmark_manual_suite_multilabel_base_irish_core_pii_v1.json +197 -0
- eval/benchmark_manual_suite_multilabel_base_irish_ppsn_phone_edge_v1.json +76 -0
- eval/benchmark_multilingual_ppsn_v1_all_openmed_mliteclinical_base_cpu.json +159 -0
- eval/benchmark_summary.json +90 -0
- eval/benchmark_summary.md +40 -0
- eval/rc8h_cal3_core_t050_cpu.json +108 -0
- eval/rc8h_cal3_edge_t050_cpu.json +36 -0
- eval/rc8h_cal3_finance_boundary_t050_cpu.json +76 -0
- eval/rc8h_cal3_finance_t050_cpu.json +76 -0
- eval/rc8h_cal3_gaweak_t050_cpu.json +28 -0
- eval/rc8h_cal3_multilingual_t050_cpu.json +28 -0
- eval/rc8h_cal3_q8_core_t050_cpu.json +108 -0
- eval/rc8h_cal3_q8_edge_t050_cpu.json +36 -0
- eval/rc8h_cal3_q8_finance_boundary_t050_cpu.json +76 -0
- eval/rc8h_cal3_q8_finance_t050_cpu.json +76 -0
- eval/rc8h_cal3_q8_gaweak_t050_cpu.json +28 -0
- eval/rc8h_cal3_q8_multilingual_t050_cpu.json +28 -0
- eval/rc8h_cal3_q8_user_t050_cpu.json +28 -0
- eval/rc8h_cal3_user_t050_cpu.json +28 -0
- inference_mask.py +104 -0
- inference_mask_onnx.py +90 -0
- model.py +75 -0
- model.safetensors +3 -0
- multitask_head_meta.json +43 -0
- multitask_model.py +91 -0
- onnx/model.onnx +3 -0
- onnx/model.preprocessed.onnx +3 -0
- onnx/model_quantized.onnx +3 -0
- onnx/onnx_export.json +12 -0
- onnx/quantization.json +26 -0
- pyproject.toml +17 -0
- qa_config.json +14 -0
- special_tokens_map.json +37 -0
- tokenizer.json +0 -0
- tokenizer_config.json +61 -0
- training_sources.json +73 -0
- vocab.txt +0 -0
.gitattributes
CHANGED
|
@@ -1,35 +1,5 @@
|
|
| 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
|
|
|
|
|
|
|
|
|
|
| 1 |
*.bin filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
*.onnx filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 4 |
*.pth filter=lfs diff=lfs merge=lfs -text
|
|
|
|
| 5 |
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.gitignore
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
__pycache__/
|
| 2 |
+
*.pyc
|
| 3 |
+
.venv/
|
LICENSE
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Apache License
|
| 2 |
+
Version 2.0, January 2004
|
| 3 |
+
http://www.apache.org/licenses/
|
| 4 |
+
|
| 5 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 6 |
+
|
| 7 |
+
1. Definitions.
|
| 8 |
+
|
| 9 |
+
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
| 10 |
+
|
| 11 |
+
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
| 12 |
+
|
| 13 |
+
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
| 14 |
+
|
| 15 |
+
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
| 16 |
+
|
| 17 |
+
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
| 18 |
+
|
| 19 |
+
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
| 20 |
+
|
| 21 |
+
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
| 22 |
+
|
| 23 |
+
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
| 24 |
+
|
| 25 |
+
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
| 26 |
+
|
| 27 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
| 28 |
+
|
| 29 |
+
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
| 30 |
+
|
| 31 |
+
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
| 32 |
+
|
| 33 |
+
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
| 34 |
+
|
| 35 |
+
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
| 36 |
+
|
| 37 |
+
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
|
| 38 |
+
|
| 39 |
+
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
| 40 |
+
|
| 41 |
+
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
|
| 42 |
+
|
| 43 |
+
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
| 44 |
+
|
| 45 |
+
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
| 46 |
+
|
| 47 |
+
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
| 48 |
+
|
| 49 |
+
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
| 50 |
+
|
| 51 |
+
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
| 52 |
+
|
| 53 |
+
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
| 54 |
+
|
| 55 |
+
END OF TERMS AND CONDITIONS
|
| 56 |
+
|
| 57 |
+
APPENDIX: How to apply the Apache License to your work.
|
| 58 |
+
|
| 59 |
+
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
|
| 60 |
+
|
| 61 |
+
Copyright [yyyy] [name of copyright owner]
|
| 62 |
+
|
| 63 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 64 |
+
you may not use this file except in compliance with the License.
|
| 65 |
+
You may obtain a copy of the License at
|
| 66 |
+
|
| 67 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 68 |
+
|
| 69 |
+
Unless required by applicable law or agreed to in writing, software
|
| 70 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 71 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 72 |
+
See the License for the specific language governing permissions and
|
| 73 |
+
limitations under the License.
|
NOTICE
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
This release is derived from OpenMed/OpenMed-PII-mLiteClinical-Base-135M-v1 (Apache-2.0).
|
| 2 |
+
|
| 3 |
+
Additional training data attribution:
|
| 4 |
+
- temsa/OpenMed-Irish-CorePII-TrainMix-v1 (composite train mix)
|
| 5 |
+
- temsa/OpenMed-Irish-PPSN-Eircode-Spec-v1 (synthetic dataset)
|
| 6 |
+
- joelniklaus/mapa (CC-BY-4.0)
|
| 7 |
+
- gretelai/synthetic_pii_finance_multilingual (Apache-2.0)
|
| 8 |
+
|
| 9 |
+
This repo distributes model artifacts and synthetic benchmark files. It does not redistribute third-party dataset rows from upstream datasets.
|
README.md
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
- ga
|
| 5 |
+
license: apache-2.0
|
| 6 |
+
library_name: transformers
|
| 7 |
+
pipeline_tag: token-classification
|
| 8 |
+
tags:
|
| 9 |
+
- pii
|
| 10 |
+
- de-identification
|
| 11 |
+
- token-classification
|
| 12 |
+
- ireland
|
| 13 |
+
- irish
|
| 14 |
+
- gaelic
|
| 15 |
+
- raw-only
|
| 16 |
+
- ppsn
|
| 17 |
+
- eircode
|
| 18 |
+
- passport
|
| 19 |
+
- phone-number
|
| 20 |
+
- onnx
|
| 21 |
+
- int8
|
| 22 |
+
- dynamic-quantization
|
| 23 |
+
base_model:
|
| 24 |
+
- OpenMed/OpenMed-PII-mLiteClinical-Base-135M-v1
|
| 25 |
+
datasets:
|
| 26 |
+
- temsa/OpenMed-Irish-CorePII-TrainMix-v1
|
| 27 |
+
- temsa/OpenMed-Irish-PPSN-Eircode-Spec-v1
|
| 28 |
+
- joelniklaus/mapa
|
| 29 |
+
- gretelai/synthetic_pii_finance_multilingual
|
| 30 |
+
---
|
| 31 |
+
|
| 32 |
+
# OpenMed-mLiteClinical-IrishCorePII-135M-v2-rc8
|
| 33 |
+
|
| 34 |
+
Raw-only Irish core PII release derived from `OpenMed/OpenMed-PII-mLiteClinical-Base-135M-v1`.
|
| 35 |
+
|
| 36 |
+
This repo does **not** require the scanner / validator layer used by `temsa/OpenMed-mLiteClinical-IrishCorePII-135M-v2-rc7`.
|
| 37 |
+
Both the full checkpoint and the ONNX q8 artifact use the same learned score-only decoder over token-presence and typed boundary heads.
|
| 38 |
+
|
| 39 |
+
## Coverage
|
| 40 |
+
|
| 41 |
+
- `PPSN`
|
| 42 |
+
- `ACCOUNT_NUMBER`
|
| 43 |
+
- `BANK_ROUTING_NUMBER`
|
| 44 |
+
- `CREDIT_DEBIT_CARD`
|
| 45 |
+
- `PASSPORT_NUMBER`
|
| 46 |
+
- `POSTCODE`
|
| 47 |
+
- `PHONE_NUMBER`
|
| 48 |
+
- `EMAIL`
|
| 49 |
+
- `FIRST_NAME`
|
| 50 |
+
- `LAST_NAME`
|
| 51 |
+
- `SWIFT_BIC`
|
| 52 |
+
|
| 53 |
+
## Included Variants
|
| 54 |
+
|
| 55 |
+
- Full `transformers` checkpoint in the repo root
|
| 56 |
+
- Unquantized ONNX export in `onnx/model.onnx`
|
| 57 |
+
- Dynamic q8 ONNX artifact in `onnx/model_quantized.onnx`
|
| 58 |
+
- `inference_mask.py` for the full checkpoint
|
| 59 |
+
- `inference_mask_onnx.py` for the ONNX q8 artifact
|
| 60 |
+
- `common.py`, `model.py`, and `multitask_model.py` implementing the raw-only decoder
|
| 61 |
+
- benchmark files in `eval/`
|
| 62 |
+
|
| 63 |
+
Artifact sizes:
|
| 64 |
+
|
| 65 |
+
- Full checkpoint: `515 MB` (`model.safetensors`)
|
| 66 |
+
- Dynamic q8 ONNX: `393 MB` (`onnx/model_quantized.onnx`)
|
| 67 |
+
|
| 68 |
+
## What Changed From rc7
|
| 69 |
+
|
| 70 |
+
`rc7` achieves its public quality with a bundled scanner / validator inference stack.
|
| 71 |
+
|
| 72 |
+
`rc8` removes that layer completely:
|
| 73 |
+
|
| 74 |
+
- no regex-based candidate extraction
|
| 75 |
+
- no checksum validator dependency at inference time
|
| 76 |
+
- no separate scanner spec or generated scanner code
|
| 77 |
+
- same compact `mLiteClinical` encoder family, but with a raw-only multi-head decoder
|
| 78 |
+
|
| 79 |
+
The tradeoff is explicit:
|
| 80 |
+
|
| 81 |
+
- `rc7` is still stronger on the broad manual Irish core suite
|
| 82 |
+
- `rc8` is easier to embed, simpler to maintain, and its ONNX q8 path stays very close to the full checkpoint
|
| 83 |
+
|
| 84 |
+
## Architecture
|
| 85 |
+
|
| 86 |
+
`rc8` keeps the DistilBERT-size encoder class of the 135M `mLiteClinical` base and adds:
|
| 87 |
+
|
| 88 |
+
- a token-presence head for each released label
|
| 89 |
+
- a typed start-boundary head
|
| 90 |
+
- a typed end-boundary head
|
| 91 |
+
- a score-only decoder that uses model scores, token offsets, continuity priors, and minimum-length priors from config
|
| 92 |
+
|
| 93 |
+
There is no scanner or external validator in the release path.
|
| 94 |
+
|
| 95 |
+
Design references that informed this direction:
|
| 96 |
+
|
| 97 |
+
- Split-NER: https://aclanthology.org/2023.acl-short.36/
|
| 98 |
+
- SpanNER: https://aclanthology.org/2021.acl-long.558/
|
| 99 |
+
- Boundary Smoothing for Named Entity Recognition: https://aclanthology.org/2022.acl-long.490/
|
| 100 |
+
- TinyBERT: https://aclanthology.org/2020.findings-emnlp.372/
|
| 101 |
+
|
| 102 |
+
## How To Use It
|
| 103 |
+
|
| 104 |
+
Full checkpoint:
|
| 105 |
+
|
| 106 |
+
```bash
|
| 107 |
+
uv run python inference_mask.py \
|
| 108 |
+
--model temsa/OpenMed-mLiteClinical-IrishCorePII-135M-v2-rc8 \
|
| 109 |
+
--min-score 0.5 \
|
| 110 |
+
--text "My PPSN is 1234567TW, my Eircode is D02 X285, and my phone is 087 123 4567." \
|
| 111 |
+
--json
|
| 112 |
+
```
|
| 113 |
+
|
| 114 |
+
Dynamic q8 ONNX:
|
| 115 |
+
|
| 116 |
+
```bash
|
| 117 |
+
uv run python inference_mask_onnx.py \
|
| 118 |
+
--model temsa/OpenMed-mLiteClinical-IrishCorePII-135M-v2-rc8 \
|
| 119 |
+
--min-score 0.5 \
|
| 120 |
+
--text "Please provide your passport NN5123456 and call me on 0851234567." \
|
| 121 |
+
--json
|
| 122 |
+
```
|
| 123 |
+
|
| 124 |
+
## Benchmarks
|
| 125 |
+
|
| 126 |
+
Main comparison:
|
| 127 |
+
|
| 128 |
+
| Model | Irish core F1 | Edge F1 | Finance F1 | Finance-boundary F1 | User PPSN F1 | GA weak PPSN F1 | Multilingual PPSN F1 | Core CPU ex/s | Multilingual CPU ex/s |
|
| 129 |
+
|---|---:|---:|---:|---:|---:|---:|---:|---:|---:|
|
| 130 |
+
| Base OpenMed | 0.3743 | 0.0556 | - | - | - | - | 0.0000 | 15.1811 | 37.4666 |
|
| 131 |
+
| Previous public `rc7` full | 1.0000 | - | 1.0000 | 1.0000 | - | 1.0000 | - | 3.5394 | - |
|
| 132 |
+
| Previous public `rc7` ONNX q8 | 0.9934 | - | 1.0000 | 1.0000 | - | 1.0000 | - | 12.1653 | - |
|
| 133 |
+
| `rc8` full | 0.9737 | 1.0000 | 1.0000 | 1.0000 | 1.0000 | 1.0000 | 0.9176 | 2.2965 | 6.3095 |
|
| 134 |
+
| `rc8` ONNX q8 | 0.9737 | 1.0000 | 1.0000 | 1.0000 | 1.0000 | 1.0000 | 0.9176 | 46.1420 | 99.7166 |
|
| 135 |
+
|
| 136 |
+
Irish core label breakdown:
|
| 137 |
+
|
| 138 |
+
| Label | `rc8` full | `rc8` ONNX q8 |
|
| 139 |
+
|---|---:|---:|
|
| 140 |
+
| PPSN | 1.0000 | 1.0000 |
|
| 141 |
+
| PHONE_NUMBER | 0.9565 | 0.9565 |
|
| 142 |
+
| POSTCODE | 1.0000 | 1.0000 |
|
| 143 |
+
| ACCOUNT_NUMBER | 0.8000 | 0.8000 |
|
| 144 |
+
| PASSPORT_NUMBER | 1.0000 | 1.0000 |
|
| 145 |
+
| EMAIL | 1.0000 | 1.0000 |
|
| 146 |
+
| FIRST_NAME | 0.9744 | 0.9744 |
|
| 147 |
+
| LAST_NAME | 0.9744 | 0.9744 |
|
| 148 |
+
|
| 149 |
+
## Dynamic q8 Artifact
|
| 150 |
+
|
| 151 |
+
Artifact paths:
|
| 152 |
+
|
| 153 |
+
- unquantized: `onnx/model.onnx`
|
| 154 |
+
- preprocessed: `onnx/model.preprocessed.onnx`
|
| 155 |
+
- quantized: `onnx/model_quantized.onnx`
|
| 156 |
+
|
| 157 |
+
Quantization recipe used here:
|
| 158 |
+
|
| 159 |
+
- ONNX pre-processing before quantization
|
| 160 |
+
- ONNX Runtime dynamic int8
|
| 161 |
+
- `qint8`
|
| 162 |
+
- `per_channel=true`
|
| 163 |
+
- `op_types=MatMul,Gemm,Attention`
|
| 164 |
+
|
| 165 |
+
For CPU deployment, the ONNX q8 artifact is the recommended default.
|
| 166 |
+
|
| 167 |
+
## Limits
|
| 168 |
+
|
| 169 |
+
- `rc8` is raw-only. It intentionally gives up the scanner/validator stack used by `rc7`, so its broad manual-suite ceiling is lower.
|
| 170 |
+
- The current remaining local misses are a bare 8-digit account-number case and one Gaelic phone-number case in the manual core suite.
|
| 171 |
+
- If you need the exact `rc8` behavior, use the bundled inference scripts or import `decode_token_presence_segments` from `common.py`.
|
| 172 |
+
|
| 173 |
+
## License And Attribution
|
| 174 |
+
|
| 175 |
+
- Release license: Apache-2.0
|
| 176 |
+
- Base model: `OpenMed/OpenMed-PII-mLiteClinical-Base-135M-v1`
|
| 177 |
+
- See `NOTICE` and `training_sources.json` for attribution and training details.
|
common.py
ADDED
|
@@ -0,0 +1,443 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
from __future__ import annotations
|
| 3 |
+
|
| 4 |
+
import json
|
| 5 |
+
import tempfile
|
| 6 |
+
from pathlib import Path
|
| 7 |
+
from typing import Any
|
| 8 |
+
|
| 9 |
+
import numpy as np
|
| 10 |
+
from huggingface_hub import HfApi, hf_hub_download
|
| 11 |
+
from transformers import AutoConfig, AutoTokenizer
|
| 12 |
+
|
| 13 |
+
TOKENIZER_FILES = [
|
| 14 |
+
"tokenizer_config.json",
|
| 15 |
+
"tokenizer.json",
|
| 16 |
+
"special_tokens_map.json",
|
| 17 |
+
"vocab.txt",
|
| 18 |
+
"vocab.json",
|
| 19 |
+
"merges.txt",
|
| 20 |
+
"added_tokens.json",
|
| 21 |
+
"sentencepiece.bpe.model",
|
| 22 |
+
"spiece.model",
|
| 23 |
+
]
|
| 24 |
+
DEFAULT_LABEL_MAX_SPAN_TOKENS = {
|
| 25 |
+
# Token-piece limits, not word limits. These need to reflect how the
|
| 26 |
+
# underlying tokenizer actually fragments compact identifiers.
|
| 27 |
+
"PPSN": 9,
|
| 28 |
+
"POSTCODE": 7,
|
| 29 |
+
"PHONE_NUMBER": 10,
|
| 30 |
+
"PASSPORT_NUMBER": 8,
|
| 31 |
+
"BANK_ROUTING_NUMBER": 5,
|
| 32 |
+
"ACCOUNT_NUMBER": 19,
|
| 33 |
+
"CREDIT_DEBIT_CARD": 12,
|
| 34 |
+
"SWIFT_BIC": 8,
|
| 35 |
+
"EMAIL": 15,
|
| 36 |
+
"FIRST_NAME": 5,
|
| 37 |
+
"LAST_NAME": 8,
|
| 38 |
+
}
|
| 39 |
+
DEFAULT_LABEL_MIN_NONSPACE_CHARS = {
|
| 40 |
+
"PPSN": 8,
|
| 41 |
+
"POSTCODE": 6,
|
| 42 |
+
"PHONE_NUMBER": 7,
|
| 43 |
+
"PASSPORT_NUMBER": 7,
|
| 44 |
+
"BANK_ROUTING_NUMBER": 6,
|
| 45 |
+
"ACCOUNT_NUMBER": 6,
|
| 46 |
+
"CREDIT_DEBIT_CARD": 12,
|
| 47 |
+
"SWIFT_BIC": 8,
|
| 48 |
+
"EMAIL": 6,
|
| 49 |
+
"FIRST_NAME": 2,
|
| 50 |
+
"LAST_NAME": 2,
|
| 51 |
+
}
|
| 52 |
+
WHITESPACE_BRIDGE_LABELS = {
|
| 53 |
+
"PPSN",
|
| 54 |
+
"POSTCODE",
|
| 55 |
+
"PHONE_NUMBER",
|
| 56 |
+
"PASSPORT_NUMBER",
|
| 57 |
+
"BANK_ROUTING_NUMBER",
|
| 58 |
+
"ACCOUNT_NUMBER",
|
| 59 |
+
"CREDIT_DEBIT_CARD",
|
| 60 |
+
"SWIFT_BIC",
|
| 61 |
+
"EMAIL",
|
| 62 |
+
}
|
| 63 |
+
CONSERVATIVE_BOUNDARY_REFINEMENT_LABELS = {
|
| 64 |
+
"PPSN",
|
| 65 |
+
"POSTCODE",
|
| 66 |
+
"PHONE_NUMBER",
|
| 67 |
+
"PASSPORT_NUMBER",
|
| 68 |
+
"BANK_ROUTING_NUMBER",
|
| 69 |
+
"ACCOUNT_NUMBER",
|
| 70 |
+
"CREDIT_DEBIT_CARD",
|
| 71 |
+
"SWIFT_BIC",
|
| 72 |
+
"EMAIL",
|
| 73 |
+
}
|
| 74 |
+
OUTPUT_PRIORITY = {
|
| 75 |
+
"PPSN": 0,
|
| 76 |
+
"PASSPORT_NUMBER": 1,
|
| 77 |
+
"ACCOUNT_NUMBER": 2,
|
| 78 |
+
"BANK_ROUTING_NUMBER": 3,
|
| 79 |
+
"CREDIT_DEBIT_CARD": 4,
|
| 80 |
+
"PHONE_NUMBER": 5,
|
| 81 |
+
"SWIFT_BIC": 6,
|
| 82 |
+
"POSTCODE": 7,
|
| 83 |
+
"EMAIL": 8,
|
| 84 |
+
"FIRST_NAME": 9,
|
| 85 |
+
"LAST_NAME": 10,
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
def normalize_entity_name(label: str) -> str:
|
| 90 |
+
label = (label or "").strip()
|
| 91 |
+
if label.startswith("B-") or label.startswith("I-"):
|
| 92 |
+
label = label[2:]
|
| 93 |
+
return label.upper()
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
def _sanitize_tokenizer_dir(tokenizer_path: Path) -> str:
|
| 97 |
+
tokenizer_cfg_path = tokenizer_path / "tokenizer_config.json"
|
| 98 |
+
if not tokenizer_cfg_path.exists():
|
| 99 |
+
return str(tokenizer_path)
|
| 100 |
+
data = json.loads(tokenizer_cfg_path.read_text(encoding="utf-8"))
|
| 101 |
+
if "fix_mistral_regex" not in data:
|
| 102 |
+
return str(tokenizer_path)
|
| 103 |
+
tmpdir = Path(tempfile.mkdtemp(prefix="openmed_span_tokenizer_"))
|
| 104 |
+
keep = set(TOKENIZER_FILES)
|
| 105 |
+
for child in tokenizer_path.iterdir():
|
| 106 |
+
if child.is_file() and child.name in keep:
|
| 107 |
+
(tmpdir / child.name).write_bytes(child.read_bytes())
|
| 108 |
+
data.pop("fix_mistral_regex", None)
|
| 109 |
+
(tmpdir / "tokenizer_config.json").write_text(json.dumps(data, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
|
| 110 |
+
return str(tmpdir)
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
def safe_auto_tokenizer(tokenizer_ref: str):
|
| 114 |
+
tokenizer_path = Path(tokenizer_ref)
|
| 115 |
+
if tokenizer_path.exists():
|
| 116 |
+
tokenizer_ref = _sanitize_tokenizer_dir(tokenizer_path)
|
| 117 |
+
else:
|
| 118 |
+
api = HfApi()
|
| 119 |
+
files = set(api.list_repo_files(repo_id=tokenizer_ref, repo_type="model"))
|
| 120 |
+
tmpdir = Path(tempfile.mkdtemp(prefix="openmed_remote_span_tokenizer_"))
|
| 121 |
+
copied = False
|
| 122 |
+
for name in TOKENIZER_FILES:
|
| 123 |
+
if name not in files:
|
| 124 |
+
continue
|
| 125 |
+
src = hf_hub_download(repo_id=tokenizer_ref, filename=name, repo_type="model")
|
| 126 |
+
(tmpdir / Path(name).name).write_bytes(Path(src).read_bytes())
|
| 127 |
+
copied = True
|
| 128 |
+
if copied:
|
| 129 |
+
tokenizer_ref = _sanitize_tokenizer_dir(tmpdir)
|
| 130 |
+
|
| 131 |
+
try:
|
| 132 |
+
return AutoTokenizer.from_pretrained(tokenizer_ref, use_fast=True, fix_mistral_regex=True)
|
| 133 |
+
except Exception:
|
| 134 |
+
pass
|
| 135 |
+
try:
|
| 136 |
+
return AutoTokenizer.from_pretrained(tokenizer_ref, use_fast=True, fix_mistral_regex=False)
|
| 137 |
+
except TypeError:
|
| 138 |
+
pass
|
| 139 |
+
try:
|
| 140 |
+
return AutoTokenizer.from_pretrained(tokenizer_ref, use_fast=True)
|
| 141 |
+
except Exception:
|
| 142 |
+
return AutoTokenizer.from_pretrained(tokenizer_ref, use_fast=False)
|
| 143 |
+
|
| 144 |
+
|
| 145 |
+
def label_names_from_config(config) -> list[str]:
|
| 146 |
+
names = list(getattr(config, "span_label_names", []))
|
| 147 |
+
if not names:
|
| 148 |
+
raise ValueError("Missing span_label_names in config")
|
| 149 |
+
return [normalize_entity_name(name) for name in names]
|
| 150 |
+
|
| 151 |
+
|
| 152 |
+
def label_thresholds_from_config(config, default_threshold: float) -> dict[str, float]:
|
| 153 |
+
raw = getattr(config, "span_label_thresholds", None) or {}
|
| 154 |
+
out = {normalize_entity_name(key): float(value) for key, value in raw.items()}
|
| 155 |
+
for label in label_names_from_config(config):
|
| 156 |
+
out.setdefault(label, float(default_threshold))
|
| 157 |
+
return out
|
| 158 |
+
|
| 159 |
+
|
| 160 |
+
def token_label_thresholds_from_config(config, default_threshold: float) -> dict[str, float]:
|
| 161 |
+
raw = getattr(config, "token_label_thresholds", None) or {}
|
| 162 |
+
out = {normalize_entity_name(key): float(value) for key, value in raw.items()}
|
| 163 |
+
for label in label_names_from_config(config):
|
| 164 |
+
out.setdefault(label, float(default_threshold))
|
| 165 |
+
return out
|
| 166 |
+
|
| 167 |
+
|
| 168 |
+
def token_extend_thresholds_from_config(config, default_fraction: float = 0.6) -> dict[str, float]:
|
| 169 |
+
raw = getattr(config, "token_extend_thresholds", None) or {}
|
| 170 |
+
out = {normalize_entity_name(key): float(value) for key, value in raw.items()}
|
| 171 |
+
for label in label_names_from_config(config):
|
| 172 |
+
out.setdefault(label, max(0.0, min(1.0, float(token_label_thresholds_from_config(config, 0.5).get(label, 0.5)) * default_fraction)))
|
| 173 |
+
return out
|
| 174 |
+
|
| 175 |
+
|
| 176 |
+
def boundary_label_thresholds_from_config(config, default_threshold: float = 0.0) -> dict[str, float]:
|
| 177 |
+
raw = getattr(config, "boundary_label_thresholds", None) or {}
|
| 178 |
+
out = {normalize_entity_name(key): float(value) for key, value in raw.items()}
|
| 179 |
+
for label in label_names_from_config(config):
|
| 180 |
+
out.setdefault(label, float(default_threshold))
|
| 181 |
+
return out
|
| 182 |
+
|
| 183 |
+
|
| 184 |
+
def label_max_span_tokens_from_config(config) -> dict[str, int]:
|
| 185 |
+
raw = getattr(config, "span_label_max_span_tokens", None) or {}
|
| 186 |
+
out = {normalize_entity_name(key): int(value) for key, value in raw.items()}
|
| 187 |
+
for label, value in DEFAULT_LABEL_MAX_SPAN_TOKENS.items():
|
| 188 |
+
out.setdefault(label, value)
|
| 189 |
+
for label in label_names_from_config(config):
|
| 190 |
+
out.setdefault(label, 8)
|
| 191 |
+
return out
|
| 192 |
+
|
| 193 |
+
|
| 194 |
+
def label_min_nonspace_chars_from_config(config) -> dict[str, int]:
|
| 195 |
+
raw = getattr(config, "span_label_min_nonspace_chars", None) or {}
|
| 196 |
+
out = {normalize_entity_name(key): int(value) for key, value in raw.items()}
|
| 197 |
+
for label, value in DEFAULT_LABEL_MIN_NONSPACE_CHARS.items():
|
| 198 |
+
out.setdefault(label, value)
|
| 199 |
+
for label in label_names_from_config(config):
|
| 200 |
+
out.setdefault(label, 1)
|
| 201 |
+
return out
|
| 202 |
+
|
| 203 |
+
|
| 204 |
+
def overlaps(a: dict, b: dict) -> bool:
|
| 205 |
+
return not (a["end"] <= b["start"] or b["end"] <= a["start"])
|
| 206 |
+
|
| 207 |
+
|
| 208 |
+
def dedupe_spans(spans: list[dict]) -> list[dict]:
|
| 209 |
+
ordered = sorted(
|
| 210 |
+
spans,
|
| 211 |
+
key=lambda item: (-float(item.get("score", 0.0)), item["start"], item["end"], OUTPUT_PRIORITY.get(item["label"], 99)),
|
| 212 |
+
)
|
| 213 |
+
kept = []
|
| 214 |
+
for span in ordered:
|
| 215 |
+
if any(overlaps(span, other) for other in kept):
|
| 216 |
+
continue
|
| 217 |
+
kept.append(span)
|
| 218 |
+
kept.sort(key=lambda item: (item["start"], item["end"], OUTPUT_PRIORITY.get(item["label"], 99)))
|
| 219 |
+
return kept
|
| 220 |
+
|
| 221 |
+
|
| 222 |
+
def _valid_offset(offset: tuple[int, int]) -> bool:
|
| 223 |
+
return bool(offset) and offset[1] > offset[0]
|
| 224 |
+
|
| 225 |
+
|
| 226 |
+
def _has_skippable_bridge(text: str, left: tuple[int, int], right: tuple[int, int], label: str) -> bool:
|
| 227 |
+
bridge = text[int(left[1]) : int(right[0])]
|
| 228 |
+
if bridge == "":
|
| 229 |
+
return True
|
| 230 |
+
return label in WHITESPACE_BRIDGE_LABELS and bridge.isspace()
|
| 231 |
+
|
| 232 |
+
|
| 233 |
+
def _has_left_extension_bridge(text: str, left: tuple[int, int], right: tuple[int, int]) -> bool:
|
| 234 |
+
bridge = text[int(left[1]) : int(right[0])]
|
| 235 |
+
return bridge == ""
|
| 236 |
+
|
| 237 |
+
|
| 238 |
+
def _nonspace_length(text: str, start: int, end: int) -> int:
|
| 239 |
+
return sum(0 if ch.isspace() else 1 for ch in text[int(start) : int(end)])
|
| 240 |
+
|
| 241 |
+
|
| 242 |
+
def decode_span_logits(
|
| 243 |
+
text: str,
|
| 244 |
+
offsets: list[tuple[int, int]],
|
| 245 |
+
start_scores: np.ndarray,
|
| 246 |
+
end_scores: np.ndarray,
|
| 247 |
+
label_names: list[str],
|
| 248 |
+
default_threshold: float,
|
| 249 |
+
label_thresholds: dict[str, float] | None = None,
|
| 250 |
+
label_max_span_tokens: dict[str, int] | None = None,
|
| 251 |
+
) -> list[dict]:
|
| 252 |
+
thresholds = {label: float(default_threshold) for label in label_names}
|
| 253 |
+
if label_thresholds:
|
| 254 |
+
thresholds.update({normalize_entity_name(key): float(value) for key, value in label_thresholds.items()})
|
| 255 |
+
max_tokens = dict(DEFAULT_LABEL_MAX_SPAN_TOKENS)
|
| 256 |
+
if label_max_span_tokens:
|
| 257 |
+
max_tokens.update({normalize_entity_name(key): int(value) for key, value in label_max_span_tokens.items()})
|
| 258 |
+
|
| 259 |
+
spans: list[dict] = []
|
| 260 |
+
for label_index, label in enumerate(label_names):
|
| 261 |
+
threshold = thresholds.get(label, float(default_threshold))
|
| 262 |
+
max_span = max_tokens.get(label, 8)
|
| 263 |
+
start_candidates = [idx for idx in range(len(offsets)) if _valid_offset(offsets[idx]) and float(start_scores[idx, label_index]) >= threshold]
|
| 264 |
+
for start_idx in start_candidates:
|
| 265 |
+
best = None
|
| 266 |
+
for end_idx in range(start_idx, min(len(offsets), start_idx + max_span)):
|
| 267 |
+
if not _valid_offset(offsets[end_idx]):
|
| 268 |
+
continue
|
| 269 |
+
end_score = float(end_scores[end_idx, label_index])
|
| 270 |
+
if end_score < threshold:
|
| 271 |
+
continue
|
| 272 |
+
score = min(float(start_scores[start_idx, label_index]), end_score)
|
| 273 |
+
if best is None or score > best["score"]:
|
| 274 |
+
best = {
|
| 275 |
+
"label": label,
|
| 276 |
+
"start": int(offsets[start_idx][0]),
|
| 277 |
+
"end": int(offsets[end_idx][1]),
|
| 278 |
+
"score": score,
|
| 279 |
+
}
|
| 280 |
+
if best is not None and best["start"] < best["end"]:
|
| 281 |
+
best["text"] = text[best["start"]:best["end"]]
|
| 282 |
+
spans.append(best)
|
| 283 |
+
return dedupe_spans(spans)
|
| 284 |
+
|
| 285 |
+
|
| 286 |
+
def decode_token_presence_segments(
|
| 287 |
+
text: str,
|
| 288 |
+
offsets: list[tuple[int, int]],
|
| 289 |
+
token_scores: np.ndarray,
|
| 290 |
+
label_names: list[str],
|
| 291 |
+
default_threshold: float,
|
| 292 |
+
label_thresholds: dict[str, float] | None = None,
|
| 293 |
+
label_extend_thresholds: dict[str, float] | None = None,
|
| 294 |
+
label_max_span_tokens: dict[str, int] | None = None,
|
| 295 |
+
label_min_nonspace_chars: dict[str, int] | None = None,
|
| 296 |
+
boundary_label_thresholds: dict[str, float] | None = None,
|
| 297 |
+
start_scores: np.ndarray | None = None,
|
| 298 |
+
end_scores: np.ndarray | None = None,
|
| 299 |
+
) -> list[dict]:
|
| 300 |
+
thresholds = {label: float(default_threshold) for label in label_names}
|
| 301 |
+
if label_thresholds:
|
| 302 |
+
thresholds.update({normalize_entity_name(key): float(value) for key, value in label_thresholds.items()})
|
| 303 |
+
extend_thresholds = {label: max(0.0, min(1.0, thresholds[label] * 0.6)) for label in label_names}
|
| 304 |
+
if label_extend_thresholds:
|
| 305 |
+
extend_thresholds.update({normalize_entity_name(key): float(value) for key, value in label_extend_thresholds.items()})
|
| 306 |
+
max_tokens = dict(DEFAULT_LABEL_MAX_SPAN_TOKENS)
|
| 307 |
+
if label_max_span_tokens:
|
| 308 |
+
max_tokens.update({normalize_entity_name(key): int(value) for key, value in label_max_span_tokens.items()})
|
| 309 |
+
min_nonspace_chars = dict(DEFAULT_LABEL_MIN_NONSPACE_CHARS)
|
| 310 |
+
if label_min_nonspace_chars:
|
| 311 |
+
min_nonspace_chars.update({normalize_entity_name(key): int(value) for key, value in label_min_nonspace_chars.items()})
|
| 312 |
+
boundary_thresholds = {label: 0.0 for label in label_names}
|
| 313 |
+
if boundary_label_thresholds:
|
| 314 |
+
boundary_thresholds.update({normalize_entity_name(key): float(value) for key, value in boundary_label_thresholds.items()})
|
| 315 |
+
|
| 316 |
+
spans: list[dict] = []
|
| 317 |
+
valid = [_valid_offset(offset) for offset in offsets]
|
| 318 |
+
num_tokens = len(offsets)
|
| 319 |
+
for label_index, label in enumerate(label_names):
|
| 320 |
+
threshold = thresholds.get(label, float(default_threshold))
|
| 321 |
+
extend_threshold = min(threshold, extend_thresholds.get(label, threshold))
|
| 322 |
+
max_span = max_tokens.get(label, 8)
|
| 323 |
+
idx = 0
|
| 324 |
+
while idx < num_tokens:
|
| 325 |
+
if not valid[idx] or float(token_scores[idx, label_index]) < threshold:
|
| 326 |
+
idx += 1
|
| 327 |
+
continue
|
| 328 |
+
start_idx = idx
|
| 329 |
+
end_idx = idx
|
| 330 |
+
while end_idx + 1 < num_tokens and valid[end_idx + 1] and float(token_scores[end_idx + 1, label_index]) >= threshold and (end_idx + 1 - start_idx + 1) <= max_span:
|
| 331 |
+
end_idx += 1
|
| 332 |
+
while (
|
| 333 |
+
start_idx - 1 >= 0
|
| 334 |
+
and valid[start_idx - 1]
|
| 335 |
+
and _has_left_extension_bridge(text, offsets[start_idx - 1], offsets[start_idx])
|
| 336 |
+
and float(token_scores[start_idx - 1, label_index]) >= extend_threshold
|
| 337 |
+
and (end_idx - (start_idx - 1) + 1) <= max_span
|
| 338 |
+
):
|
| 339 |
+
start_idx -= 1
|
| 340 |
+
while (
|
| 341 |
+
end_idx + 1 < num_tokens
|
| 342 |
+
and valid[end_idx + 1]
|
| 343 |
+
and _has_skippable_bridge(text, offsets[end_idx], offsets[end_idx + 1], label)
|
| 344 |
+
and float(token_scores[end_idx + 1, label_index]) >= extend_threshold
|
| 345 |
+
and ((end_idx + 1) - start_idx + 1) <= max_span
|
| 346 |
+
):
|
| 347 |
+
end_idx += 1
|
| 348 |
+
presence_slice = token_scores[start_idx : end_idx + 1, label_index]
|
| 349 |
+
score = float(presence_slice.mean())
|
| 350 |
+
out_start_idx = start_idx
|
| 351 |
+
out_end_idx = end_idx
|
| 352 |
+
if start_scores is not None and end_scores is not None:
|
| 353 |
+
refine_window = min(3, end_idx - start_idx + 1)
|
| 354 |
+
start_window = start_scores[start_idx : start_idx + refine_window, label_index]
|
| 355 |
+
best_start_rel = int(np.argmax(start_window))
|
| 356 |
+
best_start_idx = start_idx + best_start_rel
|
| 357 |
+
end_window_start = max(best_start_idx, end_idx - refine_window + 1)
|
| 358 |
+
end_window = end_scores[end_window_start : end_idx + 1, label_index]
|
| 359 |
+
best_end_rel = int(np.argmax(end_window))
|
| 360 |
+
best_end_idx = end_window_start + best_end_rel
|
| 361 |
+
if (
|
| 362 |
+
float(start_scores[best_start_idx, label_index]) < boundary_thresholds.get(label, 0.0)
|
| 363 |
+
or float(end_scores[best_end_idx, label_index]) < boundary_thresholds.get(label, 0.0)
|
| 364 |
+
):
|
| 365 |
+
idx = end_idx + 1
|
| 366 |
+
continue
|
| 367 |
+
out_start_idx = best_start_idx
|
| 368 |
+
out_end_idx = best_end_idx
|
| 369 |
+
if label in CONSERVATIVE_BOUNDARY_REFINEMENT_LABELS and (
|
| 370 |
+
best_start_idx != start_idx or best_end_idx != end_idx
|
| 371 |
+
):
|
| 372 |
+
outer_boundary = min(float(start_scores[start_idx, label_index]), float(end_scores[end_idx, label_index]))
|
| 373 |
+
refined_boundary = min(
|
| 374 |
+
float(start_scores[best_start_idx, label_index]),
|
| 375 |
+
float(end_scores[best_end_idx, label_index]),
|
| 376 |
+
)
|
| 377 |
+
if refined_boundary < outer_boundary + 0.08:
|
| 378 |
+
out_start_idx = start_idx
|
| 379 |
+
out_end_idx = end_idx
|
| 380 |
+
score = (
|
| 381 |
+
0.65 * score
|
| 382 |
+
+ 0.175 * float(start_scores[out_start_idx, label_index])
|
| 383 |
+
+ 0.175 * float(end_scores[out_end_idx, label_index])
|
| 384 |
+
)
|
| 385 |
+
min_chars = int(min_nonspace_chars.get(label, 1))
|
| 386 |
+
if _nonspace_length(text, offsets[out_start_idx][0], offsets[out_end_idx][1]) < min_chars:
|
| 387 |
+
idx = end_idx + 1
|
| 388 |
+
continue
|
| 389 |
+
spans.append(
|
| 390 |
+
{
|
| 391 |
+
"label": label,
|
| 392 |
+
"start": int(offsets[out_start_idx][0]),
|
| 393 |
+
"end": int(offsets[out_end_idx][1]),
|
| 394 |
+
"score": score,
|
| 395 |
+
"text": text[int(offsets[out_start_idx][0]) : int(offsets[out_end_idx][1])],
|
| 396 |
+
}
|
| 397 |
+
)
|
| 398 |
+
idx = end_idx + 1
|
| 399 |
+
return dedupe_spans(spans)
|
| 400 |
+
|
| 401 |
+
|
| 402 |
+
def load_onnx_session(model_ref: str, onnx_file: str = "model_quantized.onnx", onnx_subfolder: str = "onnx"):
|
| 403 |
+
import onnxruntime as ort
|
| 404 |
+
|
| 405 |
+
model_path = Path(model_ref)
|
| 406 |
+
if model_path.exists():
|
| 407 |
+
candidates = []
|
| 408 |
+
if onnx_subfolder:
|
| 409 |
+
candidates.append(model_path / onnx_subfolder / onnx_file)
|
| 410 |
+
candidates.append(model_path / onnx_file)
|
| 411 |
+
onnx_path = next((path for path in candidates if path.exists()), candidates[0])
|
| 412 |
+
config = AutoConfig.from_pretrained(model_ref)
|
| 413 |
+
tokenizer = safe_auto_tokenizer(model_ref)
|
| 414 |
+
else:
|
| 415 |
+
remote_name = f"{onnx_subfolder}/{onnx_file}" if onnx_subfolder else onnx_file
|
| 416 |
+
onnx_path = Path(hf_hub_download(repo_id=model_ref, filename=remote_name, repo_type="model"))
|
| 417 |
+
config = AutoConfig.from_pretrained(model_ref)
|
| 418 |
+
tokenizer = safe_auto_tokenizer(model_ref)
|
| 419 |
+
session = ort.InferenceSession(str(onnx_path), providers=["CPUExecutionProvider"])
|
| 420 |
+
return session, tokenizer, config
|
| 421 |
+
|
| 422 |
+
|
| 423 |
+
def run_onnx(session, encoded: dict[str, Any]) -> tuple[np.ndarray, np.ndarray]:
|
| 424 |
+
feed = {}
|
| 425 |
+
input_names = {item.name for item in session.get_inputs()}
|
| 426 |
+
for key, value in encoded.items():
|
| 427 |
+
if key == "offset_mapping":
|
| 428 |
+
continue
|
| 429 |
+
if key in input_names:
|
| 430 |
+
feed[key] = value
|
| 431 |
+
outputs = session.run(None, feed)
|
| 432 |
+
return outputs[0], outputs[1]
|
| 433 |
+
|
| 434 |
+
|
| 435 |
+
def run_onnx_all(session, encoded: dict[str, Any]) -> list[np.ndarray]:
|
| 436 |
+
feed = {}
|
| 437 |
+
input_names = {item.name for item in session.get_inputs()}
|
| 438 |
+
for key, value in encoded.items():
|
| 439 |
+
if key == "offset_mapping":
|
| 440 |
+
continue
|
| 441 |
+
if key in input_names:
|
| 442 |
+
feed[key] = value
|
| 443 |
+
return session.run(None, feed)
|
config.json
ADDED
|
@@ -0,0 +1,353 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"activation": "gelu",
|
| 3 |
+
"architectures": [
|
| 4 |
+
"IrishCoreTokenSpanModel"
|
| 5 |
+
],
|
| 6 |
+
"attention_dropout": 0.1,
|
| 7 |
+
"boundary_loss_weight": 1.0,
|
| 8 |
+
"dim": 768,
|
| 9 |
+
"dropout": 0.1,
|
| 10 |
+
"dtype": "float32",
|
| 11 |
+
"hidden_dim": 3072,
|
| 12 |
+
"id2label": {
|
| 13 |
+
"0": "O",
|
| 14 |
+
"1": "B-account_number",
|
| 15 |
+
"2": "B-age",
|
| 16 |
+
"3": "B-api_key",
|
| 17 |
+
"4": "B-bank_routing_number",
|
| 18 |
+
"5": "B-biometric_identifier",
|
| 19 |
+
"6": "B-blood_type",
|
| 20 |
+
"7": "B-certificate_license_number",
|
| 21 |
+
"8": "B-city",
|
| 22 |
+
"9": "B-company_name",
|
| 23 |
+
"10": "B-coordinate",
|
| 24 |
+
"11": "B-country",
|
| 25 |
+
"12": "B-county",
|
| 26 |
+
"13": "B-credit_debit_card",
|
| 27 |
+
"14": "B-customer_id",
|
| 28 |
+
"15": "B-cvv",
|
| 29 |
+
"16": "B-date",
|
| 30 |
+
"17": "B-date_of_birth",
|
| 31 |
+
"18": "B-date_time",
|
| 32 |
+
"19": "B-device_identifier",
|
| 33 |
+
"20": "B-education_level",
|
| 34 |
+
"21": "B-email",
|
| 35 |
+
"22": "B-employee_id",
|
| 36 |
+
"23": "B-employment_status",
|
| 37 |
+
"24": "B-fax_number",
|
| 38 |
+
"25": "B-first_name",
|
| 39 |
+
"26": "B-gender",
|
| 40 |
+
"27": "B-health_plan_beneficiary_number",
|
| 41 |
+
"28": "B-http_cookie",
|
| 42 |
+
"29": "B-ipv4",
|
| 43 |
+
"30": "B-ipv6",
|
| 44 |
+
"31": "B-language",
|
| 45 |
+
"32": "B-last_name",
|
| 46 |
+
"33": "B-license_plate",
|
| 47 |
+
"34": "B-mac_address",
|
| 48 |
+
"35": "B-medical_record_number",
|
| 49 |
+
"36": "B-occupation",
|
| 50 |
+
"37": "B-password",
|
| 51 |
+
"38": "B-phone_number",
|
| 52 |
+
"39": "B-pin",
|
| 53 |
+
"40": "B-political_view",
|
| 54 |
+
"41": "B-postcode",
|
| 55 |
+
"42": "B-race_ethnicity",
|
| 56 |
+
"43": "B-religious_belief",
|
| 57 |
+
"44": "B-sexuality",
|
| 58 |
+
"45": "B-ssn",
|
| 59 |
+
"46": "B-state",
|
| 60 |
+
"47": "B-street_address",
|
| 61 |
+
"48": "B-swift_bic",
|
| 62 |
+
"49": "B-tax_id",
|
| 63 |
+
"50": "B-time",
|
| 64 |
+
"51": "B-unique_id",
|
| 65 |
+
"52": "B-url",
|
| 66 |
+
"53": "B-user_name",
|
| 67 |
+
"54": "B-vehicle_identifier",
|
| 68 |
+
"55": "I-account_number",
|
| 69 |
+
"56": "I-api_key",
|
| 70 |
+
"57": "I-biometric_identifier",
|
| 71 |
+
"58": "I-blood_type",
|
| 72 |
+
"59": "I-certificate_license_number",
|
| 73 |
+
"60": "I-city",
|
| 74 |
+
"61": "I-company_name",
|
| 75 |
+
"62": "I-coordinate",
|
| 76 |
+
"63": "I-country",
|
| 77 |
+
"64": "I-county",
|
| 78 |
+
"65": "I-credit_debit_card",
|
| 79 |
+
"66": "I-customer_id",
|
| 80 |
+
"67": "I-date",
|
| 81 |
+
"68": "I-date_of_birth",
|
| 82 |
+
"69": "I-date_time",
|
| 83 |
+
"70": "I-device_identifier",
|
| 84 |
+
"71": "I-education_level",
|
| 85 |
+
"72": "I-email",
|
| 86 |
+
"73": "I-employee_id",
|
| 87 |
+
"74": "I-employment_status",
|
| 88 |
+
"75": "I-fax_number",
|
| 89 |
+
"76": "I-first_name",
|
| 90 |
+
"77": "I-gender",
|
| 91 |
+
"78": "I-health_plan_beneficiary_number",
|
| 92 |
+
"79": "I-http_cookie",
|
| 93 |
+
"80": "I-ipv4",
|
| 94 |
+
"81": "I-ipv6",
|
| 95 |
+
"82": "I-language",
|
| 96 |
+
"83": "I-last_name",
|
| 97 |
+
"84": "I-license_plate",
|
| 98 |
+
"85": "I-mac_address",
|
| 99 |
+
"86": "I-medical_record_number",
|
| 100 |
+
"87": "I-occupation",
|
| 101 |
+
"88": "I-password",
|
| 102 |
+
"89": "I-phone_number",
|
| 103 |
+
"90": "I-pin",
|
| 104 |
+
"91": "I-political_view",
|
| 105 |
+
"92": "I-postcode",
|
| 106 |
+
"93": "I-race_ethnicity",
|
| 107 |
+
"94": "I-religious_belief",
|
| 108 |
+
"95": "I-sexuality",
|
| 109 |
+
"96": "I-ssn",
|
| 110 |
+
"97": "I-state",
|
| 111 |
+
"98": "I-street_address",
|
| 112 |
+
"99": "I-swift_bic",
|
| 113 |
+
"100": "I-tax_id",
|
| 114 |
+
"101": "I-time",
|
| 115 |
+
"102": "I-unique_id",
|
| 116 |
+
"103": "I-url",
|
| 117 |
+
"104": "I-user_name",
|
| 118 |
+
"105": "I-vehicle_identifier",
|
| 119 |
+
"106": "B-PPSN",
|
| 120 |
+
"107": "I-PPSN",
|
| 121 |
+
"108": "B-PASSPORT_NUMBER",
|
| 122 |
+
"109": "I-PASSPORT_NUMBER",
|
| 123 |
+
"110": "I-bank_routing_number"
|
| 124 |
+
},
|
| 125 |
+
"initializer_range": 0.02,
|
| 126 |
+
"label2id": {
|
| 127 |
+
"B-PASSPORT_NUMBER": 108,
|
| 128 |
+
"B-PPSN": 106,
|
| 129 |
+
"B-account_number": 1,
|
| 130 |
+
"B-age": 2,
|
| 131 |
+
"B-api_key": 3,
|
| 132 |
+
"B-bank_routing_number": 4,
|
| 133 |
+
"B-biometric_identifier": 5,
|
| 134 |
+
"B-blood_type": 6,
|
| 135 |
+
"B-certificate_license_number": 7,
|
| 136 |
+
"B-city": 8,
|
| 137 |
+
"B-company_name": 9,
|
| 138 |
+
"B-coordinate": 10,
|
| 139 |
+
"B-country": 11,
|
| 140 |
+
"B-county": 12,
|
| 141 |
+
"B-credit_debit_card": 13,
|
| 142 |
+
"B-customer_id": 14,
|
| 143 |
+
"B-cvv": 15,
|
| 144 |
+
"B-date": 16,
|
| 145 |
+
"B-date_of_birth": 17,
|
| 146 |
+
"B-date_time": 18,
|
| 147 |
+
"B-device_identifier": 19,
|
| 148 |
+
"B-education_level": 20,
|
| 149 |
+
"B-email": 21,
|
| 150 |
+
"B-employee_id": 22,
|
| 151 |
+
"B-employment_status": 23,
|
| 152 |
+
"B-fax_number": 24,
|
| 153 |
+
"B-first_name": 25,
|
| 154 |
+
"B-gender": 26,
|
| 155 |
+
"B-health_plan_beneficiary_number": 27,
|
| 156 |
+
"B-http_cookie": 28,
|
| 157 |
+
"B-ipv4": 29,
|
| 158 |
+
"B-ipv6": 30,
|
| 159 |
+
"B-language": 31,
|
| 160 |
+
"B-last_name": 32,
|
| 161 |
+
"B-license_plate": 33,
|
| 162 |
+
"B-mac_address": 34,
|
| 163 |
+
"B-medical_record_number": 35,
|
| 164 |
+
"B-occupation": 36,
|
| 165 |
+
"B-password": 37,
|
| 166 |
+
"B-phone_number": 38,
|
| 167 |
+
"B-pin": 39,
|
| 168 |
+
"B-political_view": 40,
|
| 169 |
+
"B-postcode": 41,
|
| 170 |
+
"B-race_ethnicity": 42,
|
| 171 |
+
"B-religious_belief": 43,
|
| 172 |
+
"B-sexuality": 44,
|
| 173 |
+
"B-ssn": 45,
|
| 174 |
+
"B-state": 46,
|
| 175 |
+
"B-street_address": 47,
|
| 176 |
+
"B-swift_bic": 48,
|
| 177 |
+
"B-tax_id": 49,
|
| 178 |
+
"B-time": 50,
|
| 179 |
+
"B-unique_id": 51,
|
| 180 |
+
"B-url": 52,
|
| 181 |
+
"B-user_name": 53,
|
| 182 |
+
"B-vehicle_identifier": 54,
|
| 183 |
+
"I-PASSPORT_NUMBER": 109,
|
| 184 |
+
"I-PPSN": 107,
|
| 185 |
+
"I-account_number": 55,
|
| 186 |
+
"I-api_key": 56,
|
| 187 |
+
"I-bank_routing_number": 110,
|
| 188 |
+
"I-biometric_identifier": 57,
|
| 189 |
+
"I-blood_type": 58,
|
| 190 |
+
"I-certificate_license_number": 59,
|
| 191 |
+
"I-city": 60,
|
| 192 |
+
"I-company_name": 61,
|
| 193 |
+
"I-coordinate": 62,
|
| 194 |
+
"I-country": 63,
|
| 195 |
+
"I-county": 64,
|
| 196 |
+
"I-credit_debit_card": 65,
|
| 197 |
+
"I-customer_id": 66,
|
| 198 |
+
"I-date": 67,
|
| 199 |
+
"I-date_of_birth": 68,
|
| 200 |
+
"I-date_time": 69,
|
| 201 |
+
"I-device_identifier": 70,
|
| 202 |
+
"I-education_level": 71,
|
| 203 |
+
"I-email": 72,
|
| 204 |
+
"I-employee_id": 73,
|
| 205 |
+
"I-employment_status": 74,
|
| 206 |
+
"I-fax_number": 75,
|
| 207 |
+
"I-first_name": 76,
|
| 208 |
+
"I-gender": 77,
|
| 209 |
+
"I-health_plan_beneficiary_number": 78,
|
| 210 |
+
"I-http_cookie": 79,
|
| 211 |
+
"I-ipv4": 80,
|
| 212 |
+
"I-ipv6": 81,
|
| 213 |
+
"I-language": 82,
|
| 214 |
+
"I-last_name": 83,
|
| 215 |
+
"I-license_plate": 84,
|
| 216 |
+
"I-mac_address": 85,
|
| 217 |
+
"I-medical_record_number": 86,
|
| 218 |
+
"I-occupation": 87,
|
| 219 |
+
"I-password": 88,
|
| 220 |
+
"I-phone_number": 89,
|
| 221 |
+
"I-pin": 90,
|
| 222 |
+
"I-political_view": 91,
|
| 223 |
+
"I-postcode": 92,
|
| 224 |
+
"I-race_ethnicity": 93,
|
| 225 |
+
"I-religious_belief": 94,
|
| 226 |
+
"I-sexuality": 95,
|
| 227 |
+
"I-ssn": 96,
|
| 228 |
+
"I-state": 97,
|
| 229 |
+
"I-street_address": 98,
|
| 230 |
+
"I-swift_bic": 99,
|
| 231 |
+
"I-tax_id": 100,
|
| 232 |
+
"I-time": 101,
|
| 233 |
+
"I-unique_id": 102,
|
| 234 |
+
"I-url": 103,
|
| 235 |
+
"I-user_name": 104,
|
| 236 |
+
"I-vehicle_identifier": 105,
|
| 237 |
+
"O": 0
|
| 238 |
+
},
|
| 239 |
+
"max_position_embeddings": 512,
|
| 240 |
+
"model_type": "distilbert",
|
| 241 |
+
"n_heads": 12,
|
| 242 |
+
"n_layers": 6,
|
| 243 |
+
"num_span_labels": 11,
|
| 244 |
+
"output_past": true,
|
| 245 |
+
"pad_token_id": 0,
|
| 246 |
+
"qa_dropout": 0.1,
|
| 247 |
+
"seq_classif_dropout": 0.2,
|
| 248 |
+
"sinusoidal_pos_embds": false,
|
| 249 |
+
"span_label_max_span_tokens": {
|
| 250 |
+
"ACCOUNT_NUMBER": 19,
|
| 251 |
+
"BANK_ROUTING_NUMBER": 6,
|
| 252 |
+
"CREDIT_DEBIT_CARD": 13,
|
| 253 |
+
"EMAIL": 16,
|
| 254 |
+
"FIRST_NAME": 5,
|
| 255 |
+
"LAST_NAME": 8,
|
| 256 |
+
"PASSPORT_NUMBER": 9,
|
| 257 |
+
"PHONE_NUMBER": 10,
|
| 258 |
+
"POSTCODE": 8,
|
| 259 |
+
"PPSN": 9,
|
| 260 |
+
"SWIFT_BIC": 8
|
| 261 |
+
},
|
| 262 |
+
"span_label_names": [
|
| 263 |
+
"ACCOUNT_NUMBER",
|
| 264 |
+
"BANK_ROUTING_NUMBER",
|
| 265 |
+
"CREDIT_DEBIT_CARD",
|
| 266 |
+
"EMAIL",
|
| 267 |
+
"FIRST_NAME",
|
| 268 |
+
"LAST_NAME",
|
| 269 |
+
"PASSPORT_NUMBER",
|
| 270 |
+
"PHONE_NUMBER",
|
| 271 |
+
"POSTCODE",
|
| 272 |
+
"PPSN",
|
| 273 |
+
"SWIFT_BIC"
|
| 274 |
+
],
|
| 275 |
+
"span_label_thresholds": {
|
| 276 |
+
"ACCOUNT_NUMBER": 0.5,
|
| 277 |
+
"BANK_ROUTING_NUMBER": 0.5,
|
| 278 |
+
"CREDIT_DEBIT_CARD": 0.5,
|
| 279 |
+
"EMAIL": 0.5,
|
| 280 |
+
"FIRST_NAME": 0.5,
|
| 281 |
+
"LAST_NAME": 0.5,
|
| 282 |
+
"PASSPORT_NUMBER": 0.5,
|
| 283 |
+
"PHONE_NUMBER": 0.5,
|
| 284 |
+
"POSTCODE": 0.5,
|
| 285 |
+
"PPSN": 0.5,
|
| 286 |
+
"SWIFT_BIC": 0.5
|
| 287 |
+
},
|
| 288 |
+
"span_positive_weight": 6.0,
|
| 289 |
+
"tie_weights_": true,
|
| 290 |
+
"token_extend_thresholds": {
|
| 291 |
+
"ACCOUNT_NUMBER": 0.08,
|
| 292 |
+
"BANK_ROUTING_NUMBER": 0.3,
|
| 293 |
+
"CREDIT_DEBIT_CARD": 0.3,
|
| 294 |
+
"EMAIL": 0.3,
|
| 295 |
+
"FIRST_NAME": 0.3,
|
| 296 |
+
"LAST_NAME": 0.3,
|
| 297 |
+
"PASSPORT_NUMBER": 0.3,
|
| 298 |
+
"PHONE_NUMBER": 0.15,
|
| 299 |
+
"POSTCODE": 0.3,
|
| 300 |
+
"PPSN": 0.3,
|
| 301 |
+
"SWIFT_BIC": 0.3
|
| 302 |
+
},
|
| 303 |
+
"token_label_thresholds": {
|
| 304 |
+
"ACCOUNT_NUMBER": 0.18,
|
| 305 |
+
"BANK_ROUTING_NUMBER": 0.8,
|
| 306 |
+
"CREDIT_DEBIT_CARD": 0.8,
|
| 307 |
+
"EMAIL": 0.95,
|
| 308 |
+
"FIRST_NAME": 0.3,
|
| 309 |
+
"LAST_NAME": 0.4,
|
| 310 |
+
"PASSPORT_NUMBER": 0.8,
|
| 311 |
+
"PHONE_NUMBER": 0.65,
|
| 312 |
+
"POSTCODE": 0.9,
|
| 313 |
+
"PPSN": 0.7,
|
| 314 |
+
"SWIFT_BIC": 0.8
|
| 315 |
+
},
|
| 316 |
+
"token_positive_weight": 4.0,
|
| 317 |
+
"token_presence_weight": 1.0,
|
| 318 |
+
"transformers_version": "4.57.6",
|
| 319 |
+
"vocab_size": 119547,
|
| 320 |
+
"boundary_label_thresholds": {
|
| 321 |
+
"ACCOUNT_NUMBER": 0.1,
|
| 322 |
+
"BANK_ROUTING_NUMBER": 0.25,
|
| 323 |
+
"CREDIT_DEBIT_CARD": 0.25,
|
| 324 |
+
"EMAIL": 0.2,
|
| 325 |
+
"FIRST_NAME": 0.1,
|
| 326 |
+
"LAST_NAME": 0.1,
|
| 327 |
+
"PASSPORT_NUMBER": 0.25,
|
| 328 |
+
"PHONE_NUMBER": 0.25,
|
| 329 |
+
"POSTCODE": 0.4,
|
| 330 |
+
"PPSN": 0.35,
|
| 331 |
+
"SWIFT_BIC": 0.25
|
| 332 |
+
},
|
| 333 |
+
"span_label_min_nonspace_chars": {
|
| 334 |
+
"PPSN": 8,
|
| 335 |
+
"POSTCODE": 6,
|
| 336 |
+
"PHONE_NUMBER": 7,
|
| 337 |
+
"PASSPORT_NUMBER": 7,
|
| 338 |
+
"BANK_ROUTING_NUMBER": 6,
|
| 339 |
+
"ACCOUNT_NUMBER": 6,
|
| 340 |
+
"CREDIT_DEBIT_CARD": 12,
|
| 341 |
+
"SWIFT_BIC": 8,
|
| 342 |
+
"EMAIL": 6,
|
| 343 |
+
"FIRST_NAME": 2,
|
| 344 |
+
"LAST_NAME": 2
|
| 345 |
+
},
|
| 346 |
+
"raw_decoder": {
|
| 347 |
+
"name": "openmed_irish_core_token_span_v1",
|
| 348 |
+
"scanner_free": true,
|
| 349 |
+
"validator_free": true,
|
| 350 |
+
"default_min_score": 0.5,
|
| 351 |
+
"full_and_onnx_share_decoder": true
|
| 352 |
+
}
|
| 353 |
+
}
|
eval/benchmark_manual_suite_multilabel_base_irish_core_pii_v1.json
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model": "OpenMed/OpenMed-PII-mLiteClinical-Base-135M-v1",
|
| 3 |
+
"input": "eval/irish_core_pii_v1.jsonl",
|
| 4 |
+
"loader_type": "standard",
|
| 5 |
+
"device": "cpu",
|
| 6 |
+
"examples": 37,
|
| 7 |
+
"batch_size": 8,
|
| 8 |
+
"min_score": 0.5,
|
| 9 |
+
"ppsn_min_score": 0.5,
|
| 10 |
+
"iou_threshold": 0.5,
|
| 11 |
+
"ppsn_decoder": "word_aligned",
|
| 12 |
+
"labels_evaluated": [
|
| 13 |
+
"ACCOUNT_NUMBER",
|
| 14 |
+
"BANK_ROUTING_NUMBER",
|
| 15 |
+
"CREDIT_DEBIT_CARD",
|
| 16 |
+
"EMAIL",
|
| 17 |
+
"FIRST_NAME",
|
| 18 |
+
"LAST_NAME",
|
| 19 |
+
"PASSPORT_NUMBER",
|
| 20 |
+
"PHONE_NUMBER",
|
| 21 |
+
"POSTCODE",
|
| 22 |
+
"PPSN",
|
| 23 |
+
"SWIFT_BIC"
|
| 24 |
+
],
|
| 25 |
+
"elapsed_seconds": 2.4372421499574557,
|
| 26 |
+
"examples_per_second": 15.181093105847472,
|
| 27 |
+
"overall": {
|
| 28 |
+
"precision": 0.3153153153153153,
|
| 29 |
+
"recall": 0.4605263157894737,
|
| 30 |
+
"f1": 0.37433155080213903,
|
| 31 |
+
"tp": 35,
|
| 32 |
+
"fp": 76,
|
| 33 |
+
"fn": 41
|
| 34 |
+
},
|
| 35 |
+
"by_label": {
|
| 36 |
+
"ACCOUNT_NUMBER": {
|
| 37 |
+
"precision": 0.3333333333333333,
|
| 38 |
+
"recall": 0.3333333333333333,
|
| 39 |
+
"f1": 0.3333333333333333,
|
| 40 |
+
"tp": 1,
|
| 41 |
+
"fp": 2,
|
| 42 |
+
"fn": 2
|
| 43 |
+
},
|
| 44 |
+
"BANK_ROUTING_NUMBER": {
|
| 45 |
+
"precision": 0.0,
|
| 46 |
+
"recall": 0.0,
|
| 47 |
+
"f1": 0.0,
|
| 48 |
+
"tp": 0,
|
| 49 |
+
"fp": 0,
|
| 50 |
+
"fn": 1
|
| 51 |
+
},
|
| 52 |
+
"BIOMETRIC_IDENTIFIER": {
|
| 53 |
+
"precision": 0.0,
|
| 54 |
+
"recall": 0.0,
|
| 55 |
+
"f1": 0.0,
|
| 56 |
+
"tp": 0,
|
| 57 |
+
"fp": 3,
|
| 58 |
+
"fn": 0
|
| 59 |
+
},
|
| 60 |
+
"CERTIFICATE_LICENSE_NUMBER": {
|
| 61 |
+
"precision": 0.0,
|
| 62 |
+
"recall": 0.0,
|
| 63 |
+
"f1": 0.0,
|
| 64 |
+
"tp": 0,
|
| 65 |
+
"fp": 1,
|
| 66 |
+
"fn": 0
|
| 67 |
+
},
|
| 68 |
+
"COORDINATE": {
|
| 69 |
+
"precision": 0.0,
|
| 70 |
+
"recall": 0.0,
|
| 71 |
+
"f1": 0.0,
|
| 72 |
+
"tp": 0,
|
| 73 |
+
"fp": 1,
|
| 74 |
+
"fn": 0
|
| 75 |
+
},
|
| 76 |
+
"CREDIT_DEBIT_CARD": {
|
| 77 |
+
"precision": 0.09090909090909091,
|
| 78 |
+
"recall": 0.5,
|
| 79 |
+
"f1": 0.15384615384615385,
|
| 80 |
+
"tp": 1,
|
| 81 |
+
"fp": 10,
|
| 82 |
+
"fn": 1
|
| 83 |
+
},
|
| 84 |
+
"DATE": {
|
| 85 |
+
"precision": 0.0,
|
| 86 |
+
"recall": 0.0,
|
| 87 |
+
"f1": 0.0,
|
| 88 |
+
"tp": 0,
|
| 89 |
+
"fp": 2,
|
| 90 |
+
"fn": 0
|
| 91 |
+
},
|
| 92 |
+
"EMAIL": {
|
| 93 |
+
"precision": 0.5454545454545454,
|
| 94 |
+
"recall": 1.0,
|
| 95 |
+
"f1": 0.7058823529411764,
|
| 96 |
+
"tp": 6,
|
| 97 |
+
"fp": 5,
|
| 98 |
+
"fn": 0
|
| 99 |
+
},
|
| 100 |
+
"EMPLOYEE_ID": {
|
| 101 |
+
"precision": 0.0,
|
| 102 |
+
"recall": 0.0,
|
| 103 |
+
"f1": 0.0,
|
| 104 |
+
"tp": 0,
|
| 105 |
+
"fp": 1,
|
| 106 |
+
"fn": 0
|
| 107 |
+
},
|
| 108 |
+
"FIRST_NAME": {
|
| 109 |
+
"precision": 0.3902439024390244,
|
| 110 |
+
"recall": 0.8421052631578947,
|
| 111 |
+
"f1": 0.5333333333333333,
|
| 112 |
+
"tp": 16,
|
| 113 |
+
"fp": 25,
|
| 114 |
+
"fn": 3
|
| 115 |
+
},
|
| 116 |
+
"HEALTH_PLAN_BENEFICIARY_NUMBER": {
|
| 117 |
+
"precision": 0.0,
|
| 118 |
+
"recall": 0.0,
|
| 119 |
+
"f1": 0.0,
|
| 120 |
+
"tp": 0,
|
| 121 |
+
"fp": 1,
|
| 122 |
+
"fn": 0
|
| 123 |
+
},
|
| 124 |
+
"LAST_NAME": {
|
| 125 |
+
"precision": 0.39285714285714285,
|
| 126 |
+
"recall": 0.5789473684210527,
|
| 127 |
+
"f1": 0.46808510638297873,
|
| 128 |
+
"tp": 11,
|
| 129 |
+
"fp": 17,
|
| 130 |
+
"fn": 8
|
| 131 |
+
},
|
| 132 |
+
"PASSPORT_NUMBER": {
|
| 133 |
+
"precision": 0.0,
|
| 134 |
+
"recall": 0.0,
|
| 135 |
+
"f1": 0.0,
|
| 136 |
+
"tp": 0,
|
| 137 |
+
"fp": 0,
|
| 138 |
+
"fn": 2
|
| 139 |
+
},
|
| 140 |
+
"PHONE_NUMBER": {
|
| 141 |
+
"precision": 0.0,
|
| 142 |
+
"recall": 0.0,
|
| 143 |
+
"f1": 0.0,
|
| 144 |
+
"tp": 0,
|
| 145 |
+
"fp": 1,
|
| 146 |
+
"fn": 12
|
| 147 |
+
},
|
| 148 |
+
"POSTCODE": {
|
| 149 |
+
"precision": 0.0,
|
| 150 |
+
"recall": 0.0,
|
| 151 |
+
"f1": 0.0,
|
| 152 |
+
"tp": 0,
|
| 153 |
+
"fp": 1,
|
| 154 |
+
"fn": 4
|
| 155 |
+
},
|
| 156 |
+
"PPSN": {
|
| 157 |
+
"precision": 0.0,
|
| 158 |
+
"recall": 0.0,
|
| 159 |
+
"f1": 0.0,
|
| 160 |
+
"tp": 0,
|
| 161 |
+
"fp": 0,
|
| 162 |
+
"fn": 6
|
| 163 |
+
},
|
| 164 |
+
"SSN": {
|
| 165 |
+
"precision": 0.0,
|
| 166 |
+
"recall": 0.0,
|
| 167 |
+
"f1": 0.0,
|
| 168 |
+
"tp": 0,
|
| 169 |
+
"fp": 1,
|
| 170 |
+
"fn": 0
|
| 171 |
+
},
|
| 172 |
+
"STREET_ADDRESS": {
|
| 173 |
+
"precision": 0.0,
|
| 174 |
+
"recall": 0.0,
|
| 175 |
+
"f1": 0.0,
|
| 176 |
+
"tp": 0,
|
| 177 |
+
"fp": 3,
|
| 178 |
+
"fn": 0
|
| 179 |
+
},
|
| 180 |
+
"SWIFT_BIC": {
|
| 181 |
+
"precision": 0.0,
|
| 182 |
+
"recall": 0.0,
|
| 183 |
+
"f1": 0.0,
|
| 184 |
+
"tp": 0,
|
| 185 |
+
"fp": 0,
|
| 186 |
+
"fn": 2
|
| 187 |
+
},
|
| 188 |
+
"UNIQUE_ID": {
|
| 189 |
+
"precision": 0.0,
|
| 190 |
+
"recall": 0.0,
|
| 191 |
+
"f1": 0.0,
|
| 192 |
+
"tp": 0,
|
| 193 |
+
"fp": 2,
|
| 194 |
+
"fn": 0
|
| 195 |
+
}
|
| 196 |
+
}
|
| 197 |
+
}
|
eval/benchmark_manual_suite_multilabel_base_irish_ppsn_phone_edge_v1.json
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model": "OpenMed/OpenMed-PII-mLiteClinical-Base-135M-v1",
|
| 3 |
+
"input": "eval/irish_ppsn_phone_edge_v1.jsonl",
|
| 4 |
+
"loader_type": "standard",
|
| 5 |
+
"device": "cpu",
|
| 6 |
+
"examples": 22,
|
| 7 |
+
"batch_size": 8,
|
| 8 |
+
"min_score": 0.5,
|
| 9 |
+
"ppsn_min_score": 0.5,
|
| 10 |
+
"iou_threshold": 0.5,
|
| 11 |
+
"ppsn_decoder": "word_aligned",
|
| 12 |
+
"labels_evaluated": [
|
| 13 |
+
"PHONE_NUMBER",
|
| 14 |
+
"PPSN"
|
| 15 |
+
],
|
| 16 |
+
"elapsed_seconds": 1.2349001580150798,
|
| 17 |
+
"examples_per_second": 17.815205429531858,
|
| 18 |
+
"overall": {
|
| 19 |
+
"precision": 0.058823529411764705,
|
| 20 |
+
"recall": 0.05263157894736842,
|
| 21 |
+
"f1": 0.05555555555555555,
|
| 22 |
+
"tp": 1,
|
| 23 |
+
"fp": 16,
|
| 24 |
+
"fn": 18
|
| 25 |
+
},
|
| 26 |
+
"by_label": {
|
| 27 |
+
"CREDIT_DEBIT_CARD": {
|
| 28 |
+
"precision": 0.0,
|
| 29 |
+
"recall": 0.0,
|
| 30 |
+
"f1": 0.0,
|
| 31 |
+
"tp": 0,
|
| 32 |
+
"fp": 9,
|
| 33 |
+
"fn": 0
|
| 34 |
+
},
|
| 35 |
+
"DATE": {
|
| 36 |
+
"precision": 0.0,
|
| 37 |
+
"recall": 0.0,
|
| 38 |
+
"f1": 0.0,
|
| 39 |
+
"tp": 0,
|
| 40 |
+
"fp": 2,
|
| 41 |
+
"fn": 0
|
| 42 |
+
},
|
| 43 |
+
"PHONE_NUMBER": {
|
| 44 |
+
"precision": 1.0,
|
| 45 |
+
"recall": 0.07692307692307693,
|
| 46 |
+
"f1": 0.14285714285714288,
|
| 47 |
+
"tp": 1,
|
| 48 |
+
"fp": 0,
|
| 49 |
+
"fn": 12
|
| 50 |
+
},
|
| 51 |
+
"PPSN": {
|
| 52 |
+
"precision": 0.0,
|
| 53 |
+
"recall": 0.0,
|
| 54 |
+
"f1": 0.0,
|
| 55 |
+
"tp": 0,
|
| 56 |
+
"fp": 0,
|
| 57 |
+
"fn": 6
|
| 58 |
+
},
|
| 59 |
+
"STREET_ADDRESS": {
|
| 60 |
+
"precision": 0.0,
|
| 61 |
+
"recall": 0.0,
|
| 62 |
+
"f1": 0.0,
|
| 63 |
+
"tp": 0,
|
| 64 |
+
"fp": 2,
|
| 65 |
+
"fn": 0
|
| 66 |
+
},
|
| 67 |
+
"UNIQUE_ID": {
|
| 68 |
+
"precision": 0.0,
|
| 69 |
+
"recall": 0.0,
|
| 70 |
+
"f1": 0.0,
|
| 71 |
+
"tp": 0,
|
| 72 |
+
"fp": 3,
|
| 73 |
+
"fn": 0
|
| 74 |
+
}
|
| 75 |
+
}
|
| 76 |
+
}
|
eval/benchmark_multilingual_ppsn_v1_all_openmed_mliteclinical_base_cpu.json
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model": "OpenMed/OpenMed-PII-mLiteClinical-Base-135M-v1",
|
| 3 |
+
"input": "eval/multilingual_ppsn_v1_all.jsonl",
|
| 4 |
+
"loader_type": "standard",
|
| 5 |
+
"device": "cpu",
|
| 6 |
+
"examples": 168,
|
| 7 |
+
"batch_size": 16,
|
| 8 |
+
"elapsed_seconds": 4.483998584997607,
|
| 9 |
+
"examples_per_second": 37.46655954845482,
|
| 10 |
+
"label_filter": "PPSN",
|
| 11 |
+
"overall": {
|
| 12 |
+
"precision": 0.0,
|
| 13 |
+
"recall": 0.0,
|
| 14 |
+
"f1": 0.0,
|
| 15 |
+
"tp": 0,
|
| 16 |
+
"fp": 0,
|
| 17 |
+
"fn": 84
|
| 18 |
+
},
|
| 19 |
+
"by_domain": {
|
| 20 |
+
"citizen_chat": {
|
| 21 |
+
"precision": 0.0,
|
| 22 |
+
"recall": 0.0,
|
| 23 |
+
"f1": 0.0,
|
| 24 |
+
"tp": 0,
|
| 25 |
+
"fp": 0,
|
| 26 |
+
"fn": 28
|
| 27 |
+
},
|
| 28 |
+
"gov_data": {
|
| 29 |
+
"precision": 0.0,
|
| 30 |
+
"recall": 0.0,
|
| 31 |
+
"f1": 0.0,
|
| 32 |
+
"tp": 0,
|
| 33 |
+
"fp": 0,
|
| 34 |
+
"fn": 28
|
| 35 |
+
},
|
| 36 |
+
"hse_medical": {
|
| 37 |
+
"precision": 0.0,
|
| 38 |
+
"recall": 0.0,
|
| 39 |
+
"f1": 0.0,
|
| 40 |
+
"tp": 0,
|
| 41 |
+
"fp": 0,
|
| 42 |
+
"fn": 28
|
| 43 |
+
}
|
| 44 |
+
},
|
| 45 |
+
"by_language": {
|
| 46 |
+
"de": {
|
| 47 |
+
"precision": 0.0,
|
| 48 |
+
"recall": 0.0,
|
| 49 |
+
"f1": 0.0,
|
| 50 |
+
"tp": 0,
|
| 51 |
+
"fp": 0,
|
| 52 |
+
"fn": 6
|
| 53 |
+
},
|
| 54 |
+
"en": {
|
| 55 |
+
"precision": 0.0,
|
| 56 |
+
"recall": 0.0,
|
| 57 |
+
"f1": 0.0,
|
| 58 |
+
"tp": 0,
|
| 59 |
+
"fp": 0,
|
| 60 |
+
"fn": 6
|
| 61 |
+
},
|
| 62 |
+
"es": {
|
| 63 |
+
"precision": 0.0,
|
| 64 |
+
"recall": 0.0,
|
| 65 |
+
"f1": 0.0,
|
| 66 |
+
"tp": 0,
|
| 67 |
+
"fp": 0,
|
| 68 |
+
"fn": 6
|
| 69 |
+
},
|
| 70 |
+
"fr": {
|
| 71 |
+
"precision": 0.0,
|
| 72 |
+
"recall": 0.0,
|
| 73 |
+
"f1": 0.0,
|
| 74 |
+
"tp": 0,
|
| 75 |
+
"fp": 0,
|
| 76 |
+
"fn": 6
|
| 77 |
+
},
|
| 78 |
+
"ga": {
|
| 79 |
+
"precision": 0.0,
|
| 80 |
+
"recall": 0.0,
|
| 81 |
+
"f1": 0.0,
|
| 82 |
+
"tp": 0,
|
| 83 |
+
"fp": 0,
|
| 84 |
+
"fn": 6
|
| 85 |
+
},
|
| 86 |
+
"it": {
|
| 87 |
+
"precision": 0.0,
|
| 88 |
+
"recall": 0.0,
|
| 89 |
+
"f1": 0.0,
|
| 90 |
+
"tp": 0,
|
| 91 |
+
"fp": 0,
|
| 92 |
+
"fn": 6
|
| 93 |
+
},
|
| 94 |
+
"ja": {
|
| 95 |
+
"precision": 0.0,
|
| 96 |
+
"recall": 0.0,
|
| 97 |
+
"f1": 0.0,
|
| 98 |
+
"tp": 0,
|
| 99 |
+
"fp": 0,
|
| 100 |
+
"fn": 6
|
| 101 |
+
},
|
| 102 |
+
"nl": {
|
| 103 |
+
"precision": 0.0,
|
| 104 |
+
"recall": 0.0,
|
| 105 |
+
"f1": 0.0,
|
| 106 |
+
"tp": 0,
|
| 107 |
+
"fp": 0,
|
| 108 |
+
"fn": 6
|
| 109 |
+
},
|
| 110 |
+
"pl": {
|
| 111 |
+
"precision": 0.0,
|
| 112 |
+
"recall": 0.0,
|
| 113 |
+
"f1": 0.0,
|
| 114 |
+
"tp": 0,
|
| 115 |
+
"fp": 0,
|
| 116 |
+
"fn": 6
|
| 117 |
+
},
|
| 118 |
+
"pt": {
|
| 119 |
+
"precision": 0.0,
|
| 120 |
+
"recall": 0.0,
|
| 121 |
+
"f1": 0.0,
|
| 122 |
+
"tp": 0,
|
| 123 |
+
"fp": 0,
|
| 124 |
+
"fn": 6
|
| 125 |
+
},
|
| 126 |
+
"ro": {
|
| 127 |
+
"precision": 0.0,
|
| 128 |
+
"recall": 0.0,
|
| 129 |
+
"f1": 0.0,
|
| 130 |
+
"tp": 0,
|
| 131 |
+
"fp": 0,
|
| 132 |
+
"fn": 6
|
| 133 |
+
},
|
| 134 |
+
"ru": {
|
| 135 |
+
"precision": 0.0,
|
| 136 |
+
"recall": 0.0,
|
| 137 |
+
"f1": 0.0,
|
| 138 |
+
"tp": 0,
|
| 139 |
+
"fp": 0,
|
| 140 |
+
"fn": 6
|
| 141 |
+
},
|
| 142 |
+
"uk": {
|
| 143 |
+
"precision": 0.0,
|
| 144 |
+
"recall": 0.0,
|
| 145 |
+
"f1": 0.0,
|
| 146 |
+
"tp": 0,
|
| 147 |
+
"fp": 0,
|
| 148 |
+
"fn": 6
|
| 149 |
+
},
|
| 150 |
+
"zh": {
|
| 151 |
+
"precision": 0.0,
|
| 152 |
+
"recall": 0.0,
|
| 153 |
+
"f1": 0.0,
|
| 154 |
+
"tp": 0,
|
| 155 |
+
"fp": 0,
|
| 156 |
+
"fn": 6
|
| 157 |
+
}
|
| 158 |
+
}
|
| 159 |
+
}
|
eval/benchmark_summary.json
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"release": "OpenMed-mLiteClinical-IrishCorePII-135M-v2-rc8",
|
| 3 |
+
"repo_id": "temsa/OpenMed-mLiteClinical-IrishCorePII-135M-v2-rc8",
|
| 4 |
+
"raw_only": true,
|
| 5 |
+
"scanner_free": true,
|
| 6 |
+
"validator_free": true,
|
| 7 |
+
"base_model": "OpenMed/OpenMed-PII-mLiteClinical-Base-135M-v1",
|
| 8 |
+
"previous_public_release": "temsa/OpenMed-mLiteClinical-IrishCorePII-135M-v2-rc7",
|
| 9 |
+
"full": {
|
| 10 |
+
"min_score": 0.5,
|
| 11 |
+
"irish_core_manual_f1": 0.9736842105263158,
|
| 12 |
+
"irish_edge_f1": 1.0,
|
| 13 |
+
"finance_suite_f1": 1.0,
|
| 14 |
+
"finance_boundary_f1": 1.0,
|
| 15 |
+
"user_raw_ppsn_f1": 1.0,
|
| 16 |
+
"gaelic_weak_ppsn_f1": 1.0,
|
| 17 |
+
"multilingual_ppsn_f1": 0.9176470588235294,
|
| 18 |
+
"core_examples_per_second": 2.2964689405250116,
|
| 19 |
+
"multilingual_examples_per_second": 6.309541168268772
|
| 20 |
+
},
|
| 21 |
+
"onnx_q8": {
|
| 22 |
+
"min_score": 0.5,
|
| 23 |
+
"irish_core_manual_f1": 0.9736842105263158,
|
| 24 |
+
"irish_edge_f1": 1.0,
|
| 25 |
+
"finance_suite_f1": 1.0,
|
| 26 |
+
"finance_boundary_f1": 1.0,
|
| 27 |
+
"user_raw_ppsn_f1": 1.0,
|
| 28 |
+
"gaelic_weak_ppsn_f1": 1.0,
|
| 29 |
+
"multilingual_ppsn_f1": 0.9176470588235294,
|
| 30 |
+
"core_examples_per_second": 46.14201741375802,
|
| 31 |
+
"multilingual_examples_per_second": 99.71655616732895
|
| 32 |
+
},
|
| 33 |
+
"comparison": {
|
| 34 |
+
"base_openmed": {
|
| 35 |
+
"irish_core_manual_f1": 0.37433155080213903,
|
| 36 |
+
"irish_edge_f1": 0.05555555555555555,
|
| 37 |
+
"multilingual_ppsn_f1": 0.0,
|
| 38 |
+
"core_examples_per_second": 15.181093105847472,
|
| 39 |
+
"multilingual_examples_per_second": 37.46655954845482
|
| 40 |
+
},
|
| 41 |
+
"previous_public_release_rc7": {
|
| 42 |
+
"release": "OpenMed-mLiteClinical-IrishCorePII-135M-v2-rc7",
|
| 43 |
+
"based_on_release": "temsa/OpenMed-mLiteClinical-IrishCorePII-135M-v2-rc6",
|
| 44 |
+
"weights_changed": false,
|
| 45 |
+
"artifacts_changed": false,
|
| 46 |
+
"scanner_spec_changed": true,
|
| 47 |
+
"candidate_extraction_regex_free": true,
|
| 48 |
+
"full": {
|
| 49 |
+
"other_min_score": 0.5,
|
| 50 |
+
"ppsn_min_score": 0.55,
|
| 51 |
+
"irish_core_manual_f1": 1.0,
|
| 52 |
+
"finance_suite_f1": 1.0,
|
| 53 |
+
"finance_boundary_f1": 1.0,
|
| 54 |
+
"gaelic_weak_ppsn_f1": 1.0
|
| 55 |
+
},
|
| 56 |
+
"onnx_q8": {
|
| 57 |
+
"other_min_score": 0.5,
|
| 58 |
+
"ppsn_min_score": 0.55,
|
| 59 |
+
"irish_core_manual_f1": 0.9933774834437086,
|
| 60 |
+
"finance_suite_f1": 1.0,
|
| 61 |
+
"finance_boundary_f1": 1.0,
|
| 62 |
+
"gaelic_weak_ppsn_f1": 1.0
|
| 63 |
+
},
|
| 64 |
+
"core_label_breakdown": {
|
| 65 |
+
"full": {
|
| 66 |
+
"PPSN": 1.0,
|
| 67 |
+
"PHONE_NUMBER": 1.0,
|
| 68 |
+
"POSTCODE": 1.0,
|
| 69 |
+
"PASSPORT_NUMBER": 1.0,
|
| 70 |
+
"ACCOUNT_NUMBER": 1.0,
|
| 71 |
+
"BANK_ROUTING_NUMBER": 1.0,
|
| 72 |
+
"EMAIL": 1.0,
|
| 73 |
+
"FIRST_NAME": 1.0,
|
| 74 |
+
"LAST_NAME": 1.0
|
| 75 |
+
},
|
| 76 |
+
"onnx_q8": {
|
| 77 |
+
"PPSN": 1.0,
|
| 78 |
+
"PHONE_NUMBER": 1.0,
|
| 79 |
+
"POSTCODE": 0.8571428571428571,
|
| 80 |
+
"PASSPORT_NUMBER": 1.0,
|
| 81 |
+
"ACCOUNT_NUMBER": 1.0,
|
| 82 |
+
"BANK_ROUTING_NUMBER": 1.0,
|
| 83 |
+
"EMAIL": 1.0,
|
| 84 |
+
"FIRST_NAME": 1.0,
|
| 85 |
+
"LAST_NAME": 1.0
|
| 86 |
+
}
|
| 87 |
+
}
|
| 88 |
+
}
|
| 89 |
+
}
|
| 90 |
+
}
|
eval/benchmark_summary.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Benchmark Summary
|
| 2 |
+
|
| 3 |
+
## Release
|
| 4 |
+
|
| 5 |
+
- Release: `OpenMed-mLiteClinical-IrishCorePII-135M-v2-rc8`
|
| 6 |
+
- Repo: `temsa/OpenMed-mLiteClinical-IrishCorePII-135M-v2-rc8`
|
| 7 |
+
- Raw-only: `true`
|
| 8 |
+
- Scanner free: `true`
|
| 9 |
+
- Validator free: `true`
|
| 10 |
+
- Default `min_score`: `0.5`
|
| 11 |
+
|
| 12 |
+
## Main Comparison
|
| 13 |
+
|
| 14 |
+
| Model | Irish core F1 | Edge F1 | Finance F1 | Finance-boundary F1 | User PPSN F1 | GA weak PPSN F1 | Multilingual PPSN F1 | Core CPU ex/s | Multilingual CPU ex/s |
|
| 15 |
+
|---|---:|---:|---:|---:|---:|---:|---:|---:|---:|
|
| 16 |
+
| Base OpenMed | 0.3743 | 0.0556 | - | - | - | - | 0.0000 | 15.1811 | 37.4666 |
|
| 17 |
+
| Previous public `rc7` full | 1.0000 | - | 1.0000 | 1.0000 | - | 1.0000 | - | 3.5394 | - |
|
| 18 |
+
| Previous public `rc7` ONNX q8 | 0.9934 | - | 1.0000 | 1.0000 | - | 1.0000 | - | 12.1653 | - |
|
| 19 |
+
| `rc8` full | 0.9737 | 1.0000 | 1.0000 | 1.0000 | 1.0000 | 1.0000 | 0.9176 | 2.2965 | 6.3095 |
|
| 20 |
+
| `rc8` ONNX q8 | 0.9737 | 1.0000 | 1.0000 | 1.0000 | 1.0000 | 1.0000 | 0.9176 | 46.1420 | 99.7166 |
|
| 21 |
+
|
| 22 |
+
## Irish Core Breakdown
|
| 23 |
+
|
| 24 |
+
| Label | `rc8` full | `rc8` ONNX q8 |
|
| 25 |
+
|---|---:|---:|
|
| 26 |
+
| PPSN | 1.0000 | 1.0000 |
|
| 27 |
+
| PHONE_NUMBER | 0.9565 | 0.9565 |
|
| 28 |
+
| POSTCODE | 1.0000 | 1.0000 |
|
| 29 |
+
| ACCOUNT_NUMBER | 0.8000 | 0.8000 |
|
| 30 |
+
| PASSPORT_NUMBER | 1.0000 | 1.0000 |
|
| 31 |
+
| EMAIL | 1.0000 | 1.0000 |
|
| 32 |
+
| FIRST_NAME | 0.9744 | 0.9744 |
|
| 33 |
+
| LAST_NAME | 0.9744 | 0.9744 |
|
| 34 |
+
|
| 35 |
+
## Reading The Numbers
|
| 36 |
+
|
| 37 |
+
- `rc8` is the first public raw-only release in this line: no scanner, no regex extraction, no checksum validator layer.
|
| 38 |
+
- `rc7` is still stronger on the broad manual Irish core suite because it uses a bundled scanner/validator inference stack.
|
| 39 |
+
- `rc8` is simpler to embed and its ONNX q8 artifact stays very close to the full checkpoint on the release-gating suites.
|
| 40 |
+
- For CPU use, the ONNX q8 artifact is the default recommendation.
|
eval/rc8h_cal3_core_t050_cpu.json
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model": "models/openmed-mliteclinical-irish-core-multitask-rc8h_cal3",
|
| 3 |
+
"input": "eval/irish_core_pii_v1.jsonl",
|
| 4 |
+
"loader_type": "token_span_pt",
|
| 5 |
+
"examples": 37,
|
| 6 |
+
"min_score": 0.5,
|
| 7 |
+
"iou_threshold": 0.5,
|
| 8 |
+
"elapsed_seconds": 16.111691887956113,
|
| 9 |
+
"examples_per_second": 2.2964689405250116,
|
| 10 |
+
"overall": {
|
| 11 |
+
"precision": 0.9736842105263158,
|
| 12 |
+
"recall": 0.9736842105263158,
|
| 13 |
+
"f1": 0.9736842105263158,
|
| 14 |
+
"tp": 74,
|
| 15 |
+
"fp": 2,
|
| 16 |
+
"fn": 2
|
| 17 |
+
},
|
| 18 |
+
"by_label": {
|
| 19 |
+
"ACCOUNT_NUMBER": {
|
| 20 |
+
"precision": 1.0,
|
| 21 |
+
"recall": 0.6666666666666666,
|
| 22 |
+
"f1": 0.8,
|
| 23 |
+
"tp": 2,
|
| 24 |
+
"fp": 0,
|
| 25 |
+
"fn": 1
|
| 26 |
+
},
|
| 27 |
+
"BANK_ROUTING_NUMBER": {
|
| 28 |
+
"precision": 1.0,
|
| 29 |
+
"recall": 1.0,
|
| 30 |
+
"f1": 1.0,
|
| 31 |
+
"tp": 1,
|
| 32 |
+
"fp": 0,
|
| 33 |
+
"fn": 0
|
| 34 |
+
},
|
| 35 |
+
"CREDIT_DEBIT_CARD": {
|
| 36 |
+
"precision": 1.0,
|
| 37 |
+
"recall": 1.0,
|
| 38 |
+
"f1": 1.0,
|
| 39 |
+
"tp": 2,
|
| 40 |
+
"fp": 0,
|
| 41 |
+
"fn": 0
|
| 42 |
+
},
|
| 43 |
+
"EMAIL": {
|
| 44 |
+
"precision": 1.0,
|
| 45 |
+
"recall": 1.0,
|
| 46 |
+
"f1": 1.0,
|
| 47 |
+
"tp": 6,
|
| 48 |
+
"fp": 0,
|
| 49 |
+
"fn": 0
|
| 50 |
+
},
|
| 51 |
+
"FIRST_NAME": {
|
| 52 |
+
"precision": 0.95,
|
| 53 |
+
"recall": 1.0,
|
| 54 |
+
"f1": 0.9743589743589743,
|
| 55 |
+
"tp": 19,
|
| 56 |
+
"fp": 1,
|
| 57 |
+
"fn": 0
|
| 58 |
+
},
|
| 59 |
+
"LAST_NAME": {
|
| 60 |
+
"precision": 0.95,
|
| 61 |
+
"recall": 1.0,
|
| 62 |
+
"f1": 0.9743589743589743,
|
| 63 |
+
"tp": 19,
|
| 64 |
+
"fp": 1,
|
| 65 |
+
"fn": 0
|
| 66 |
+
},
|
| 67 |
+
"PASSPORT_NUMBER": {
|
| 68 |
+
"precision": 1.0,
|
| 69 |
+
"recall": 1.0,
|
| 70 |
+
"f1": 1.0,
|
| 71 |
+
"tp": 2,
|
| 72 |
+
"fp": 0,
|
| 73 |
+
"fn": 0
|
| 74 |
+
},
|
| 75 |
+
"PHONE_NUMBER": {
|
| 76 |
+
"precision": 1.0,
|
| 77 |
+
"recall": 0.9166666666666666,
|
| 78 |
+
"f1": 0.9565217391304348,
|
| 79 |
+
"tp": 11,
|
| 80 |
+
"fp": 0,
|
| 81 |
+
"fn": 1
|
| 82 |
+
},
|
| 83 |
+
"POSTCODE": {
|
| 84 |
+
"precision": 1.0,
|
| 85 |
+
"recall": 1.0,
|
| 86 |
+
"f1": 1.0,
|
| 87 |
+
"tp": 4,
|
| 88 |
+
"fp": 0,
|
| 89 |
+
"fn": 0
|
| 90 |
+
},
|
| 91 |
+
"PPSN": {
|
| 92 |
+
"precision": 1.0,
|
| 93 |
+
"recall": 1.0,
|
| 94 |
+
"f1": 1.0,
|
| 95 |
+
"tp": 6,
|
| 96 |
+
"fp": 0,
|
| 97 |
+
"fn": 0
|
| 98 |
+
},
|
| 99 |
+
"SWIFT_BIC": {
|
| 100 |
+
"precision": 1.0,
|
| 101 |
+
"recall": 1.0,
|
| 102 |
+
"f1": 1.0,
|
| 103 |
+
"tp": 2,
|
| 104 |
+
"fp": 0,
|
| 105 |
+
"fn": 0
|
| 106 |
+
}
|
| 107 |
+
}
|
| 108 |
+
}
|
eval/rc8h_cal3_edge_t050_cpu.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model": "models/openmed-mliteclinical-irish-core-multitask-rc8h_cal3",
|
| 3 |
+
"input": "eval/irish_ppsn_phone_edge_v1.jsonl",
|
| 4 |
+
"loader_type": "token_span_pt",
|
| 5 |
+
"examples": 22,
|
| 6 |
+
"min_score": 0.5,
|
| 7 |
+
"iou_threshold": 0.5,
|
| 8 |
+
"elapsed_seconds": 15.53119330003392,
|
| 9 |
+
"examples_per_second": 1.4165041651984303,
|
| 10 |
+
"overall": {
|
| 11 |
+
"precision": 1.0,
|
| 12 |
+
"recall": 1.0,
|
| 13 |
+
"f1": 1.0,
|
| 14 |
+
"tp": 19,
|
| 15 |
+
"fp": 0,
|
| 16 |
+
"fn": 0
|
| 17 |
+
},
|
| 18 |
+
"by_label": {
|
| 19 |
+
"PHONE_NUMBER": {
|
| 20 |
+
"precision": 1.0,
|
| 21 |
+
"recall": 1.0,
|
| 22 |
+
"f1": 1.0,
|
| 23 |
+
"tp": 13,
|
| 24 |
+
"fp": 0,
|
| 25 |
+
"fn": 0
|
| 26 |
+
},
|
| 27 |
+
"PPSN": {
|
| 28 |
+
"precision": 1.0,
|
| 29 |
+
"recall": 1.0,
|
| 30 |
+
"f1": 1.0,
|
| 31 |
+
"tp": 6,
|
| 32 |
+
"fp": 0,
|
| 33 |
+
"fn": 0
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
}
|
eval/rc8h_cal3_finance_boundary_t050_cpu.json
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model": "models/openmed-mliteclinical-irish-core-multitask-rc8h_cal3",
|
| 3 |
+
"input": "eval/irish_finance_boundary_repair_v1.jsonl",
|
| 4 |
+
"loader_type": "token_span_pt",
|
| 5 |
+
"examples": 12,
|
| 6 |
+
"min_score": 0.5,
|
| 7 |
+
"iou_threshold": 0.5,
|
| 8 |
+
"elapsed_seconds": 17.771310269017704,
|
| 9 |
+
"examples_per_second": 0.675245652591,
|
| 10 |
+
"overall": {
|
| 11 |
+
"precision": 1.0,
|
| 12 |
+
"recall": 1.0,
|
| 13 |
+
"f1": 1.0,
|
| 14 |
+
"tp": 18,
|
| 15 |
+
"fp": 0,
|
| 16 |
+
"fn": 0
|
| 17 |
+
},
|
| 18 |
+
"by_label": {
|
| 19 |
+
"ACCOUNT_NUMBER": {
|
| 20 |
+
"precision": 1.0,
|
| 21 |
+
"recall": 1.0,
|
| 22 |
+
"f1": 1.0,
|
| 23 |
+
"tp": 2,
|
| 24 |
+
"fp": 0,
|
| 25 |
+
"fn": 0
|
| 26 |
+
},
|
| 27 |
+
"BANK_ROUTING_NUMBER": {
|
| 28 |
+
"precision": 1.0,
|
| 29 |
+
"recall": 1.0,
|
| 30 |
+
"f1": 1.0,
|
| 31 |
+
"tp": 2,
|
| 32 |
+
"fp": 0,
|
| 33 |
+
"fn": 0
|
| 34 |
+
},
|
| 35 |
+
"CREDIT_DEBIT_CARD": {
|
| 36 |
+
"precision": 1.0,
|
| 37 |
+
"recall": 1.0,
|
| 38 |
+
"f1": 1.0,
|
| 39 |
+
"tp": 2,
|
| 40 |
+
"fp": 0,
|
| 41 |
+
"fn": 0
|
| 42 |
+
},
|
| 43 |
+
"PASSPORT_NUMBER": {
|
| 44 |
+
"precision": 1.0,
|
| 45 |
+
"recall": 1.0,
|
| 46 |
+
"f1": 1.0,
|
| 47 |
+
"tp": 4,
|
| 48 |
+
"fp": 0,
|
| 49 |
+
"fn": 0
|
| 50 |
+
},
|
| 51 |
+
"PHONE_NUMBER": {
|
| 52 |
+
"precision": 1.0,
|
| 53 |
+
"recall": 1.0,
|
| 54 |
+
"f1": 1.0,
|
| 55 |
+
"tp": 4,
|
| 56 |
+
"fp": 0,
|
| 57 |
+
"fn": 0
|
| 58 |
+
},
|
| 59 |
+
"PPSN": {
|
| 60 |
+
"precision": 1.0,
|
| 61 |
+
"recall": 1.0,
|
| 62 |
+
"f1": 1.0,
|
| 63 |
+
"tp": 2,
|
| 64 |
+
"fp": 0,
|
| 65 |
+
"fn": 0
|
| 66 |
+
},
|
| 67 |
+
"SWIFT_BIC": {
|
| 68 |
+
"precision": 1.0,
|
| 69 |
+
"recall": 1.0,
|
| 70 |
+
"f1": 1.0,
|
| 71 |
+
"tp": 2,
|
| 72 |
+
"fp": 0,
|
| 73 |
+
"fn": 0
|
| 74 |
+
}
|
| 75 |
+
}
|
| 76 |
+
}
|
eval/rc8h_cal3_finance_t050_cpu.json
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model": "models/openmed-mliteclinical-irish-core-multitask-rc8h_cal3",
|
| 3 |
+
"input": "eval/irish_phone_passport_finance_v1.jsonl",
|
| 4 |
+
"loader_type": "token_span_pt",
|
| 5 |
+
"examples": 20,
|
| 6 |
+
"min_score": 0.5,
|
| 7 |
+
"iou_threshold": 0.5,
|
| 8 |
+
"elapsed_seconds": 24.535578383947723,
|
| 9 |
+
"examples_per_second": 0.8151427974114888,
|
| 10 |
+
"overall": {
|
| 11 |
+
"precision": 1.0,
|
| 12 |
+
"recall": 1.0,
|
| 13 |
+
"f1": 1.0,
|
| 14 |
+
"tp": 25,
|
| 15 |
+
"fp": 0,
|
| 16 |
+
"fn": 0
|
| 17 |
+
},
|
| 18 |
+
"by_label": {
|
| 19 |
+
"ACCOUNT_NUMBER": {
|
| 20 |
+
"precision": 1.0,
|
| 21 |
+
"recall": 1.0,
|
| 22 |
+
"f1": 1.0,
|
| 23 |
+
"tp": 2,
|
| 24 |
+
"fp": 0,
|
| 25 |
+
"fn": 0
|
| 26 |
+
},
|
| 27 |
+
"BANK_ROUTING_NUMBER": {
|
| 28 |
+
"precision": 1.0,
|
| 29 |
+
"recall": 1.0,
|
| 30 |
+
"f1": 1.0,
|
| 31 |
+
"tp": 5,
|
| 32 |
+
"fp": 0,
|
| 33 |
+
"fn": 0
|
| 34 |
+
},
|
| 35 |
+
"CREDIT_DEBIT_CARD": {
|
| 36 |
+
"precision": 1.0,
|
| 37 |
+
"recall": 1.0,
|
| 38 |
+
"f1": 1.0,
|
| 39 |
+
"tp": 2,
|
| 40 |
+
"fp": 0,
|
| 41 |
+
"fn": 0
|
| 42 |
+
},
|
| 43 |
+
"PASSPORT_NUMBER": {
|
| 44 |
+
"precision": 1.0,
|
| 45 |
+
"recall": 1.0,
|
| 46 |
+
"f1": 1.0,
|
| 47 |
+
"tp": 6,
|
| 48 |
+
"fp": 0,
|
| 49 |
+
"fn": 0
|
| 50 |
+
},
|
| 51 |
+
"PHONE_NUMBER": {
|
| 52 |
+
"precision": 1.0,
|
| 53 |
+
"recall": 1.0,
|
| 54 |
+
"f1": 1.0,
|
| 55 |
+
"tp": 6,
|
| 56 |
+
"fp": 0,
|
| 57 |
+
"fn": 0
|
| 58 |
+
},
|
| 59 |
+
"PPSN": {
|
| 60 |
+
"precision": 1.0,
|
| 61 |
+
"recall": 1.0,
|
| 62 |
+
"f1": 1.0,
|
| 63 |
+
"tp": 2,
|
| 64 |
+
"fp": 0,
|
| 65 |
+
"fn": 0
|
| 66 |
+
},
|
| 67 |
+
"SWIFT_BIC": {
|
| 68 |
+
"precision": 1.0,
|
| 69 |
+
"recall": 1.0,
|
| 70 |
+
"f1": 1.0,
|
| 71 |
+
"tp": 2,
|
| 72 |
+
"fp": 0,
|
| 73 |
+
"fn": 0
|
| 74 |
+
}
|
| 75 |
+
}
|
| 76 |
+
}
|
eval/rc8h_cal3_gaweak_t050_cpu.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model": "models/openmed-mliteclinical-irish-core-multitask-rc8h_cal3",
|
| 3 |
+
"input": "eval/qa_feedback_ga_ppsn_weakctx_v1.jsonl",
|
| 4 |
+
"loader_type": "token_span_pt",
|
| 5 |
+
"examples": 2,
|
| 6 |
+
"min_score": 0.5,
|
| 7 |
+
"iou_threshold": 0.5,
|
| 8 |
+
"elapsed_seconds": 4.148581088054925,
|
| 9 |
+
"examples_per_second": 0.48209254141340796,
|
| 10 |
+
"overall": {
|
| 11 |
+
"precision": 1.0,
|
| 12 |
+
"recall": 1.0,
|
| 13 |
+
"f1": 1.0,
|
| 14 |
+
"tp": 2,
|
| 15 |
+
"fp": 0,
|
| 16 |
+
"fn": 0
|
| 17 |
+
},
|
| 18 |
+
"by_label": {
|
| 19 |
+
"PPSN": {
|
| 20 |
+
"precision": 1.0,
|
| 21 |
+
"recall": 1.0,
|
| 22 |
+
"f1": 1.0,
|
| 23 |
+
"tp": 2,
|
| 24 |
+
"fp": 0,
|
| 25 |
+
"fn": 0
|
| 26 |
+
}
|
| 27 |
+
}
|
| 28 |
+
}
|
eval/rc8h_cal3_multilingual_t050_cpu.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model": "models/openmed-mliteclinical-irish-core-multitask-rc8h_cal3",
|
| 3 |
+
"input": "eval/multilingual_ppsn_v1_all.jsonl",
|
| 4 |
+
"loader_type": "token_span_pt",
|
| 5 |
+
"examples": 168,
|
| 6 |
+
"min_score": 0.5,
|
| 7 |
+
"iou_threshold": 0.5,
|
| 8 |
+
"elapsed_seconds": 26.62634184001945,
|
| 9 |
+
"examples_per_second": 6.309541168268772,
|
| 10 |
+
"overall": {
|
| 11 |
+
"precision": 0.9069767441860465,
|
| 12 |
+
"recall": 0.9285714285714286,
|
| 13 |
+
"f1": 0.9176470588235294,
|
| 14 |
+
"tp": 78,
|
| 15 |
+
"fp": 8,
|
| 16 |
+
"fn": 6
|
| 17 |
+
},
|
| 18 |
+
"by_label": {
|
| 19 |
+
"PPSN": {
|
| 20 |
+
"precision": 0.975,
|
| 21 |
+
"recall": 0.9285714285714286,
|
| 22 |
+
"f1": 0.951219512195122,
|
| 23 |
+
"tp": 78,
|
| 24 |
+
"fp": 2,
|
| 25 |
+
"fn": 6
|
| 26 |
+
}
|
| 27 |
+
}
|
| 28 |
+
}
|
eval/rc8h_cal3_q8_core_t050_cpu.json
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model": "models/openmed-mliteclinical-irish-core-multitask-rc8h_cal3_onnx_q8",
|
| 3 |
+
"input": "eval/irish_core_pii_v1.jsonl",
|
| 4 |
+
"loader_type": "token_span_onnx_q8",
|
| 5 |
+
"examples": 37,
|
| 6 |
+
"min_score": 0.5,
|
| 7 |
+
"iou_threshold": 0.5,
|
| 8 |
+
"elapsed_seconds": 0.8018721779808402,
|
| 9 |
+
"examples_per_second": 46.14201741375802,
|
| 10 |
+
"overall": {
|
| 11 |
+
"precision": 0.9736842105263158,
|
| 12 |
+
"recall": 0.9736842105263158,
|
| 13 |
+
"f1": 0.9736842105263158,
|
| 14 |
+
"tp": 74,
|
| 15 |
+
"fp": 2,
|
| 16 |
+
"fn": 2
|
| 17 |
+
},
|
| 18 |
+
"by_label": {
|
| 19 |
+
"ACCOUNT_NUMBER": {
|
| 20 |
+
"precision": 1.0,
|
| 21 |
+
"recall": 0.6666666666666666,
|
| 22 |
+
"f1": 0.8,
|
| 23 |
+
"tp": 2,
|
| 24 |
+
"fp": 0,
|
| 25 |
+
"fn": 1
|
| 26 |
+
},
|
| 27 |
+
"BANK_ROUTING_NUMBER": {
|
| 28 |
+
"precision": 1.0,
|
| 29 |
+
"recall": 1.0,
|
| 30 |
+
"f1": 1.0,
|
| 31 |
+
"tp": 1,
|
| 32 |
+
"fp": 0,
|
| 33 |
+
"fn": 0
|
| 34 |
+
},
|
| 35 |
+
"CREDIT_DEBIT_CARD": {
|
| 36 |
+
"precision": 1.0,
|
| 37 |
+
"recall": 1.0,
|
| 38 |
+
"f1": 1.0,
|
| 39 |
+
"tp": 2,
|
| 40 |
+
"fp": 0,
|
| 41 |
+
"fn": 0
|
| 42 |
+
},
|
| 43 |
+
"EMAIL": {
|
| 44 |
+
"precision": 1.0,
|
| 45 |
+
"recall": 1.0,
|
| 46 |
+
"f1": 1.0,
|
| 47 |
+
"tp": 6,
|
| 48 |
+
"fp": 0,
|
| 49 |
+
"fn": 0
|
| 50 |
+
},
|
| 51 |
+
"FIRST_NAME": {
|
| 52 |
+
"precision": 0.95,
|
| 53 |
+
"recall": 1.0,
|
| 54 |
+
"f1": 0.9743589743589743,
|
| 55 |
+
"tp": 19,
|
| 56 |
+
"fp": 1,
|
| 57 |
+
"fn": 0
|
| 58 |
+
},
|
| 59 |
+
"LAST_NAME": {
|
| 60 |
+
"precision": 0.95,
|
| 61 |
+
"recall": 1.0,
|
| 62 |
+
"f1": 0.9743589743589743,
|
| 63 |
+
"tp": 19,
|
| 64 |
+
"fp": 1,
|
| 65 |
+
"fn": 0
|
| 66 |
+
},
|
| 67 |
+
"PASSPORT_NUMBER": {
|
| 68 |
+
"precision": 1.0,
|
| 69 |
+
"recall": 1.0,
|
| 70 |
+
"f1": 1.0,
|
| 71 |
+
"tp": 2,
|
| 72 |
+
"fp": 0,
|
| 73 |
+
"fn": 0
|
| 74 |
+
},
|
| 75 |
+
"PHONE_NUMBER": {
|
| 76 |
+
"precision": 1.0,
|
| 77 |
+
"recall": 0.9166666666666666,
|
| 78 |
+
"f1": 0.9565217391304348,
|
| 79 |
+
"tp": 11,
|
| 80 |
+
"fp": 0,
|
| 81 |
+
"fn": 1
|
| 82 |
+
},
|
| 83 |
+
"POSTCODE": {
|
| 84 |
+
"precision": 1.0,
|
| 85 |
+
"recall": 1.0,
|
| 86 |
+
"f1": 1.0,
|
| 87 |
+
"tp": 4,
|
| 88 |
+
"fp": 0,
|
| 89 |
+
"fn": 0
|
| 90 |
+
},
|
| 91 |
+
"PPSN": {
|
| 92 |
+
"precision": 1.0,
|
| 93 |
+
"recall": 1.0,
|
| 94 |
+
"f1": 1.0,
|
| 95 |
+
"tp": 6,
|
| 96 |
+
"fp": 0,
|
| 97 |
+
"fn": 0
|
| 98 |
+
},
|
| 99 |
+
"SWIFT_BIC": {
|
| 100 |
+
"precision": 1.0,
|
| 101 |
+
"recall": 1.0,
|
| 102 |
+
"f1": 1.0,
|
| 103 |
+
"tp": 2,
|
| 104 |
+
"fp": 0,
|
| 105 |
+
"fn": 0
|
| 106 |
+
}
|
| 107 |
+
}
|
| 108 |
+
}
|
eval/rc8h_cal3_q8_edge_t050_cpu.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model": "models/openmed-mliteclinical-irish-core-multitask-rc8h_cal3_onnx_q8",
|
| 3 |
+
"input": "eval/irish_ppsn_phone_edge_v1.jsonl",
|
| 4 |
+
"loader_type": "token_span_onnx_q8",
|
| 5 |
+
"examples": 22,
|
| 6 |
+
"min_score": 0.5,
|
| 7 |
+
"iou_threshold": 0.5,
|
| 8 |
+
"elapsed_seconds": 0.4215048130135983,
|
| 9 |
+
"examples_per_second": 52.193947306813435,
|
| 10 |
+
"overall": {
|
| 11 |
+
"precision": 1.0,
|
| 12 |
+
"recall": 1.0,
|
| 13 |
+
"f1": 1.0,
|
| 14 |
+
"tp": 19,
|
| 15 |
+
"fp": 0,
|
| 16 |
+
"fn": 0
|
| 17 |
+
},
|
| 18 |
+
"by_label": {
|
| 19 |
+
"PHONE_NUMBER": {
|
| 20 |
+
"precision": 1.0,
|
| 21 |
+
"recall": 1.0,
|
| 22 |
+
"f1": 1.0,
|
| 23 |
+
"tp": 13,
|
| 24 |
+
"fp": 0,
|
| 25 |
+
"fn": 0
|
| 26 |
+
},
|
| 27 |
+
"PPSN": {
|
| 28 |
+
"precision": 1.0,
|
| 29 |
+
"recall": 1.0,
|
| 30 |
+
"f1": 1.0,
|
| 31 |
+
"tp": 6,
|
| 32 |
+
"fp": 0,
|
| 33 |
+
"fn": 0
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
}
|
eval/rc8h_cal3_q8_finance_boundary_t050_cpu.json
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model": "models/openmed-mliteclinical-irish-core-multitask-rc8h_cal3_onnx_q8",
|
| 3 |
+
"input": "eval/irish_finance_boundary_repair_v1.jsonl",
|
| 4 |
+
"loader_type": "token_span_onnx_q8",
|
| 5 |
+
"examples": 12,
|
| 6 |
+
"min_score": 0.5,
|
| 7 |
+
"iou_threshold": 0.5,
|
| 8 |
+
"elapsed_seconds": 0.22588503907900304,
|
| 9 |
+
"examples_per_second": 53.12436825797486,
|
| 10 |
+
"overall": {
|
| 11 |
+
"precision": 1.0,
|
| 12 |
+
"recall": 1.0,
|
| 13 |
+
"f1": 1.0,
|
| 14 |
+
"tp": 18,
|
| 15 |
+
"fp": 0,
|
| 16 |
+
"fn": 0
|
| 17 |
+
},
|
| 18 |
+
"by_label": {
|
| 19 |
+
"ACCOUNT_NUMBER": {
|
| 20 |
+
"precision": 1.0,
|
| 21 |
+
"recall": 1.0,
|
| 22 |
+
"f1": 1.0,
|
| 23 |
+
"tp": 2,
|
| 24 |
+
"fp": 0,
|
| 25 |
+
"fn": 0
|
| 26 |
+
},
|
| 27 |
+
"BANK_ROUTING_NUMBER": {
|
| 28 |
+
"precision": 1.0,
|
| 29 |
+
"recall": 1.0,
|
| 30 |
+
"f1": 1.0,
|
| 31 |
+
"tp": 2,
|
| 32 |
+
"fp": 0,
|
| 33 |
+
"fn": 0
|
| 34 |
+
},
|
| 35 |
+
"CREDIT_DEBIT_CARD": {
|
| 36 |
+
"precision": 1.0,
|
| 37 |
+
"recall": 1.0,
|
| 38 |
+
"f1": 1.0,
|
| 39 |
+
"tp": 2,
|
| 40 |
+
"fp": 0,
|
| 41 |
+
"fn": 0
|
| 42 |
+
},
|
| 43 |
+
"PASSPORT_NUMBER": {
|
| 44 |
+
"precision": 1.0,
|
| 45 |
+
"recall": 1.0,
|
| 46 |
+
"f1": 1.0,
|
| 47 |
+
"tp": 4,
|
| 48 |
+
"fp": 0,
|
| 49 |
+
"fn": 0
|
| 50 |
+
},
|
| 51 |
+
"PHONE_NUMBER": {
|
| 52 |
+
"precision": 1.0,
|
| 53 |
+
"recall": 1.0,
|
| 54 |
+
"f1": 1.0,
|
| 55 |
+
"tp": 4,
|
| 56 |
+
"fp": 0,
|
| 57 |
+
"fn": 0
|
| 58 |
+
},
|
| 59 |
+
"PPSN": {
|
| 60 |
+
"precision": 1.0,
|
| 61 |
+
"recall": 1.0,
|
| 62 |
+
"f1": 1.0,
|
| 63 |
+
"tp": 2,
|
| 64 |
+
"fp": 0,
|
| 65 |
+
"fn": 0
|
| 66 |
+
},
|
| 67 |
+
"SWIFT_BIC": {
|
| 68 |
+
"precision": 1.0,
|
| 69 |
+
"recall": 1.0,
|
| 70 |
+
"f1": 1.0,
|
| 71 |
+
"tp": 2,
|
| 72 |
+
"fp": 0,
|
| 73 |
+
"fn": 0
|
| 74 |
+
}
|
| 75 |
+
}
|
| 76 |
+
}
|
eval/rc8h_cal3_q8_finance_t050_cpu.json
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model": "models/openmed-mliteclinical-irish-core-multitask-rc8h_cal3_onnx_q8",
|
| 3 |
+
"input": "eval/irish_phone_passport_finance_v1.jsonl",
|
| 4 |
+
"loader_type": "token_span_onnx_q8",
|
| 5 |
+
"examples": 20,
|
| 6 |
+
"min_score": 0.5,
|
| 7 |
+
"iou_threshold": 0.5,
|
| 8 |
+
"elapsed_seconds": 0.5003277519717813,
|
| 9 |
+
"examples_per_second": 39.97379701841526,
|
| 10 |
+
"overall": {
|
| 11 |
+
"precision": 1.0,
|
| 12 |
+
"recall": 1.0,
|
| 13 |
+
"f1": 1.0,
|
| 14 |
+
"tp": 25,
|
| 15 |
+
"fp": 0,
|
| 16 |
+
"fn": 0
|
| 17 |
+
},
|
| 18 |
+
"by_label": {
|
| 19 |
+
"ACCOUNT_NUMBER": {
|
| 20 |
+
"precision": 1.0,
|
| 21 |
+
"recall": 1.0,
|
| 22 |
+
"f1": 1.0,
|
| 23 |
+
"tp": 2,
|
| 24 |
+
"fp": 0,
|
| 25 |
+
"fn": 0
|
| 26 |
+
},
|
| 27 |
+
"BANK_ROUTING_NUMBER": {
|
| 28 |
+
"precision": 1.0,
|
| 29 |
+
"recall": 1.0,
|
| 30 |
+
"f1": 1.0,
|
| 31 |
+
"tp": 5,
|
| 32 |
+
"fp": 0,
|
| 33 |
+
"fn": 0
|
| 34 |
+
},
|
| 35 |
+
"CREDIT_DEBIT_CARD": {
|
| 36 |
+
"precision": 1.0,
|
| 37 |
+
"recall": 1.0,
|
| 38 |
+
"f1": 1.0,
|
| 39 |
+
"tp": 2,
|
| 40 |
+
"fp": 0,
|
| 41 |
+
"fn": 0
|
| 42 |
+
},
|
| 43 |
+
"PASSPORT_NUMBER": {
|
| 44 |
+
"precision": 1.0,
|
| 45 |
+
"recall": 1.0,
|
| 46 |
+
"f1": 1.0,
|
| 47 |
+
"tp": 6,
|
| 48 |
+
"fp": 0,
|
| 49 |
+
"fn": 0
|
| 50 |
+
},
|
| 51 |
+
"PHONE_NUMBER": {
|
| 52 |
+
"precision": 1.0,
|
| 53 |
+
"recall": 1.0,
|
| 54 |
+
"f1": 1.0,
|
| 55 |
+
"tp": 6,
|
| 56 |
+
"fp": 0,
|
| 57 |
+
"fn": 0
|
| 58 |
+
},
|
| 59 |
+
"PPSN": {
|
| 60 |
+
"precision": 1.0,
|
| 61 |
+
"recall": 1.0,
|
| 62 |
+
"f1": 1.0,
|
| 63 |
+
"tp": 2,
|
| 64 |
+
"fp": 0,
|
| 65 |
+
"fn": 0
|
| 66 |
+
},
|
| 67 |
+
"SWIFT_BIC": {
|
| 68 |
+
"precision": 1.0,
|
| 69 |
+
"recall": 1.0,
|
| 70 |
+
"f1": 1.0,
|
| 71 |
+
"tp": 2,
|
| 72 |
+
"fp": 0,
|
| 73 |
+
"fn": 0
|
| 74 |
+
}
|
| 75 |
+
}
|
| 76 |
+
}
|
eval/rc8h_cal3_q8_gaweak_t050_cpu.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model": "models/openmed-mliteclinical-irish-core-multitask-rc8h_cal3_onnx_q8",
|
| 3 |
+
"input": "eval/qa_feedback_ga_ppsn_weakctx_v1.jsonl",
|
| 4 |
+
"loader_type": "token_span_onnx_q8",
|
| 5 |
+
"examples": 2,
|
| 6 |
+
"min_score": 0.5,
|
| 7 |
+
"iou_threshold": 0.5,
|
| 8 |
+
"elapsed_seconds": 0.1290204740362242,
|
| 9 |
+
"examples_per_second": 15.50141568568779,
|
| 10 |
+
"overall": {
|
| 11 |
+
"precision": 1.0,
|
| 12 |
+
"recall": 1.0,
|
| 13 |
+
"f1": 1.0,
|
| 14 |
+
"tp": 2,
|
| 15 |
+
"fp": 0,
|
| 16 |
+
"fn": 0
|
| 17 |
+
},
|
| 18 |
+
"by_label": {
|
| 19 |
+
"PPSN": {
|
| 20 |
+
"precision": 1.0,
|
| 21 |
+
"recall": 1.0,
|
| 22 |
+
"f1": 1.0,
|
| 23 |
+
"tp": 2,
|
| 24 |
+
"fp": 0,
|
| 25 |
+
"fn": 0
|
| 26 |
+
}
|
| 27 |
+
}
|
| 28 |
+
}
|
eval/rc8h_cal3_q8_multilingual_t050_cpu.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model": "models/openmed-mliteclinical-irish-core-multitask-rc8h_cal3_onnx_q8",
|
| 3 |
+
"input": "eval/multilingual_ppsn_v1_all.jsonl",
|
| 4 |
+
"loader_type": "token_span_onnx_q8",
|
| 5 |
+
"examples": 168,
|
| 6 |
+
"min_score": 0.5,
|
| 7 |
+
"iou_threshold": 0.5,
|
| 8 |
+
"elapsed_seconds": 1.6847753919428214,
|
| 9 |
+
"examples_per_second": 99.71655616732895,
|
| 10 |
+
"overall": {
|
| 11 |
+
"precision": 0.9069767441860465,
|
| 12 |
+
"recall": 0.9285714285714286,
|
| 13 |
+
"f1": 0.9176470588235294,
|
| 14 |
+
"tp": 78,
|
| 15 |
+
"fp": 8,
|
| 16 |
+
"fn": 6
|
| 17 |
+
},
|
| 18 |
+
"by_label": {
|
| 19 |
+
"PPSN": {
|
| 20 |
+
"precision": 0.975,
|
| 21 |
+
"recall": 0.9285714285714286,
|
| 22 |
+
"f1": 0.951219512195122,
|
| 23 |
+
"tp": 78,
|
| 24 |
+
"fp": 2,
|
| 25 |
+
"fn": 6
|
| 26 |
+
}
|
| 27 |
+
}
|
| 28 |
+
}
|
eval/rc8h_cal3_q8_user_t050_cpu.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model": "models/openmed-mliteclinical-irish-core-multitask-rc8h_cal3_onnx_q8",
|
| 3 |
+
"input": "eval/user_raw_regression_cases_v1.jsonl",
|
| 4 |
+
"loader_type": "token_span_onnx_q8",
|
| 5 |
+
"examples": 7,
|
| 6 |
+
"min_score": 0.5,
|
| 7 |
+
"iou_threshold": 0.5,
|
| 8 |
+
"elapsed_seconds": 0.17300033092033118,
|
| 9 |
+
"examples_per_second": 40.462350347893775,
|
| 10 |
+
"overall": {
|
| 11 |
+
"precision": 1.0,
|
| 12 |
+
"recall": 1.0,
|
| 13 |
+
"f1": 1.0,
|
| 14 |
+
"tp": 3,
|
| 15 |
+
"fp": 0,
|
| 16 |
+
"fn": 0
|
| 17 |
+
},
|
| 18 |
+
"by_label": {
|
| 19 |
+
"PPSN": {
|
| 20 |
+
"precision": 1.0,
|
| 21 |
+
"recall": 1.0,
|
| 22 |
+
"f1": 1.0,
|
| 23 |
+
"tp": 3,
|
| 24 |
+
"fp": 0,
|
| 25 |
+
"fn": 0
|
| 26 |
+
}
|
| 27 |
+
}
|
| 28 |
+
}
|
eval/rc8h_cal3_user_t050_cpu.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model": "models/openmed-mliteclinical-irish-core-multitask-rc8h_cal3",
|
| 3 |
+
"input": "eval/user_raw_regression_cases_v1.jsonl",
|
| 4 |
+
"loader_type": "token_span_pt",
|
| 5 |
+
"examples": 7,
|
| 6 |
+
"min_score": 0.5,
|
| 7 |
+
"iou_threshold": 0.5,
|
| 8 |
+
"elapsed_seconds": 11.713831512955949,
|
| 9 |
+
"examples_per_second": 0.5975841459097078,
|
| 10 |
+
"overall": {
|
| 11 |
+
"precision": 1.0,
|
| 12 |
+
"recall": 1.0,
|
| 13 |
+
"f1": 1.0,
|
| 14 |
+
"tp": 3,
|
| 15 |
+
"fp": 0,
|
| 16 |
+
"fn": 0
|
| 17 |
+
},
|
| 18 |
+
"by_label": {
|
| 19 |
+
"PPSN": {
|
| 20 |
+
"precision": 1.0,
|
| 21 |
+
"recall": 1.0,
|
| 22 |
+
"f1": 1.0,
|
| 23 |
+
"tp": 3,
|
| 24 |
+
"fp": 0,
|
| 25 |
+
"fn": 0
|
| 26 |
+
}
|
| 27 |
+
}
|
| 28 |
+
}
|
inference_mask.py
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
from __future__ import annotations
|
| 3 |
+
|
| 4 |
+
import argparse
|
| 5 |
+
import json
|
| 6 |
+
import os
|
| 7 |
+
|
| 8 |
+
os.environ.setdefault("TRANSFORMERS_NO_TF", "1")
|
| 9 |
+
os.environ.setdefault("TRANSFORMERS_NO_FLAX", "1")
|
| 10 |
+
os.environ.setdefault("TRANSFORMERS_NO_TORCHVISION", "1")
|
| 11 |
+
os.environ["USE_TF"] = "0"
|
| 12 |
+
os.environ["USE_FLAX"] = "0"
|
| 13 |
+
os.environ["USE_TORCH"] = "1"
|
| 14 |
+
|
| 15 |
+
import torch
|
| 16 |
+
from transformers import AutoConfig
|
| 17 |
+
|
| 18 |
+
from common import (
|
| 19 |
+
boundary_label_thresholds_from_config,
|
| 20 |
+
decode_token_presence_segments,
|
| 21 |
+
label_max_span_tokens_from_config,
|
| 22 |
+
label_min_nonspace_chars_from_config,
|
| 23 |
+
label_names_from_config,
|
| 24 |
+
safe_auto_tokenizer,
|
| 25 |
+
token_extend_thresholds_from_config,
|
| 26 |
+
token_label_thresholds_from_config,
|
| 27 |
+
)
|
| 28 |
+
from multitask_model import IrishCoreTokenSpanModel
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
def mask_text(text: str, spans: list[dict]) -> str:
|
| 32 |
+
out = text
|
| 33 |
+
for span in sorted(spans, key=lambda item: (item["start"], item["end"]), reverse=True):
|
| 34 |
+
out = out[: span["start"]] + f"[{span['label']}]" + out[span["end"] :]
|
| 35 |
+
return out
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
def predict(text: str, model, tokenizer, min_score: float):
|
| 39 |
+
encoded = tokenizer(text, return_offsets_mapping=True, return_tensors="pt", truncation=True)
|
| 40 |
+
offsets = [tuple(item) for item in encoded.pop("offset_mapping")[0].tolist()]
|
| 41 |
+
device = next(model.parameters()).device
|
| 42 |
+
encoded = {key: value.to(device) for key, value in encoded.items()}
|
| 43 |
+
with torch.no_grad():
|
| 44 |
+
output = model(**encoded)
|
| 45 |
+
token_scores = torch.sigmoid(output.token_logits[0]).cpu().numpy()
|
| 46 |
+
start_scores = torch.sigmoid(output.start_logits[0]).cpu().numpy()
|
| 47 |
+
end_scores = torch.sigmoid(output.end_logits[0]).cpu().numpy()
|
| 48 |
+
label_names = label_names_from_config(model.config)
|
| 49 |
+
thresholds = token_label_thresholds_from_config(model.config, min_score)
|
| 50 |
+
extend_thresholds = token_extend_thresholds_from_config(model.config)
|
| 51 |
+
max_span_tokens = label_max_span_tokens_from_config(model.config)
|
| 52 |
+
min_nonspace_chars = label_min_nonspace_chars_from_config(model.config)
|
| 53 |
+
boundary_thresholds = boundary_label_thresholds_from_config(model.config)
|
| 54 |
+
return decode_token_presence_segments(
|
| 55 |
+
text,
|
| 56 |
+
offsets,
|
| 57 |
+
token_scores,
|
| 58 |
+
label_names,
|
| 59 |
+
min_score,
|
| 60 |
+
thresholds,
|
| 61 |
+
extend_thresholds,
|
| 62 |
+
max_span_tokens,
|
| 63 |
+
min_nonspace_chars,
|
| 64 |
+
boundary_thresholds,
|
| 65 |
+
start_scores=start_scores,
|
| 66 |
+
end_scores=end_scores,
|
| 67 |
+
)
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
def main() -> None:
|
| 71 |
+
parser = argparse.ArgumentParser()
|
| 72 |
+
parser.add_argument("--model", required=True)
|
| 73 |
+
parser.add_argument("--text", required=True)
|
| 74 |
+
parser.add_argument("--min-score", type=float, default=0.5)
|
| 75 |
+
parser.add_argument("--device", choices=["auto", "cpu", "cuda"], default="auto")
|
| 76 |
+
parser.add_argument("--json", action="store_true")
|
| 77 |
+
args = parser.parse_args()
|
| 78 |
+
|
| 79 |
+
tokenizer = safe_auto_tokenizer(args.model)
|
| 80 |
+
config = AutoConfig.from_pretrained(args.model)
|
| 81 |
+
model = IrishCoreTokenSpanModel.from_pretrained(args.model, config=config)
|
| 82 |
+
if args.device == "auto":
|
| 83 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 84 |
+
else:
|
| 85 |
+
device = args.device
|
| 86 |
+
model.to(device)
|
| 87 |
+
model.eval()
|
| 88 |
+
|
| 89 |
+
spans = predict(args.text, model, tokenizer, args.min_score)
|
| 90 |
+
result = {
|
| 91 |
+
"model": args.model,
|
| 92 |
+
"backend": "transformers_token_span",
|
| 93 |
+
"min_score": args.min_score,
|
| 94 |
+
"spans": spans,
|
| 95 |
+
"masked_text": mask_text(args.text, spans),
|
| 96 |
+
}
|
| 97 |
+
if args.json:
|
| 98 |
+
print(json.dumps(result, indent=2, ensure_ascii=False))
|
| 99 |
+
else:
|
| 100 |
+
print(result["masked_text"])
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
if __name__ == "__main__":
|
| 104 |
+
main()
|
inference_mask_onnx.py
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
from __future__ import annotations
|
| 3 |
+
|
| 4 |
+
import argparse
|
| 5 |
+
import json
|
| 6 |
+
import os
|
| 7 |
+
|
| 8 |
+
os.environ.setdefault("TRANSFORMERS_NO_TF", "1")
|
| 9 |
+
os.environ.setdefault("TRANSFORMERS_NO_FLAX", "1")
|
| 10 |
+
os.environ.setdefault("TRANSFORMERS_NO_TORCHVISION", "1")
|
| 11 |
+
os.environ["USE_TF"] = "0"
|
| 12 |
+
os.environ["USE_FLAX"] = "0"
|
| 13 |
+
os.environ["USE_TORCH"] = "1"
|
| 14 |
+
|
| 15 |
+
import numpy as np
|
| 16 |
+
|
| 17 |
+
from common import (
|
| 18 |
+
boundary_label_thresholds_from_config,
|
| 19 |
+
decode_token_presence_segments,
|
| 20 |
+
label_max_span_tokens_from_config,
|
| 21 |
+
label_min_nonspace_chars_from_config,
|
| 22 |
+
label_names_from_config,
|
| 23 |
+
load_onnx_session,
|
| 24 |
+
run_onnx_all,
|
| 25 |
+
token_extend_thresholds_from_config,
|
| 26 |
+
token_label_thresholds_from_config,
|
| 27 |
+
)
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
def mask_text(text: str, spans: list[dict]) -> str:
|
| 31 |
+
out = text
|
| 32 |
+
for span in sorted(spans, key=lambda item: (item["start"], item["end"]), reverse=True):
|
| 33 |
+
out = out[: span["start"]] + f"[{span['label']}]" + out[span["end"] :]
|
| 34 |
+
return out
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
def predict(text: str, session, tokenizer, config, min_score: float):
|
| 38 |
+
encoded = tokenizer(text, return_offsets_mapping=True, return_tensors="np", truncation=True)
|
| 39 |
+
offsets = [tuple(item) for item in encoded["offset_mapping"][0].tolist()]
|
| 40 |
+
token_logits, start_logits, end_logits = run_onnx_all(session, encoded)
|
| 41 |
+
token_scores = 1.0 / (1.0 + np.exp(-token_logits[0]))
|
| 42 |
+
start_scores = 1.0 / (1.0 + np.exp(-start_logits[0]))
|
| 43 |
+
end_scores = 1.0 / (1.0 + np.exp(-end_logits[0]))
|
| 44 |
+
label_names = label_names_from_config(config)
|
| 45 |
+
thresholds = token_label_thresholds_from_config(config, min_score)
|
| 46 |
+
extend_thresholds = token_extend_thresholds_from_config(config)
|
| 47 |
+
max_span_tokens = label_max_span_tokens_from_config(config)
|
| 48 |
+
min_nonspace_chars = label_min_nonspace_chars_from_config(config)
|
| 49 |
+
boundary_thresholds = boundary_label_thresholds_from_config(config)
|
| 50 |
+
return decode_token_presence_segments(
|
| 51 |
+
text,
|
| 52 |
+
offsets,
|
| 53 |
+
token_scores,
|
| 54 |
+
label_names,
|
| 55 |
+
min_score,
|
| 56 |
+
thresholds,
|
| 57 |
+
extend_thresholds,
|
| 58 |
+
max_span_tokens,
|
| 59 |
+
min_nonspace_chars,
|
| 60 |
+
boundary_thresholds,
|
| 61 |
+
start_scores=start_scores,
|
| 62 |
+
end_scores=end_scores,
|
| 63 |
+
)
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
def main() -> None:
|
| 67 |
+
parser = argparse.ArgumentParser()
|
| 68 |
+
parser.add_argument("--model", required=True)
|
| 69 |
+
parser.add_argument("--text", required=True)
|
| 70 |
+
parser.add_argument("--min-score", type=float, default=0.5)
|
| 71 |
+
parser.add_argument("--json", action="store_true")
|
| 72 |
+
args = parser.parse_args()
|
| 73 |
+
|
| 74 |
+
session, tokenizer, config = load_onnx_session(args.model, onnx_file="model_quantized.onnx", onnx_subfolder="onnx")
|
| 75 |
+
spans = predict(args.text, session, tokenizer, config, args.min_score)
|
| 76 |
+
result = {
|
| 77 |
+
"model": args.model,
|
| 78 |
+
"backend": "onnx_token_span_q8",
|
| 79 |
+
"min_score": args.min_score,
|
| 80 |
+
"spans": spans,
|
| 81 |
+
"masked_text": mask_text(args.text, spans),
|
| 82 |
+
}
|
| 83 |
+
if args.json:
|
| 84 |
+
print(json.dumps(result, indent=2, ensure_ascii=False))
|
| 85 |
+
else:
|
| 86 |
+
print(result["masked_text"])
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
if __name__ == "__main__":
|
| 90 |
+
main()
|
model.py
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
from __future__ import annotations
|
| 3 |
+
|
| 4 |
+
from dataclasses import dataclass
|
| 5 |
+
from typing import Optional
|
| 6 |
+
|
| 7 |
+
import torch
|
| 8 |
+
import torch.nn as nn
|
| 9 |
+
from transformers import AutoConfig, AutoModel, PreTrainedModel
|
| 10 |
+
from transformers.utils import ModelOutput
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
def hidden_size_from_config(config) -> int:
|
| 14 |
+
return int(getattr(config, "hidden_size", getattr(config, "dim")))
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
@dataclass
|
| 18 |
+
class MultilabelSpanOutput(ModelOutput):
|
| 19 |
+
loss: Optional[torch.Tensor] = None
|
| 20 |
+
start_logits: Optional[torch.Tensor] = None
|
| 21 |
+
end_logits: Optional[torch.Tensor] = None
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
class IrishCoreSpanHeadModel(PreTrainedModel):
|
| 25 |
+
config_class = AutoConfig
|
| 26 |
+
base_model_prefix = "encoder"
|
| 27 |
+
|
| 28 |
+
def __init__(self, config):
|
| 29 |
+
super().__init__(config)
|
| 30 |
+
num_span_labels = int(getattr(config, "num_span_labels"))
|
| 31 |
+
self.encoder = AutoModel.from_config(config)
|
| 32 |
+
hidden_size = hidden_size_from_config(config)
|
| 33 |
+
dropout = float(getattr(config, "seq_classif_dropout", getattr(config, "dropout", 0.1)))
|
| 34 |
+
self.dropout = nn.Dropout(dropout)
|
| 35 |
+
self.start_classifier = nn.Linear(hidden_size, num_span_labels)
|
| 36 |
+
self.end_classifier = nn.Linear(hidden_size, num_span_labels)
|
| 37 |
+
pos_weight = float(getattr(config, "span_positive_weight", 6.0))
|
| 38 |
+
self.register_buffer("loss_pos_weight", torch.full((num_span_labels,), pos_weight), persistent=False)
|
| 39 |
+
self.post_init()
|
| 40 |
+
|
| 41 |
+
def forward(
|
| 42 |
+
self,
|
| 43 |
+
input_ids=None,
|
| 44 |
+
attention_mask=None,
|
| 45 |
+
token_type_ids=None,
|
| 46 |
+
start_positions=None,
|
| 47 |
+
end_positions=None,
|
| 48 |
+
token_mask=None,
|
| 49 |
+
**kwargs,
|
| 50 |
+
) -> MultilabelSpanOutput:
|
| 51 |
+
encoder_kwargs = {
|
| 52 |
+
"input_ids": input_ids,
|
| 53 |
+
"attention_mask": attention_mask,
|
| 54 |
+
**kwargs,
|
| 55 |
+
}
|
| 56 |
+
if token_type_ids is not None and getattr(self.config, "model_type", "") not in {"distilbert", "roberta"}:
|
| 57 |
+
encoder_kwargs["token_type_ids"] = token_type_ids
|
| 58 |
+
outputs = self.encoder(**encoder_kwargs)
|
| 59 |
+
hidden = self.dropout(outputs.last_hidden_state)
|
| 60 |
+
start_logits = self.start_classifier(hidden)
|
| 61 |
+
end_logits = self.end_classifier(hidden)
|
| 62 |
+
|
| 63 |
+
loss = None
|
| 64 |
+
if start_positions is not None and end_positions is not None:
|
| 65 |
+
if token_mask is None:
|
| 66 |
+
token_mask = attention_mask
|
| 67 |
+
mask = token_mask.float().unsqueeze(-1)
|
| 68 |
+
pos_weight = self.loss_pos_weight.to(start_logits.device)
|
| 69 |
+
bce = nn.BCEWithLogitsLoss(reduction="none", pos_weight=pos_weight)
|
| 70 |
+
start_loss = bce(start_logits, start_positions.float()) * mask
|
| 71 |
+
end_loss = bce(end_logits, end_positions.float()) * mask
|
| 72 |
+
denom = mask.sum().clamp_min(1.0) * start_logits.shape[-1]
|
| 73 |
+
loss = (start_loss.sum() + end_loss.sum()) / (2.0 * denom)
|
| 74 |
+
|
| 75 |
+
return MultilabelSpanOutput(loss=loss, start_logits=start_logits, end_logits=end_logits)
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3c7908e59662702202602a82808406bc724e1b8fedb0c7771992914411ea0e32
|
| 3 |
+
size 539050284
|
multitask_head_meta.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"base_model": "models/openmed-mliteclinical-irish-core-span-rc8f_gapunct_cal",
|
| 3 |
+
"init_span_model": "models/openmed-mliteclinical-irish-core-span-rc8f_gapunct_cal",
|
| 4 |
+
"init_token_model": "release/OpenMed-mLiteClinical-IrishCorePII-135M-v2-rc7",
|
| 5 |
+
"label_names": [
|
| 6 |
+
"ACCOUNT_NUMBER",
|
| 7 |
+
"BANK_ROUTING_NUMBER",
|
| 8 |
+
"CREDIT_DEBIT_CARD",
|
| 9 |
+
"EMAIL",
|
| 10 |
+
"FIRST_NAME",
|
| 11 |
+
"LAST_NAME",
|
| 12 |
+
"PASSPORT_NUMBER",
|
| 13 |
+
"PHONE_NUMBER",
|
| 14 |
+
"POSTCODE",
|
| 15 |
+
"PPSN",
|
| 16 |
+
"SWIFT_BIC"
|
| 17 |
+
],
|
| 18 |
+
"max_length": 128,
|
| 19 |
+
"task": "Irish core PII token-presence plus start/end span extraction",
|
| 20 |
+
"freeze_layers": 2,
|
| 21 |
+
"span_positive_weight": 6.0,
|
| 22 |
+
"token_positive_weight": 4.0,
|
| 23 |
+
"token_presence_weight": 1.0,
|
| 24 |
+
"boundary_loss_weight": 1.0,
|
| 25 |
+
"boundary_smoothing": 0.15,
|
| 26 |
+
"fitted_label_max_span_tokens": {
|
| 27 |
+
"ACCOUNT_NUMBER": 19,
|
| 28 |
+
"BANK_ROUTING_NUMBER": 6,
|
| 29 |
+
"CREDIT_DEBIT_CARD": 13,
|
| 30 |
+
"EMAIL": 16,
|
| 31 |
+
"FIRST_NAME": 5,
|
| 32 |
+
"LAST_NAME": 8,
|
| 33 |
+
"PASSPORT_NUMBER": 9,
|
| 34 |
+
"PHONE_NUMBER": 10,
|
| 35 |
+
"POSTCODE": 8,
|
| 36 |
+
"PPSN": 9,
|
| 37 |
+
"SWIFT_BIC": 8
|
| 38 |
+
},
|
| 39 |
+
"train_examples": 30000,
|
| 40 |
+
"valid_examples": 3750,
|
| 41 |
+
"test_examples": 3750,
|
| 42 |
+
"data": "data/irish_core_multitask_rc8_mix_v1"
|
| 43 |
+
}
|
multitask_model.py
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
from __future__ import annotations
|
| 3 |
+
|
| 4 |
+
from dataclasses import dataclass
|
| 5 |
+
from typing import Optional
|
| 6 |
+
|
| 7 |
+
import torch
|
| 8 |
+
import torch.nn as nn
|
| 9 |
+
from transformers import AutoConfig, AutoModel, PreTrainedModel
|
| 10 |
+
from transformers.utils import ModelOutput
|
| 11 |
+
|
| 12 |
+
from model import hidden_size_from_config
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
@dataclass
|
| 16 |
+
class MultitaskSpanOutput(ModelOutput):
|
| 17 |
+
loss: Optional[torch.Tensor] = None
|
| 18 |
+
token_logits: Optional[torch.Tensor] = None
|
| 19 |
+
start_logits: Optional[torch.Tensor] = None
|
| 20 |
+
end_logits: Optional[torch.Tensor] = None
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
class IrishCoreTokenSpanModel(PreTrainedModel):
|
| 24 |
+
config_class = AutoConfig
|
| 25 |
+
base_model_prefix = "encoder"
|
| 26 |
+
|
| 27 |
+
def __init__(self, config):
|
| 28 |
+
super().__init__(config)
|
| 29 |
+
num_span_labels = int(getattr(config, "num_span_labels"))
|
| 30 |
+
self.encoder = AutoModel.from_config(config)
|
| 31 |
+
hidden_size = hidden_size_from_config(config)
|
| 32 |
+
dropout = float(getattr(config, "seq_classif_dropout", getattr(config, "dropout", 0.1)))
|
| 33 |
+
self.dropout = nn.Dropout(dropout)
|
| 34 |
+
self.token_classifier = nn.Linear(hidden_size, num_span_labels)
|
| 35 |
+
self.start_classifier = nn.Linear(hidden_size, num_span_labels)
|
| 36 |
+
self.end_classifier = nn.Linear(hidden_size, num_span_labels)
|
| 37 |
+
boundary_pos_weight = float(getattr(config, "span_positive_weight", 6.0))
|
| 38 |
+
presence_pos_weight = float(getattr(config, "token_positive_weight", 4.0))
|
| 39 |
+
self.register_buffer("boundary_pos_weight", torch.full((num_span_labels,), boundary_pos_weight), persistent=False)
|
| 40 |
+
self.register_buffer("presence_pos_weight", torch.full((num_span_labels,), presence_pos_weight), persistent=False)
|
| 41 |
+
self.post_init()
|
| 42 |
+
|
| 43 |
+
def forward(
|
| 44 |
+
self,
|
| 45 |
+
input_ids=None,
|
| 46 |
+
attention_mask=None,
|
| 47 |
+
token_type_ids=None,
|
| 48 |
+
token_labels=None,
|
| 49 |
+
start_positions=None,
|
| 50 |
+
end_positions=None,
|
| 51 |
+
token_mask=None,
|
| 52 |
+
**kwargs,
|
| 53 |
+
) -> MultitaskSpanOutput:
|
| 54 |
+
encoder_kwargs = {
|
| 55 |
+
"input_ids": input_ids,
|
| 56 |
+
"attention_mask": attention_mask,
|
| 57 |
+
**kwargs,
|
| 58 |
+
}
|
| 59 |
+
if token_type_ids is not None and getattr(self.config, "model_type", "") not in {"distilbert", "roberta"}:
|
| 60 |
+
encoder_kwargs["token_type_ids"] = token_type_ids
|
| 61 |
+
outputs = self.encoder(**encoder_kwargs)
|
| 62 |
+
hidden = self.dropout(outputs.last_hidden_state)
|
| 63 |
+
token_logits = self.token_classifier(hidden)
|
| 64 |
+
start_logits = self.start_classifier(hidden)
|
| 65 |
+
end_logits = self.end_classifier(hidden)
|
| 66 |
+
|
| 67 |
+
loss = None
|
| 68 |
+
if token_labels is not None and start_positions is not None and end_positions is not None:
|
| 69 |
+
if token_mask is None:
|
| 70 |
+
token_mask = attention_mask
|
| 71 |
+
mask = token_mask.float().unsqueeze(-1)
|
| 72 |
+
boundary_pos_weight = self.boundary_pos_weight.to(token_logits.device)
|
| 73 |
+
presence_pos_weight = self.presence_pos_weight.to(token_logits.device)
|
| 74 |
+
bce_boundary = nn.BCEWithLogitsLoss(reduction="none", pos_weight=boundary_pos_weight)
|
| 75 |
+
bce_presence = nn.BCEWithLogitsLoss(reduction="none", pos_weight=presence_pos_weight)
|
| 76 |
+
token_loss = bce_presence(token_logits, token_labels.float()) * mask
|
| 77 |
+
start_loss = bce_boundary(start_logits, start_positions.float()) * mask
|
| 78 |
+
end_loss = bce_boundary(end_logits, end_positions.float()) * mask
|
| 79 |
+
denom = mask.sum().clamp_min(1.0) * token_logits.shape[-1]
|
| 80 |
+
token_loss = token_loss.sum() / denom
|
| 81 |
+
boundary_loss = (start_loss.sum() + end_loss.sum()) / (2.0 * denom)
|
| 82 |
+
token_weight = float(getattr(self.config, "token_presence_weight", 1.0))
|
| 83 |
+
boundary_weight = float(getattr(self.config, "boundary_loss_weight", 1.0))
|
| 84 |
+
loss = token_weight * token_loss + boundary_weight * boundary_loss
|
| 85 |
+
|
| 86 |
+
return MultitaskSpanOutput(
|
| 87 |
+
loss=loss,
|
| 88 |
+
token_logits=token_logits,
|
| 89 |
+
start_logits=start_logits,
|
| 90 |
+
end_logits=end_logits,
|
| 91 |
+
)
|
onnx/model.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7810664f9e5918086c9128de9647bcf4f587248f35e3460e398c0e1238bc06cf
|
| 3 |
+
size 539089958
|
onnx/model.preprocessed.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:83191025f2ccd7b2f970a8fd3b8f22120bfdb5497f6f8be4df4ccc165e037a1b
|
| 3 |
+
size 539100128
|
onnx/model_quantized.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3d6bec2bc83956535708b57f7524f03cc4ed53a8b41ddf0aefd2bf10b099592b
|
| 3 |
+
size 411883593
|
onnx/onnx_export.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"source_model": "models/openmed-mliteclinical-irish-core-multitask-rc8g_cal2",
|
| 3 |
+
"onnx_path": "models/openmed-mliteclinical-irish-core-multitask-rc8g_cal2_onnx/model.onnx",
|
| 4 |
+
"task": "multitask-token-span-extraction",
|
| 5 |
+
"opset": 18,
|
| 6 |
+
"max_length": 256,
|
| 7 |
+
"output_names": [
|
| 8 |
+
"token_logits",
|
| 9 |
+
"start_logits",
|
| 10 |
+
"end_logits"
|
| 11 |
+
]
|
| 12 |
+
}
|
onnx/quantization.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"source_dir": "models/openmed-mliteclinical-irish-core-multitask-rc8g_cal2_onnx",
|
| 3 |
+
"input_model": "models/openmed-mliteclinical-irish-core-multitask-rc8g_cal2_onnx_q8/model.onnx",
|
| 4 |
+
"preprocessed_input_model": "models/openmed-mliteclinical-irish-core-multitask-rc8g_cal2_onnx_q8/model.preprocessed.onnx",
|
| 5 |
+
"output_model": "models/openmed-mliteclinical-irish-core-multitask-rc8g_cal2_onnx_q8/model_quantized.onnx",
|
| 6 |
+
"weight_type": "qint8",
|
| 7 |
+
"per_channel": true,
|
| 8 |
+
"reduce_range": false,
|
| 9 |
+
"preprocess_applied": true,
|
| 10 |
+
"op_types": [
|
| 11 |
+
"MatMul",
|
| 12 |
+
"Gemm",
|
| 13 |
+
"Attention"
|
| 14 |
+
],
|
| 15 |
+
"copied_assets": [
|
| 16 |
+
"models/openmed-mliteclinical-irish-core-multitask-rc8g_cal2_onnx/model.onnx",
|
| 17 |
+
"onnx_export.json",
|
| 18 |
+
"config.json",
|
| 19 |
+
"special_tokens_map.json",
|
| 20 |
+
"tokenizer.json",
|
| 21 |
+
"tokenizer_config.json",
|
| 22 |
+
"vocab.txt"
|
| 23 |
+
],
|
| 24 |
+
"format": "onnx_dynamic_quantized",
|
| 25 |
+
"task": "token-classification"
|
| 26 |
+
}
|
pyproject.toml
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[project]
|
| 2 |
+
name = "openmed-mliteclinical-irish-core-pii-rawonly"
|
| 3 |
+
version = "0.1.0"
|
| 4 |
+
description = "Raw-only Irish core PII release for OpenMed mLiteClinical"
|
| 5 |
+
requires-python = ">=3.10"
|
| 6 |
+
readme = "README.md"
|
| 7 |
+
license = { text = "Apache-2.0" }
|
| 8 |
+
dependencies = [
|
| 9 |
+
"transformers>=4.41.0",
|
| 10 |
+
"torch",
|
| 11 |
+
"numpy>=1.26.0",
|
| 12 |
+
"onnxruntime>=1.20.0",
|
| 13 |
+
"huggingface_hub>=0.36.0",
|
| 14 |
+
]
|
| 15 |
+
|
| 16 |
+
[tool.uv]
|
| 17 |
+
package = false
|
qa_config.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"release": "OpenMed-mLiteClinical-IrishCorePII-135M-v2-rc8",
|
| 3 |
+
"repo_id": "temsa/OpenMed-mLiteClinical-IrishCorePII-135M-v2-rc8",
|
| 4 |
+
"decoder": "raw_only_multitask_token_span",
|
| 5 |
+
"min_score": 0.5,
|
| 6 |
+
"recommended_backend": "onnx_q8_cpu",
|
| 7 |
+
"onnx_file": "onnx/model_quantized.onnx",
|
| 8 |
+
"full_example": "My PPSN is 1234567TW, my Eircode is D02 X285, and my phone is 087 123 4567.",
|
| 9 |
+
"notes": [
|
| 10 |
+
"No scanner or validator layer is required for release behavior.",
|
| 11 |
+
"Use the bundled inference scripts or import common.decode_token_presence_segments.",
|
| 12 |
+
"ONNX q8 is the recommended CPU path."
|
| 13 |
+
]
|
| 14 |
+
}
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cls_token": {
|
| 3 |
+
"content": "[CLS]",
|
| 4 |
+
"lstrip": false,
|
| 5 |
+
"normalized": false,
|
| 6 |
+
"rstrip": false,
|
| 7 |
+
"single_word": false
|
| 8 |
+
},
|
| 9 |
+
"mask_token": {
|
| 10 |
+
"content": "[MASK]",
|
| 11 |
+
"lstrip": false,
|
| 12 |
+
"normalized": false,
|
| 13 |
+
"rstrip": false,
|
| 14 |
+
"single_word": false
|
| 15 |
+
},
|
| 16 |
+
"pad_token": {
|
| 17 |
+
"content": "[PAD]",
|
| 18 |
+
"lstrip": false,
|
| 19 |
+
"normalized": false,
|
| 20 |
+
"rstrip": false,
|
| 21 |
+
"single_word": false
|
| 22 |
+
},
|
| 23 |
+
"sep_token": {
|
| 24 |
+
"content": "[SEP]",
|
| 25 |
+
"lstrip": false,
|
| 26 |
+
"normalized": false,
|
| 27 |
+
"rstrip": false,
|
| 28 |
+
"single_word": false
|
| 29 |
+
},
|
| 30 |
+
"unk_token": {
|
| 31 |
+
"content": "[UNK]",
|
| 32 |
+
"lstrip": false,
|
| 33 |
+
"normalized": false,
|
| 34 |
+
"rstrip": false,
|
| 35 |
+
"single_word": false
|
| 36 |
+
}
|
| 37 |
+
}
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"added_tokens_decoder": {
|
| 3 |
+
"0": {
|
| 4 |
+
"content": "[PAD]",
|
| 5 |
+
"lstrip": false,
|
| 6 |
+
"normalized": false,
|
| 7 |
+
"rstrip": false,
|
| 8 |
+
"single_word": false,
|
| 9 |
+
"special": true
|
| 10 |
+
},
|
| 11 |
+
"100": {
|
| 12 |
+
"content": "[UNK]",
|
| 13 |
+
"lstrip": false,
|
| 14 |
+
"normalized": false,
|
| 15 |
+
"rstrip": false,
|
| 16 |
+
"single_word": false,
|
| 17 |
+
"special": true
|
| 18 |
+
},
|
| 19 |
+
"101": {
|
| 20 |
+
"content": "[CLS]",
|
| 21 |
+
"lstrip": false,
|
| 22 |
+
"normalized": false,
|
| 23 |
+
"rstrip": false,
|
| 24 |
+
"single_word": false,
|
| 25 |
+
"special": true
|
| 26 |
+
},
|
| 27 |
+
"102": {
|
| 28 |
+
"content": "[SEP]",
|
| 29 |
+
"lstrip": false,
|
| 30 |
+
"normalized": false,
|
| 31 |
+
"rstrip": false,
|
| 32 |
+
"single_word": false,
|
| 33 |
+
"special": true
|
| 34 |
+
},
|
| 35 |
+
"103": {
|
| 36 |
+
"content": "[MASK]",
|
| 37 |
+
"lstrip": false,
|
| 38 |
+
"normalized": false,
|
| 39 |
+
"rstrip": false,
|
| 40 |
+
"single_word": false,
|
| 41 |
+
"special": true
|
| 42 |
+
}
|
| 43 |
+
},
|
| 44 |
+
"clean_up_tokenization_spaces": false,
|
| 45 |
+
"cls_token": "[CLS]",
|
| 46 |
+
"do_lower_case": false,
|
| 47 |
+
"extra_special_tokens": {},
|
| 48 |
+
"fix_mistral_regex": true,
|
| 49 |
+
"mask_token": "[MASK]",
|
| 50 |
+
"max_length": 512,
|
| 51 |
+
"model_max_length": 512,
|
| 52 |
+
"pad_token": "[PAD]",
|
| 53 |
+
"sep_token": "[SEP]",
|
| 54 |
+
"stride": 0,
|
| 55 |
+
"strip_accents": null,
|
| 56 |
+
"tokenize_chinese_chars": true,
|
| 57 |
+
"tokenizer_class": "DistilBertTokenizer",
|
| 58 |
+
"truncation_side": "right",
|
| 59 |
+
"truncation_strategy": "longest_first",
|
| 60 |
+
"unk_token": "[UNK]"
|
| 61 |
+
}
|
training_sources.json
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"release": "OpenMed-mLiteClinical-IrishCorePII-135M-v2-rc8",
|
| 3 |
+
"base_model": "OpenMed/OpenMed-PII-mLiteClinical-Base-135M-v1",
|
| 4 |
+
"public_baseline_reference": "temsa/OpenMed-mLiteClinical-IrishCorePII-135M-v2-rc7",
|
| 5 |
+
"task": "Irish core PII detection and masking in English and Irish Gaelic",
|
| 6 |
+
"coverage": [
|
| 7 |
+
"PPSN",
|
| 8 |
+
"ACCOUNT_NUMBER",
|
| 9 |
+
"BANK_ROUTING_NUMBER",
|
| 10 |
+
"CREDIT_DEBIT_CARD",
|
| 11 |
+
"PASSPORT_NUMBER",
|
| 12 |
+
"POSTCODE",
|
| 13 |
+
"PHONE_NUMBER",
|
| 14 |
+
"EMAIL",
|
| 15 |
+
"FIRST_NAME",
|
| 16 |
+
"LAST_NAME",
|
| 17 |
+
"SWIFT_BIC"
|
| 18 |
+
],
|
| 19 |
+
"architecture": {
|
| 20 |
+
"encoder_family": "DistilBERT-size token encoder from OpenMed mLiteClinical 135M",
|
| 21 |
+
"heads": [
|
| 22 |
+
"token_presence_head",
|
| 23 |
+
"typed_start_head",
|
| 24 |
+
"typed_end_head"
|
| 25 |
+
],
|
| 26 |
+
"decoder": "score-only token+boundary decoder with continuity and minimum-length priors",
|
| 27 |
+
"scanner_free": true,
|
| 28 |
+
"validator_free": true
|
| 29 |
+
},
|
| 30 |
+
"training_data": {
|
| 31 |
+
"published": [
|
| 32 |
+
"temsa/OpenMed-Irish-CorePII-TrainMix-v1",
|
| 33 |
+
"temsa/OpenMed-Irish-PPSN-Eircode-Spec-v1",
|
| 34 |
+
"joelniklaus/mapa",
|
| 35 |
+
"gretelai/synthetic_pii_finance_multilingual"
|
| 36 |
+
],
|
| 37 |
+
"local_component_sets": [
|
| 38 |
+
"irish_ppsn_weakctx_exact_v1",
|
| 39 |
+
"irish_ppsn_weakctx_permissive_v1",
|
| 40 |
+
"irish_ppsn_ga_punctless_v1",
|
| 41 |
+
"irish_ppsn_tfamily_v1",
|
| 42 |
+
"ppsn_recover_v4_mix"
|
| 43 |
+
]
|
| 44 |
+
},
|
| 45 |
+
"training": {
|
| 46 |
+
"epochs": 1.5,
|
| 47 |
+
"learning_rate": 3e-05,
|
| 48 |
+
"freeze_layers": 2,
|
| 49 |
+
"token_presence_weight": 1.0,
|
| 50 |
+
"boundary_loss_weight": 1.0,
|
| 51 |
+
"token_positive_weight": 4.0,
|
| 52 |
+
"span_positive_weight": 6.0,
|
| 53 |
+
"boundary_smoothing": 0.15
|
| 54 |
+
},
|
| 55 |
+
"papers": [
|
| 56 |
+
{
|
| 57 |
+
"title": "Split-NER",
|
| 58 |
+
"url": "https://aclanthology.org/2023.acl-short.36/"
|
| 59 |
+
},
|
| 60 |
+
{
|
| 61 |
+
"title": "SpanNER",
|
| 62 |
+
"url": "https://aclanthology.org/2021.acl-long.558/"
|
| 63 |
+
},
|
| 64 |
+
{
|
| 65 |
+
"title": "Boundary Smoothing for Named Entity Recognition",
|
| 66 |
+
"url": "https://aclanthology.org/2022.acl-long.490/"
|
| 67 |
+
},
|
| 68 |
+
{
|
| 69 |
+
"title": "TinyBERT",
|
| 70 |
+
"url": "https://aclanthology.org/2020.findings-emnlp.372/"
|
| 71 |
+
}
|
| 72 |
+
]
|
| 73 |
+
}
|
vocab.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|