alexgoldberg commited on
Commit
7425567
verified
1 Parent(s): 061a0f9

Upload best k-fold model (Fold 4, F1: 0.9102)

Browse files
Files changed (3) hide show
  1. README.md +164 -0
  2. kfold_results.json +36 -0
  3. pytorch_model.bin +3 -0
README.md ADDED
@@ -0,0 +1,164 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - he
4
+ license: mit
5
+ tags:
6
+ - named-entity-recognition
7
+ - token-classification
8
+ - hebrew
9
+ - historical-manuscripts
10
+ - joint-learning
11
+ - multi-task-learning
12
+ - k-fold-validation
13
+ datasets:
14
+ - custom
15
+ metrics:
16
+ - f1
17
+ - accuracy
18
+ library_name: transformers
19
+ pipeline_tag: token-classification
20
+ ---
21
+
22
+ # Hebrew Manuscript Joint NER Model v2
23
+
24
+ ## Model Description
25
+
26
+ This model performs **joint entity recognition and role classification** for Hebrew historical manuscripts. It simultaneously:
27
+ 1. **Named Entity Recognition (NER)**: Identifies person names in Hebrew text
28
+ 2. **Role Classification**: Classifies each person as Author, Copyist, or Other
29
+
30
+ **Key Features:**
31
+ - Multi-task learning architecture
32
+ - Trained on Hebrew manuscript catalog data (MARC records)
33
+ - Uses distant supervision from structured metadata
34
+ - Optimized for historical Hebrew text
35
+ - Robust k-fold cross-validation
36
+
37
+
38
+ ## K-Fold Cross-Validation Results
39
+
40
+ This model was trained using **5-fold cross-validation** for robust evaluation.
41
+
42
+ ### Aggregate Performance
43
+
44
+ | Metric | Mean | Std Dev | Min | Max |
45
+ |--------|------|---------|-----|-----|
46
+ | **NER F1** | **0.9080** | 卤0.0035 | 0.9011 | 0.9102 |
47
+ | **Classification Accuracy** | **1.0000** | 卤0.0000 | - | - |
48
+
49
+ ### Per-Fold Results
50
+
51
+ - **Fold 1**: NER F1 = 0.9011, Class Acc = 1.0000
52
+ - **Fold 2**: NER F1 = 0.9089, Class Acc = 1.0000
53
+ - **Fold 3**: NER F1 = 0.9096, Class Acc = 1.0000
54
+ - **Fold 4**: NER F1 = 0.9102, Class Acc = 1.0000
55
+ - **Fold 5**: NER F1 = 0.9100, Class Acc = 1.0000
56
+
57
+ **Best Model**: Fold 4 (NER F1: 0.9102)
58
+
59
+
60
+ ## Model Architecture
61
+
62
+ - **Base Model**: [dicta-il/dictabert](https://huggingface.co/dicta-il/dictabert)
63
+ - **Architecture**: Joint multi-task learning
64
+ - NER head: Token classification (B-PERSON, I-PERSON, O)
65
+ - Role classification head: Sequence classification (AUTHOR, COPYIST, OTHER)
66
+ - **Training**: 5-fold cross-validation with early stopping
67
+ - **Regularization**: Dropout (0.3), Weight decay (0.01)
68
+
69
+ ## Intended Use
70
+
71
+ ### Primary Use Cases
72
+ - Extracting person names from Hebrew manuscript descriptions
73
+ - Identifying roles of people mentioned in manuscripts
74
+ - Building knowledge graphs of Hebrew manuscript creators
75
+ - Digital humanities research on Hebrew manuscripts
76
+
77
+ ### Example Usage
78
+
79
+ ```python
80
+ from transformers import AutoTokenizer, AutoModel
81
+ import torch
82
+
83
+ # Load model and tokenizer
84
+ tokenizer = AutoTokenizer.from_pretrained("alexgoldberg/hebrew-manuscript-joint-ner-v2")
85
+ model = AutoModel.from_pretrained("alexgoldberg/hebrew-manuscript-joint-ner-v2")
86
+
87
+ # Example text (Hebrew)
88
+ text = "讛住驻专 谞讻转讘 注诇 讬讚讬 专讘讬 诪砖讛 讘谉 诪讬诪讜谉"
89
+ tokens = tokenizer(text, return_tensors="pt")
90
+
91
+ # Get predictions
92
+ with torch.no_grad():
93
+ outputs = model(**tokens)
94
+ # outputs contains both NER and role classification logits
95
+ ```
96
+
97
+ ## Training Data
98
+
99
+ - **Source**: Hebrew manuscript catalog records (MARC format)
100
+ - **Size**: ~10,000 samples
101
+ - **Annotation**: Distant supervision from structured metadata fields
102
+ - **Languages**: Hebrew (historical and modern)
103
+ - **Domain**: Manuscript descriptions, colophons, catalog records
104
+
105
+ ## Training Procedure
106
+
107
+ ### Hyperparameters
108
+ - **Epochs**: 10 (with early stopping, patience=3)
109
+ - **Batch Size**: 4
110
+ - **Learning Rate**: 2e-5
111
+ - **Optimizer**: AdamW
112
+ - **Dropout**: 0.3
113
+ - **Weight Decay**: 0.01
114
+ - **Lambda Weight**: 0.5 (for multi-task loss balancing)
115
+
116
+ ### Data Split
117
+ - **K-Fold**: 5-fold stratified cross-validation
118
+ - **Stratification**: By number of persons per sample
119
+ - **Train/Val per fold**: 90/10 split
120
+
121
+ ## Evaluation
122
+
123
+ ### Metrics
124
+ - **NER**: Precision, Recall, F1 (seqeval)
125
+ - **Classification**: Accuracy
126
+ - **Combined**: Geometric mean of NER F1 and Classification Accuracy
127
+
128
+ ### Validation Strategy
129
+ 5-fold cross-validation ensures robust performance estimates and reduces overfitting to a single train/test split.
130
+
131
+ ## Limitations
132
+
133
+ - Optimized for Hebrew manuscript descriptions (may not generalize to other Hebrew text types)
134
+ - Person names must follow historical Hebrew naming conventions
135
+ - Limited to three role categories (Author, Copyist, Other)
136
+ - Trained on catalog data (may not work well on manuscript images/OCR)
137
+
138
+ ## Ethical Considerations
139
+
140
+ - Model trained on historical cultural heritage data
141
+ - Should be used to assist, not replace, expert manuscript catalogers
142
+ - Potential biases from historical naming conventions and catalog practices
143
+
144
+ ## Citation
145
+
146
+ If you use this model, please cite:
147
+
148
+ ```bibtex
149
+ @misc{hebrew-manuscript-joint-ner-v2,
150
+ author = {Goldberg, Alexander},
151
+ title = {Hebrew Manuscript Joint NER Model v2},
152
+ year = {2025},
153
+ publisher = {HuggingFace},
154
+ howpublished = {\url{https://huggingface.co/alexgoldberg/hebrew-manuscript-joint-ner-v2}}
155
+ }
156
+ ```
157
+
158
+ ## Model Card Authors
159
+
160
+ Alexander Goldberg
161
+
162
+ ## Model Card Contact
163
+
164
+ For questions or issues, please open an issue on the model repository.
kfold_results.json ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "n_folds": 5,
3
+ "ner_f1_mean": 0.9079608298355216,
4
+ "ner_f1_std": 0.0034783587137207097,
5
+ "ner_f1_min": 0.9010667224430035,
6
+ "ner_f1_max": 0.9102049440101416,
7
+ "class_acc_mean": 1.0,
8
+ "class_acc_std": 0.0,
9
+ "per_fold": [
10
+ {
11
+ "fold": 1,
12
+ "ner_f1": 0.9010667224430035,
13
+ "class_acc": 1.0
14
+ },
15
+ {
16
+ "fold": 2,
17
+ "ner_f1": 0.9088618227635447,
18
+ "class_acc": 1.0
19
+ },
20
+ {
21
+ "fold": 3,
22
+ "ner_f1": 0.9096222083072428,
23
+ "class_acc": 1.0
24
+ },
25
+ {
26
+ "fold": 4,
27
+ "ner_f1": 0.9102049440101416,
28
+ "class_acc": 1.0
29
+ },
30
+ {
31
+ "fold": 5,
32
+ "ner_f1": 0.9100484516536759,
33
+ "class_acc": 1.0
34
+ }
35
+ ]
36
+ }
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:86fb10a70515811d85518b8555c6af26e125d35977a3dba0a19ccf0fc2247857
3
+ size 2219554257