Glazkov commited on
Commit
1febaec
·
verified ·
1 Parent(s): 4e9f76a

Upload ModernBERT entity infilling model - 2025-10-17 09:42:43

Browse files
Files changed (1) hide show
  1. README.md +115 -0
README.md ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ base_model: answerdotai/ModernBERT-base
4
+ tags:
5
+ - modernbert
6
+ - entity-infilling
7
+ - text-summarization
8
+ - masked-modeling
9
+ - pytorch
10
+ library_name: transformers
11
+ datasets:
12
+ - cnn_dailymail
13
+ model-index:
14
+ - name: Glazkov/sum-entity-infilling
15
+ results:
16
+ - task:
17
+ type: entity-infilling
18
+ name: Entity Infilling
19
+ dataset:
20
+ name: cnn_dailymail
21
+ type: cnn_dailymail
22
+ metrics:
23
+ - name: Entity Recall
24
+ type: entity_recall
25
+ value: TBD
26
+ ---
27
+
28
+ # Glazkov/sum-entity-infilling
29
+
30
+ This model is a fine-tuned version of [answerdotai/ModernBERT-base](https://huggingface.co/answerdotai/ModernBERT-base) trained on the [cnn_dailymail](https://huggingface.co/datasets/cnn_dailymail) dataset for entity infilling tasks.
31
+
32
+ ## Model Description
33
+
34
+ The model is designed to reconstruct masked entities in text using summary context. It was trained using a sequence-to-sequence approach where the model learns to predict original entities that have been replaced with `<mask>` tokens in the source text.
35
+
36
+ ## Intended Uses & Limitations
37
+
38
+ **Intended Uses:**
39
+ - Entity reconstruction in summarization
40
+ - Text completion and infilling
41
+ - Research in masked language modeling
42
+ - Educational purposes
43
+
44
+ **Limitations:**
45
+ - Trained primarily on news article data
46
+ - May not perform well on highly technical or domain-specific content
47
+ - Performance varies with entity length and context
48
+
49
+ ## Training Details
50
+
51
+ ### Training Procedure
52
+
53
+
54
+ ### Evaluation Results
55
+ The model was evaluated using entity recall metrics on a validation set from the CNN/DailyMail dataset.
56
+
57
+ **Metrics:**
58
+ - Entity Recall: Percentage of correctly reconstructed entities
59
+ - Token Accuracy: Token-level prediction accuracy
60
+ - Exact Match: Full sequence reconstruction accuracy
61
+
62
+ ## Usage
63
+
64
+ ```python
65
+ from transformers import AutoTokenizer, AutoModelForMaskedLM
66
+ from src.train.inference import EntityInfillingInference
67
+
68
+ # Load model and tokenizer
69
+ tokenizer = AutoTokenizer.from_pretrained("your-username/Glazkov/sum-entity-infilling")
70
+ model = AutoModelForMaskedLM.from_pretrained("your-username/Glazkov/sum-entity-infilling")
71
+
72
+ # Initialize inference
73
+ inference = EntityInfillingInference(
74
+ model_path="your-username/Glazkov/sum-entity-infilling",
75
+ device="cuda" # or "cpu"
76
+ )
77
+
78
+ # Example inference
79
+ summary = "Membership gives the ICC jurisdiction over alleged crimes..."
80
+ masked_text = "(<mask> officially became the 123rd member of the International Criminal Court..."
81
+
82
+ predictions = inference.predict_masked_entities(
83
+ summary=summary,
84
+ masked_text=masked_text
85
+ )
86
+ ```
87
+
88
+ ## Training Configuration
89
+
90
+ This model was trained using the following configuration:
91
+ - Base Model: answerdotai/ModernBERT-base
92
+ - Dataset: cnn_dailymail
93
+ - Task: Entity Infilling
94
+ - Framework: PyTorch with Accelerate
95
+ - Training Date: 2025-10-17
96
+
97
+ For more details about the training process, see the [training configuration](training_config.txt) file.
98
+
99
+ ## Model Architecture
100
+
101
+ The model uses ModernBERT architecture with:
102
+ - 12 transformer layers
103
+ - Hidden size: 768
104
+ - Vocabulary: Custom with `<mask>` token support
105
+ - Maximum sequence length: 512 tokens
106
+
107
+ ## Acknowledgments
108
+
109
+ - [Hugging Face Transformers](https://github.com/huggingface/transformers) for the model architecture
110
+ - [CNN/DailyMail dataset](https://huggingface.co/datasets/cnn_dailymail) for training data
111
+ - [Answer.AI](https://huggingface.co/answerdotai) for the ModernBERT base model
112
+
113
+ ## License
114
+
115
+ This model is licensed under the MIT License.