eilamc14 commited on
Commit
39b4798
·
verified ·
1 Parent(s): 57d4f7f

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +176 -127
README.md CHANGED
@@ -1,177 +1,244 @@
1
  ---
2
  library_name: transformers
3
- base_model:
4
- - facebook/bart-base
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  ---
6
 
7
  # Model Card for Model ID
8
 
9
- <!-- Provide a quick summary of what the model is/does. -->
10
-
11
-
12
 
13
  ## Model Details
14
 
15
  ### Model Description
16
 
17
- <!-- Provide a longer summary of what this model is. -->
18
-
19
- This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
20
 
21
- - **Developed by:** [More Information Needed]
22
- - **Funded by [optional]:** [More Information Needed]
23
- - **Shared by [optional]:** [More Information Needed]
24
- - **Model type:** [More Information Needed]
25
- - **Language(s) (NLP):** [More Information Needed]
26
- - **License:** [More Information Needed]
27
- - **Finetuned from model [optional]:** [More Information Needed]
28
 
29
- ### Model Sources [optional]
30
 
31
- <!-- Provide the basic links for the model. -->
32
-
33
- - **Repository:** [More Information Needed]
34
- - **Paper [optional]:** [More Information Needed]
35
- - **Demo [optional]:** [More Information Needed]
36
 
37
  ## Uses
38
 
39
- <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
40
-
41
  ### Direct Use
42
 
43
- <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
44
 
45
- [More Information Needed]
 
46
 
47
- ### Downstream Use [optional]
 
 
 
48
 
49
- <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
50
 
51
- [More Information Needed]
 
 
 
 
 
 
 
52
 
53
  ### Out-of-Scope Use
54
 
55
- <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
 
 
 
 
56
 
57
- [More Information Needed]
58
 
59
  ## Bias, Risks, and Limitations
60
 
61
- <!-- This section is meant to convey both technical and sociotechnical limitations. -->
 
62
 
63
- [More Information Needed]
 
 
 
 
 
 
 
64
 
65
- ### Recommendations
66
 
67
- <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
68
 
69
- Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
 
 
 
70
 
71
  ## How to Get Started with the Model
72
 
73
- Use the code below to get started with the model.
74
 
75
- [More Information Needed]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
 
77
  ## Training Details
78
 
79
  ### Training Data
80
 
81
- <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
82
-
83
- [More Information Needed]
84
 
85
  ### Training Procedure
86
 
87
- <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
 
 
 
 
 
 
 
88
 
89
- #### Preprocessing [optional]
90
 
91
- [More Information Needed]
92
 
 
93
 
94
- #### Training Hyperparameters
 
 
 
95
 
96
- - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
 
 
 
97
 
98
- #### Speeds, Sizes, Times [optional]
 
 
99
 
100
- <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
101
 
102
- [More Information Needed]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
 
104
  ## Evaluation
105
 
106
- <!-- This section describes the evaluation protocols and provides the results. -->
107
-
108
- ### Testing Data, Factors & Metrics
109
-
110
- #### Testing Data
111
-
112
- <!-- This should link to a Dataset Card if possible. -->
113
-
114
- [More Information Needed]
115
-
116
- #### Factors
117
-
118
- <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
119
-
120
- [More Information Needed]
121
-
122
- #### Metrics
123
-
124
- <!-- These are the evaluation metrics being used, ideally with a description of why. -->
125
-
126
- [More Information Needed]
 
 
 
 
 
 
127
 
128
  ### Results
129
 
130
- [More Information Needed]
131
-
132
- #### Summary
133
-
134
-
135
-
136
- ## Model Examination [optional]
137
 
138
- <!-- Relevant interpretability work for the model goes here -->
139
-
140
- [More Information Needed]
141
 
142
  ## Environmental Impact
143
 
144
- <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
145
-
146
- Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
147
-
148
- - **Hardware Type:** [More Information Needed]
149
- - **Hours used:** [More Information Needed]
150
- - **Cloud Provider:** [More Information Needed]
151
- - **Compute Region:** [More Information Needed]
152
- - **Carbon Emitted:** [More Information Needed]
153
-
154
- ## Technical Specifications [optional]
155
-
156
- ### Model Architecture and Objective
157
-
158
- [More Information Needed]
159
-
160
- ### Compute Infrastructure
161
-
162
- [More Information Needed]
163
-
164
- #### Hardware
165
-
166
- [More Information Needed]
167
-
168
- #### Software
169
-
170
- [More Information Needed]
171
-
172
- ## Citation [optional]
173
 
174
- <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
175
 
176
  **BibTeX:**
177
 
@@ -179,22 +246,4 @@ Carbon emissions can be estimated using the [Machine Learning Impact calculator]
179
 
180
  **APA:**
181
 
182
- [More Information Needed]
183
-
184
- ## Glossary [optional]
185
-
186
- <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
187
-
188
- [More Information Needed]
189
-
190
- ## More Information [optional]
191
-
192
- [More Information Needed]
193
-
194
- ## Model Card Authors [optional]
195
-
196
- [More Information Needed]
197
-
198
- ## Model Card Contact
199
-
200
  [More Information Needed]
 
1
  ---
2
  library_name: transformers
3
+ license: apache-2.0
4
+ base_model: facebook/bart-base
5
+ datasets:
6
+ - eilamc14/wikilarge-clean
7
+ language:
8
+ - en
9
+ tags:
10
+ - bart
11
+ - text-simplification
12
+ - WikiLarge
13
+ model-index:
14
+ - name: bart-base-text-simplification
15
+ results:
16
+ - task:
17
+ type: text2text-generation
18
+ name: Text Simplification
19
+ dataset:
20
+ name: WikiLarge Cleaned
21
+ type: eilamc14/wikilarge-clean
22
+ split: test
23
+ metrics:
24
+ - type: SARI
25
+ value: 36.13
26
+ - type: FKGL
27
+ value: 8.50
28
+ - type: BERTScore
29
+ value: 85.57
30
+ - type: LENS
31
+ value: 43.88
32
  ---
33
 
34
  # Model Card for Model ID
35
 
36
+ This is one of the models fine-tuned on text simplification for [Simplify This](https://github.com/eilamc14/Simplify-This) project.
 
 
37
 
38
  ## Model Details
39
 
40
  ### Model Description
41
 
42
+ Fine-tuned **sequence-to-sequence (encoder–decoder) Transformer** for **English text simplification**.
43
+ Trained on the dataset **`eilamc14/wikilarge-clean`** (cleaned WikiLarge-style pairs).
 
44
 
45
+ - **Model type:** Seq2Seq Transformer (encoder–decoder)
46
+ - **Language (NLP):** English
47
+ - **License:** `apache-2.0`
48
+ - **Finetuned from model:** `facebook/bart-base`
 
 
 
49
 
50
+ ### Model Sources
51
 
52
+ - **Repository (code):** https://github.com/eilamc14/Simplify-This
53
+ - **Dataset:** https://huggingface.co/datasets/eilamc14/wikilarge-clean
54
+ - **Paper [optional]:**
55
+ - **Demo [optional]:**
 
56
 
57
  ## Uses
58
 
 
 
59
  ### Direct Use
60
 
61
+ The model is intended for **English text simplification**.
62
 
63
+ - **Input format:** `Simplify: <complex sentence>`
64
+ - **Output:** `<simplified sentence>`
65
 
66
+ **Typical uses**
67
+ - Research on automatic text simplification
68
+ - Benchmarking against other simplification systems
69
+ - Demos/prototypes that require simpler English rewrites
70
 
71
+ ### Downstream Use
72
 
73
+ This repository already contains a **fine-tuned** model specialized for text simplification.
74
+
75
+ Further fine-tuning is **optional** and mainly relevant when:
76
+ - Adapting to a markedly different domain (e.g., medical/legal/news)
77
+ - Addressing specific failure modes (e.g., over/under-simplification, factual drops)
78
+ - Distilling/quantizing for deployment constraints
79
+
80
+ When fine-tuning further, keep the same input convention: `Simplify: <...>`.
81
 
82
  ### Out-of-Scope Use
83
 
84
+ Not intended for:
85
+ - Tasks unrelated to simplification (dialogue, translation etc.)
86
+ - Production use without additional safety filtering (no toxicity/bias mitigation)
87
+ - Languages other than English
88
+ - High-stakes settings (legal/medical advice, safety-critical decisions)
89
 
 
90
 
91
  ## Bias, Risks, and Limitations
92
 
93
+ The model was trained on **Wikipedia and Simple English Wikipedia** alignments (via WikiLarge).
94
+ As a result, it inherits the characteristics and limitations of this data:
95
 
96
+ - **Domain bias:** Simplifications may reflect encyclopedic style; performance may degrade on informal, technical, or domain-specific text (e.g., medical/legal/news).
97
+ - **Content bias:** Wikipedia content itself contains biases in coverage, cultural perspective, and phrasing. Simplified outputs may reflect or amplify these.
98
+ - **Simplification quality:** The model may:
99
+ - Over-simplify (drop important details)
100
+ - Under-simplify (retain complex phrasing)
101
+ - Produce ungrammatical or awkward rephrasings
102
+ - **Language limitation:** Only suitable for English. Applying to other languages is unsupported.
103
+ - **Safety limitation:** The model has not been aligned to avoid toxic, biased, or harmful content. If the input text contains such content, the output may reproduce or modify it without safeguards.
104
 
 
105
 
106
+ ### Recommendations
107
 
108
+ - **Evaluation required:** Always evaluate the model in the target domain before deployment. Benchmark simplification quality (e.g., with SARI, FKGL, BERTScore, LENS, human evaluation).
109
+ - **Human oversight:** Use human-in-the-loop review for applications where meaning preservation is critical (education, accessibility tools, etc.).
110
+ - **Attribution:** Preserve source attribution where required (Wikipedia → CC BY-SA).
111
+ - **Not for high-stakes use:** Avoid legal, medical, or safety-critical applications without extensive validation and domain adaptation.
112
 
113
  ## How to Get Started with the Model
114
 
115
+ Load the model and tokenizer directly from the Hugging Face Hub:
116
 
117
+ ```python
118
+ from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
119
+
120
+ model_id = "eilamc14/bart-base-text-simplification"
121
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
122
+ model = AutoModelForSeq2SeqLM.from_pretrained(model_id)
123
+
124
+ # Example input
125
+ PREFIX = "Simplify: "
126
+ text = "The committee deemed the proposal unnecessarily complicated."
127
+
128
+ # Tokenize and generate
129
+ inputs = tokenizer(PREFIX+text, return_tensors="pt")
130
+ outputs = model.generate(**inputs, max_new_tokens=64, num_beams=4)
131
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
132
+ ```
133
 
134
  ## Training Details
135
 
136
  ### Training Data
137
 
138
+ [WikiLarge-clean](https://huggingface.co/datasets/eilamc14/wikilarge-clean) Dataset
 
 
139
 
140
  ### Training Procedure
141
 
142
+ - **Hardware:** NVIDIA L4 GPU on Google Colab
143
+ - **Objective:** Standard sequence-to-sequence cross-entropy loss
144
+ - **Training type:** Full fine-tuning of all parameters (no LoRA/PEFT used)
145
+ - **Batching:** Dynamic padding with Hugging Face `Trainer` / PyTorch DataLoader
146
+ - **Evaluation:** Monitored on the `validation` split with metrics (SARI and identical_ratio)
147
+ - **Stopping criteria:** Early stopping CallBack based on validation performance
148
+
149
+ #### Preprocessing
150
 
151
+ The dataset was preprocessed by prefixing each source sentence with **"Simplify: "** and tokenizing both the source (inputs) and target (labels).
152
 
153
+ #### Memory & Checkpointing
154
 
155
+ To reduce VRAM during training, gradient checkpointing was enabled and the KV cache was disabled:
156
 
157
+ ```python
158
+ model.config.use_cache = False # required when using gradient checkpointing
159
+ model.gradient_checkpointing_enable() # saves memory at the cost of extra compute
160
+ ```
161
 
162
+ **Notes**
163
+ - Disabling `use_cache` avoids warnings/conflicts with gradient checkpointing and reduces memory usage in the forward pass.
164
+ - Gradient checkpointing trades **GPU memory ↓** for **training speed ↓** (extra recomputation).
165
+ - For **inference/evaluation**, re-enable the cache for faster generation:
166
 
167
+ ```python
168
+ model.config.use_cache = True
169
+ ```
170
 
171
+ #### Training Hyperparameters
172
 
173
+ The models were trained with Hugging Face `Seq2SeqTrainingArguments`.
174
+ Hyperparameters varied slightly across models and runs to optimize, and full logs (batch size, steps, exact LR schedule) were not preserved.
175
+ Below are the **typical defaults** used:
176
+
177
+ - **Epochs:** 5
178
+ - **Evaluation strategy:** every 300 steps
179
+ - **Save strategy:** every 300 steps (keep best model, `eval_loss` as criterion)
180
+ - **Learning rate:** ~3e-5
181
+ - **Batch size:** ~8-64 , depends on model size
182
+ - **Optimizer:** `adamw_torch_fused`
183
+ - **Precision:** bf16
184
+ - **Generation config (during eval):** `max_length=128`, `num_beams=4`, `predict_with_generate=True`
185
+ - **Other settings:**
186
+ - Weight decay: 0.01
187
+ - Label smoothing: 0.1
188
+ - Warmup ratio: 0.1
189
+ - Max grad norm: 0.5
190
+ - Dataloader workers: 8 (L4 GPU)
191
+
192
+ > Because hyperparameters were adjusted between runs and not all were logged, exact reproduction may differ slightly.
193
 
194
  ## Evaluation
195
 
196
+ ### Testing Data
197
+
198
+ - [**ASSET**](https://huggingface.co/datasets/facebook/asset) (test subset)
199
+ - [**MEDEASI**](https://huggingface.co/datasets/cbasu/Med-EASi) (test subset)
200
+ - [**OneStopEnglish**](https://github.com/nishkalavallabhi/OneStopEnglishCorpus) (advanced → elementary)
201
+
202
+ ### Metrics
203
+
204
+ - **Identical ratio** — share of outputs identical to the source, both normalized by basic, language-agnostic: strip, NFKC, collapse spaces
205
+ - **Identical ratio (ci)** — case insensitive identical ratio
206
+ - **SARI** — main simplification metric (higher is better)
207
+ - **FKGL** — readability grade level (lower is simpler)
208
+ - **BERTScore (F1)** semantic similarity (higher is better)
209
+ - **LENS** — composite simplification quality score (higher is better)
210
+
211
+ ### Generation Arguments
212
+
213
+ ```python
214
+ gen_args = dict(
215
+ max_new_tokens=64,
216
+ num_beams=4,
217
+ length_penalty=1.0,
218
+ no_repeat_ngram_size=3,
219
+ early_stopping=True,
220
+ do_sample=False,
221
+ )
222
+ ```
223
 
224
  ### Results
225
 
226
+ | Dataset | Identical ratio | Identical ratio (ci) | SARI | FKGL | BERTScore | LENS |
227
+ |---|---:|---:|---:|---:|---:|---:|
228
+ | **ASSET** | 0.00 | 0.00 | 36.13 | 8.50 | 85.57 | 43.88 |
229
+ | **MEDEASI** | 0.02 | 0.02 | 33.47 | 10.49 | 44.16 | 35.33 |
230
+ | **OneStopEnglish** | 0.00 | 0.00 | 37.45 | 8.08 | 75.46 | 41.18 |
 
 
231
 
 
 
 
232
 
233
  ## Environmental Impact
234
 
235
+ - **Hardware Type:** Single NVIDIA L4 GPU (Google Colab)
236
+ - **Hours used:** Approx. 5–10
237
+ - **Cloud Provider:** Google Cloud (via Colab)
238
+ - **Compute Region:** Unknown (Google Colab dynamic allocation)
239
+ - **Carbon Emitted:** Estimated to be very low (< a few kg CO₂eq), since training was limited to a single GPU for a small number of hours.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
240
 
241
+ ## Citation
242
 
243
  **BibTeX:**
244
 
 
246
 
247
  **APA:**
248
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
249
  [More Information Needed]