DANGDOCAO commited on
Commit
918c6bd
·
verified ·
1 Parent(s): 994bd09

Upload README.md

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