MatteoCargnelutti commited on
Commit
e9232c8
·
0 Parent(s):

Squashing commit

Browse files
Files changed (9) hide show
  1. .gitattributes +36 -0
  2. README.md +86 -0
  3. config.json +5 -0
  4. eval.txt +12 -0
  5. model.safetensors +3 -0
  6. modules.json +14 -0
  7. pipeline.skops +3 -0
  8. tokenizer.json +0 -0
  9. training-set-stats.json +1 -0
.gitattributes ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
36
+ pipeline.skops filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: minishlab/potion-base-32m
3
+ library_name: model2vec
4
+ license: mit
5
+ tags:
6
+ - model2vec
7
+ - static-embeddings
8
+ - text-classification
9
+ - newspaper-classification
10
+ - crop-classification
11
+ - historical-newspapers
12
+ - newspapers
13
+ datasets:
14
+ - institutional-newspapers
15
+ ---
16
+
17
+ # 📰 Institutional Newspapers Crop Classifier (Text)
18
+
19
+ A text-based classifier that categorizes crops extracted from historical newspaper scans into high-level categories. This model is a [Model2Vec](https://github.com/MinishLab/model2vec) fine-tune of [minishlab/potion-base-32m](https://huggingface.co/minishlab/potion-base-32m) with a classifier head, which makes it light and efficient.
20
+
21
+ We recommend using this model alongside [`institutional/institutional-newspapers-crop-classifier-image-yolo26m-cls`](https://huggingface.co/institutional/institutional-newspapers-crop-classifier-image-yolo26m-cls), as neither visual nor textual signal alone is sufficient to classify newspaper crops accurately.
22
+
23
+ **More information:**
24
+ - 📄 [Institutional Newspapers: Boston Public Library technical report](TODO)
25
+
26
+ **See also:**
27
+ - 🗂️ [Institutional Newspapers Collection](https://huggingface.co/collections/institutional/institutional-newspapers)
28
+ - ⚙️ [Pipeline](https://github.com/institutional/institutional-newspapers-pipeline)
29
+ - 🤖 [Segmentation model](https://huggingface.co/institutional/institutional-newspapers-segmenter-yolo26x)
30
+ - 🤖 [Crop-type image classifier](https://huggingface.co/institutional/institutional-newspapers-crop-classifier-image-yolo26m-cls)
31
+
32
+ The Institutional Data Initiative at the Harvard Law School Library works with knowledge institutions—from libraries and museums to cultural groups and government agencies—to refine and publish their collections as data. [Reach out to collaborate on your collections](https://institutional.org/).
33
+
34
+ ## Evaluation results
35
+
36
+ Evaluated on a held-out test set of 31,015 crops:
37
+
38
+ | Class | Precision | Recall | F1-Score | Support |
39
+ |---|---|---|---|---|
40
+ | Advertisement | 0.95 | 0.94 | 0.95 | 11,244 |
41
+ | Cartoon | 0.85 | 0.57 | 0.68 | 430 |
42
+ | Content | 0.90 | 0.96 | 0.93 | 11,245 |
43
+ | Masthead, nameplate or running head | 0.93 | 0.86 | 0.89 | 2,250 |
44
+ | Photograph or illustration | 0.63 | 0.38 | 0.48 | 551 |
45
+ | Section heading | 0.94 | 0.93 | 0.94 | 5,295 |
46
+
47
+ | Metric | Score |
48
+ |---|---|
49
+ | **Accuracy** | 0.92 |
50
+ | **Macro avg F1** | 0.81 |
51
+ | **Weighted avg F1** | 0.92 |
52
+
53
+ ## Training data
54
+
55
+ This model was trained on part of **Boston Public Library's** newspapers collection.
56
+
57
+ - **Total annotated crops**: 185,900
58
+ - **Classes**: 6
59
+ - **Split**: ~67% train / ~17% val / ~17% test
60
+
61
+ ## Usage
62
+
63
+ ```python
64
+ from model2vec.inference import StaticModelPipeline
65
+
66
+ model_name = "institutional/institutional-newspapers-crop-classifier-text-model2vec"
67
+ model = StaticModelPipeline.from_pretrained(model_name)
68
+
69
+ texts = ["CLASSIFIED ADVERTISING — Rooms for rent, furnished apartments..."]
70
+ predictions = model.predict(texts, max_length=None)
71
+
72
+ print(predictions)
73
+ # ['Advertisement']
74
+ ```
75
+
76
+ ### Recommended inference parameters
77
+
78
+ | Parameter | Value | Note |
79
+ |---|---|---|
80
+ | `max_length` | `None` | Do not truncate input text |
81
+
82
+ ## Citation
83
+
84
+ ```bibtex
85
+ TODO
86
+ ```
config.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "normalize": true,
3
+ "embedding_dtype": "float32",
4
+ "vocabulary_quantization": 63091
5
+ }
eval.txt ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ precision recall f1-score support
2
+
3
+ Advertisement 0.95 0.94 0.95 11244
4
+ Cartoon 0.85 0.57 0.68 430
5
+ Content 0.90 0.96 0.93 11245
6
+ Masthead, nameplate or running head 0.93 0.86 0.89 2250
7
+ Photograph or illustration 0.63 0.38 0.48 551
8
+ Section heading 0.94 0.93 0.94 5295
9
+
10
+ accuracy 0.92 31015
11
+ macro avg 0.87 0.77 0.81 31015
12
+ weighted avg 0.92 0.92 0.92 31015
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6b32ad2fcbb9e7c58d8d9d89a573196a1877c9875c84f99792eb772d9cb9fd11
3
+ size 129967700
modules.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "idx": 0,
4
+ "name": "0",
5
+ "path": ".",
6
+ "type": "sentence_transformers.models.StaticEmbedding"
7
+ },
8
+ {
9
+ "idx": 1,
10
+ "name": "1",
11
+ "path": "1_Normalize",
12
+ "type": "sentence_transformers.models.Normalize"
13
+ }
14
+ ]
pipeline.skops ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bd00345d84fdffc8c1f516ba458fbc55ca7c933364a7971523a0eb0f72c45fc0
3
+ size 7511210
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
training-set-stats.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"train": {"Content": 52466, "Section heading": 11762, "Advertisement": 52475, "Photograph or illustration": 1223, "Cartoon": 947, "Masthead, nameplate or running head": 5022, "Empty": 0}, "val": {"Content": 11245, "Section heading": 5295, "Advertisement": 11244, "Photograph or illustration": 538, "Cartoon": 422, "Masthead, nameplate or running head": 2246, "Empty": 0}, "test": {"Content": 11245, "Section heading": 5295, "Advertisement": 11244, "Photograph or illustration": 551, "Cartoon": 430, "Masthead, nameplate or running head": 2250, "Empty": 0}}