DANGDOCAO commited on
Commit
fa7f8fc
·
verified ·
1 Parent(s): b505f51
Files changed (1) hide show
  1. README.md +285 -0
README.md ADDED
@@ -0,0 +1,285 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # HVU_QA
2
+
3
+ **HVU_QA** is a project dedicated to sharing datasets and tools for **Question Generation Processing (NLP)**, developed and maintained by the research team at **Hung Vuong University (HVU), Phu Tho, Vietnam**.
4
+ This project is supported by **Hung Vuong University, Phu Tho, Vietnam**, with the aim of advancing research and applications in low-resource language processing, particularly for the Vietnamese language.
5
+
6
+ ---
7
+
8
+ ## 📚 Overview
9
+
10
+ This repository enables you to:
11
+
12
+ 1. Fine-tune the [VietAI/vit5-base](https://huggingface.co/datasets/DANGDOCAO/GeneratingQuestions) model on your own GQ dataset.
13
+ 2. Generate multiple, diverse questions given a user-provided text passage (context).
14
+
15
+ ---
16
+
17
+ ## 📁 Datasets
18
+
19
+ * Built following the **SQuAD v2.0 standard**, ensuring compatibility with NLP pipelines.
20
+ * Includes tens of thousands of high-quality **Question–Context–Answer triples (QCA)**.
21
+ * Suitable for both **training** and **evaluation**.
22
+
23
+ ---
24
+
25
+ ## 📁 Vietnamese Question Generation Tool
26
+
27
+ A **command-line tool** for:
28
+
29
+ * **Fine-tuning** a question generation model.
30
+ * **Automatically generating questions** from Vietnamese text.
31
+
32
+ Built on **Hugging Face Transformers (VietAI/vit5-base)** and **PyTorch**.
33
+
34
+ ---
35
+
36
+ ## Features
37
+
38
+ * Fine-tune a question generation model with SQuAD v2.0 format data.
39
+ * Generate diverse and creative questions from text passages.
40
+ * Flexible generation parameters (`top-k`, `top-p`, `temperature`, etc.).
41
+ * Simple command-line usage.
42
+ * GPU support if available.
43
+
44
+ ---
45
+
46
+ ## 📊 Evaluation Results
47
+
48
+ We conducted both **manual evaluation** (500 samples) and **automatic evaluation** (1,000 samples).
49
+
50
+ | Evaluation Type | Precision | Recall | F1-Score |
51
+ |------------------|-----------|--------|----------|
52
+ | Automatic (1000) | 0.85 | 0.83 | 0.84 |
53
+ | Manual (500) | 0.88 | 0.86 | 0.87 |
54
+
55
+ ➡️ The model generates diverse, grammatically correct, and contextually appropriate questions.
56
+
57
+ ---
58
+
59
+ ## Creation Process
60
+
61
+ The dataset was built using a **4-stage automated pipeline**:
62
+
63
+ 1. Select relevant QA websites from trusted sources.
64
+ 2. Automatic crawling to collect raw QA pages.
65
+ 3. Semantic tag extraction to obtain clean Question–Context–Answer triples.
66
+ 4. AI-assisted filtering to remove noisy or inconsistent samples.
67
+
68
+ ---
69
+
70
+ ## 📝 Quality Evaluation
71
+
72
+ A fine-tuned model trained on **HVU_QA (VietAI/vit5-base)** achieved:
73
+
74
+ * **BLEU Score**: 90.61
75
+ * **Semantic similarity**: 97.0% (cosine ≥ 0.8)
76
+ * **Human evaluation**:
77
+ * Grammar: **4.58 / 5**
78
+ * Usefulness: **4.29 / 5**
79
+
80
+ ➡️ These results confirm that **HVU_QA is a high-quality resource** for developing robust FAQ-style question generation models.
81
+
82
+ ---
83
+
84
+ ## 📂 Project Structure
85
+
86
+ ```
87
+ .HVU_QA
88
+ ├── t5-viet-qg-finetuned/
89
+ ├── fine_tune_qg.py
90
+ ├── generate_question.py
91
+ ├── 30ktrain.json
92
+ └── README.md
93
+ ```
94
+ > All data files are UTF-8 encoded and ready for use in NLP pipelines.
95
+
96
+ ---
97
+
98
+ ## 🛠️ Requirements
99
+
100
+ * Python 3.8+
101
+ * PyTorch >= 1.9
102
+ * Transformers >= 4.30
103
+ * scikit-learn
104
+ * Fine-tuned model (download at: [link](https://huggingface.co/datasets/DANGDOCAO/GeneratingQuestions/tree/main))
105
+
106
+ ---
107
+
108
+ ## ⚙️ Setup
109
+
110
+ ### 🛠️ Step 1: Download and Extract
111
+
112
+ 1. Download `HVU_QA.zip`
113
+ 2. Extract into a folder, e.g.:
114
+
115
+ ```
116
+ D:\your\HVU_QA
117
+ ```
118
+
119
+ ### 🛠️ Step 2: Add to Environment Path (if needed)
120
+
121
+ 1. Open **System Properties → Environment Variables**
122
+ 2. Select `Path` → **Edit** → **New**
123
+ 3. Add the path, e.g.:
124
+
125
+ ```
126
+ D:\your\HVU_QA
127
+ ```
128
+
129
+ ### 🛠️ Step 3: Open in Visual Studio Code
130
+
131
+ ```
132
+ File > Open Folder > D:\HVU_QA
133
+ ```
134
+
135
+ ### 🛠️ Step 4: Install Required Libraries
136
+
137
+ Open **Terminal** and run:
138
+
139
+ #### Windows (PowerShell)
140
+
141
+ **Required only**
142
+
143
+ ```powershell
144
+ python -m pip install --upgrade pip
145
+ pip install torch transformers datasets scikit-learn sentencepiece safetensors
146
+ ```
147
+
148
+ **Required + Optional**
149
+
150
+ ```powershell
151
+ python -m pip install --upgrade pip
152
+ pip install torch transformers datasets scikit-learn sentencepiece safetensors accelerate tensorboard evaluate sacrebleu rouge-score nltk
153
+ ```
154
+
155
+ #### Linux / macOS (bash/zsh)
156
+
157
+ **Required only**
158
+
159
+ ```bash
160
+ python3 -m pip install --upgrade pip
161
+ pip install torch transformers datasets scikit-learn sentencepiece safetensors
162
+ ```
163
+
164
+ **Required + Optional**
165
+
166
+ ```bash
167
+ python3 -m pip install --upgrade pip
168
+ pip install torch transformers datasets scikit-learn sentencepiece safetensors accelerate tensorboard evaluate sacrebleu rouge-score nltk
169
+ ```
170
+
171
+ ✅ Verify installation:
172
+
173
+ * Windows (PowerShell)
174
+
175
+ ```powershell
176
+ python -c "import torch, transformers, datasets, sklearn, sentencepiece, safetensors, accelerate, tensorboard, evaluate, sacrebleu, rouge_score, nltk; print('✅ All dependencies installed correctly!')"
177
+ ```
178
+
179
+ * Linux/macOS
180
+
181
+ ```bash
182
+ python3 -c "import torch, transformers, datasets, sklearn, sentencepiece, safetensors, accelerate, tensorboard, evaluate, sacrebleu, rouge_score, nltk; print('✅ All dependencies installed correctly!')"
183
+ ```
184
+
185
+ ---
186
+
187
+ ## Usage
188
+
189
+ * Train and evaluate a question generation model.
190
+ * Develop Vietnamese NLP tools.
191
+ * Conduct linguistic research.
192
+
193
+ ### Training (Fine-tuning)
194
+
195
+ When you run `fine_tune_qg.py`, the script will:
196
+
197
+ 1. Load the dataset from **`30ktrain.json`**
198
+ 2. Fine-tune the `VietAI/vit5-base` model
199
+ 3. Save the trained model into a new folder named **`t5-viet-qg-finetuned/`**
200
+
201
+ Run:
202
+
203
+ ```bash
204
+ python fine_tune_qg.py
205
+ ```
206
+
207
+ ### Generating Questions
208
+
209
+ ```bash
210
+ python generate_question.py
211
+ ```
212
+
213
+ **Example:**
214
+
215
+ ```
216
+ Input passage:
217
+ Iced milk coffee (Cà phê sữa đá) is a famous drink in Vietnam.
218
+
219
+ Number of questions: 5
220
+ ```
221
+
222
+ ✅ Output:
223
+
224
+ 1. What type of coffee is famous in Vietnam?
225
+ 2. Why is iced milk coffee popular?
226
+ 3. What ingredients are included in iced milk coffee?
227
+ 4. Where does iced milk coffee originate from?
228
+ 5. How is Vietnamese iced milk coffee prepared?
229
+
230
+ ---
231
+
232
+ ## ⚙️ Generation Settings
233
+
234
+ In `generate_question.py`, you can adjust:
235
+
236
+ * `top_k`, `top_p`, `temperature`, `no_repeat_ngram_size`, `repetition_penalty`
237
+
238
+ ---
239
+
240
+ ## 🤝 Contribution
241
+
242
+ We welcome contributions:
243
+
244
+ * Open issues
245
+ * Submit pull requests
246
+ * Suggest improvements or add datasets
247
+
248
+ ---
249
+
250
+ ## 📄 Citation
251
+
252
+ If you use this repository or datasets in research, please cite:
253
+
254
+ **Ha Nguyen-Tien, Phuc Le-Hong, Dang Do-Cao, Cuong Nguyen-Hung, Chung Mai-Van. 2025. A Method to Build QA Corpora for Low-Resource Languages. Proceedings of KSE 2025. ACM TALLIP.**
255
+
256
+ ### 📚 BibTeX
257
+
258
+ ```bibtex
259
+ @inproceedings{nguyen2025hvuqa,
260
+ title={A Method to Build QA Corpora for Low-Resource Languages},
261
+ author={Ha Nguyen-Tien and Phuc Le-Hong and Dang Do-Cao and Cuong Nguyen-Hung and Chung Mai-Van},
262
+ booktitle={Proceedings of KSE 2025},
263
+ year={2025}
264
+ }
265
+ ```
266
+
267
+ ---
268
+
269
+ ## 📬 Contact
270
+
271
+ * **Ha Nguyen-Tien** (Corresponding author)
272
+ 📧 [nguyentienha@hvu.edu.vn](mailto:nguyentienha@hvu.edu.vn)
273
+
274
+ * **Phuc Le-Hong**
275
+ 📧 [Lehongphuc20021408@gmail.com](mailto:Lehongphuc20021408@gmail.com)
276
+
277
+ * **Dang Do-Cao**
278
+ 📧 [docaodang532001@gmail.com](mailto:docaodang532001@gmail.com)
279
+
280
+ 📍 Faculty of Engineering and Technology, Hung Vuong University, Phu Tho, Vietnam
281
+ 🌐 [https://hvu.edu.vn](https://hvu.edu.vn)
282
+
283
+ ---
284
+
285
+ *This repository is part of our ongoing effort to support Vietnamese NLP and make language technology more accessible for low-resource and underrepresented languages.*