DANGDOCAO commited on
Commit
992e42f
·
verified ·
1 Parent(s): 1d81701

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +57 -202
README.md CHANGED
@@ -1,38 +1,13 @@
1
- ---
2
- license: mit
3
- task_categories:
4
- - question-answering
5
- - text-generation
6
- - table-question-answering
7
- - sentence-similarity
8
- - feature-extraction
9
- language:
10
- - vi
11
- tags:
12
- - question-generation
13
- - nlp
14
- - faq
15
- - low-resource
16
- - code
17
- pretty_name: HVU_QA
18
- size_categories:
19
- - 10K<n<100K
20
- configs:
21
- - config_name: default
22
- data_files:
23
- - split: train
24
- path: 40k_train.json
25
- ---
26
  # HVU_QA
27
 
28
- **HVU_QA** is an open-source Vietnamese Question-Context-Answer (QCA) corpus, accompanied by supporting tools, created to facilitate the development of FAQ-style question generation and question answering systems, particularly for low-resource language settings. The dataset was developed by a research team at Hung Vuong University, Phu Tho, Vietnam, led by Dr. Ha Nguyen, Deputy Head of the Department of Engineering Technology. HVU_QA was constructed using a fully automated data-building pipeline that combines web crawling from reliable sources, semantic tag-based extraction, and AI-assisted filtering, helping ensure high factual accuracy, consistent structure, and practical usability for real-world applications.
29
 
30
  ## 📋 Dataset Description
31
 
32
  - **Language:** Vietnamese
33
  - **Format:** SQuAD-style JSON
34
- - **Total samples:** 40,000 QCA triples (full corpus released)
35
- - **Domains covered:** Social services, labor law, administrative processes, and other public service topics
36
  - **Structure of each sample:**
37
  - **Question:** Generated or extracted question
38
  - **Context:** Supporting text passage from which the answer is derived
@@ -41,131 +16,56 @@ configs:
41
  ## ⚙️ Creation Pipeline
42
 
43
  The dataset was built using a 4-stage automated process:
44
-
45
  1. **Selecting relevant QA websites** from trusted sources.
46
  2. **Automated data crawling** to collect raw QA webpages.
47
- 3. **Extraction via semantic tags** to obtain clean Question-Context-Answer triples.
48
  4. **AI-assisted filtering** to remove noisy or factually inconsistent samples.
49
 
50
  ## 📊 Quality Evaluation
 
51
 
52
- A fine-tuned `VietAI/vit5-base` model trained on HVU_QA achieved:
53
-
54
- | Metric | Score |
55
- |------------------------|------------------|
56
- | BLEU | 89.1 |
57
- | Semantic similarity | 91.5% (cos >= 0.8) |
58
- | Human grammar score | 4.58 / 5 |
59
- | Human usefulness score | 4.29 / 5 |
60
 
61
  These results confirm that HVU_QA is a high-quality resource for developing robust FAQ-style question generation models.
62
 
63
- ## 📁 Project Structure
64
-
65
- ```text
66
- HVU_QA/
67
- ├── backend/
68
- ├── __init__.py # Flask app factory
69
- │ └── app.py # Backend API and frontend serving
70
- ├── frontend/
71
- │ ├── index.html # Web interface
72
- │ ├── app.js # Frontend logic
73
- │ └── style.css # Frontend styles
74
- ├── t5-viet-qg-finetuned/ # Fine-tuned model folder
75
- ├── 40k_train.json # Training dataset in SQuAD-style JSON
76
- ├── fine_tune_qg.py # Model fine-tuning script
77
- ├── generate_question.py # CLI question generation script
78
- ├── HVU_QA_tool.py # Standalone launcher and model downloader
79
- ├── main.py # Start the local web application
80
- ├── requirements.txt # Python dependencies
81
- ├── HVU_QA_end_to_end_guide.ipynb # End-to-end usage notebook
82
  └── README.md
83
  ```
84
-
85
  ## 📁 Vietnamese Question Generation Tool
86
 
87
- ## 🛠️ Installation and Setup
88
-
89
- This repository supports two common workflows:
90
-
91
- 1. **Full project mode:** use the complete source code, web interface, backend API, training script, and local model folder.
92
- 2. **Standalone launcher mode:** use only `HVU_QA_tool.py` to automatically prepare a lightweight runtime, install missing dependencies, download the model, and run the app.
93
-
94
- ### Requirements
95
-
96
- * Python 3.10+
97
- * `pip`
98
- * Optional: NVIDIA GPU with CUDA for faster inference or training
99
-
100
- ### Option A. Install and run the full project
101
-
102
- Create and activate a virtual environment:
103
-
104
- ```bash
105
- python -m venv venv
106
- ```
107
-
108
- ```bash
109
- # Windows
110
- venv\Scripts\activate
111
-
112
- # macOS / Linux
113
- source venv/bin/activate
114
- ```
115
-
116
- Install dependencies:
117
-
118
- ```bash
119
- python -m pip install --upgrade pip
120
- python -m pip install -r requirements.txt
121
- ```
122
-
123
- `requirements.txt` already includes the main runtime packages such as Flask, Torch, Transformers, Datasets, Accelerate, SentencePiece, Safetensors, NumPy, and Hugging Face Hub.
124
-
125
- If you need a CUDA-specific PyTorch build, install the matching version from [pytorch.org](https://pytorch.org) first, then install the remaining dependencies from `requirements.txt`.
126
 
127
- Prepare the local model:
 
 
 
128
 
129
- ```bash
130
- python HVU_QA_tool.py --skip-run
131
- ```
132
-
133
- If `t5-viet-qg-finetuned/` already exists and contains a valid exported model, you can skip this step.
134
-
135
- Run the web app:
136
 
137
  ```bash
138
- python main.py
139
  ```
140
 
141
- Then open `http://127.0.0.1:5000` in your browser.
142
-
143
- ### Option B. Use the standalone launcher only
144
-
145
- If you only have `HVU_QA_tool.py` in an empty folder, run:
146
-
147
- ```bash
148
- python HVU_QA_tool.py
149
- ```
150
-
151
- The launcher will:
152
-
153
- 1. Detect whether the full project already exists.
154
- 2. Create a standalone runtime if needed.
155
- 3. Create a dedicated virtual environment when necessary.
156
- 4. Install missing runtime dependencies.
157
- 5. Download the model from Hugging Face.
158
- 6. Start the local web app automatically.
159
-
160
- ### Optional: Load only the dataset from Hugging Face Hub
161
 
 
162
  ```python
163
  from datasets import load_dataset
164
 
165
  ds = load_dataset("DANGDOCAO/GeneratingQuestions", split="train")
166
  print(ds[0])
167
  ```
168
-
169
  ## 📚 Usage
170
 
171
  * Train and evaluate a question generation model.
@@ -175,50 +75,48 @@ print(ds[0])
175
  ### 🔹 Fine-tuning
176
 
177
  ```bash
178
- python fine_tune_qg.py --train_file 40k_train.json --output_dir t5-viet-qg-finetuned
179
  ```
180
 
181
  This will:
182
 
183
- 1. Load the dataset from `40k_train.json`.
184
- 2. Fine-tune `VietAI/vit5-base`.
185
- 3. Save the trained model into `t5-viet-qg-finetuned/`.
186
- 4. Export the best or final model to a folder such as `best-model/` or `final-model/`.
187
 
188
- ### 🔹 Generating Questions
189
 
 
190
  ```bash
191
- python generate_question.py --text "Cà phê sữa đá là một loại đồ uống nổi tiếng ở Việt Nam." --num_questions 5
192
-
193
- **Example output:**
194
 
195
- ```text
196
- 1. Loại cà phê nào nổi tiếng ở Việt Nam?
197
- (Which type of coffee is famous in Vietnam?)
198
- 2. Cà phê sữa đá là loại đồ uống nổi tiếng ở đâu?
199
- (Where is iced milk coffee a famous drink?)
200
- 3. Vì sao cà phê sữa đá được nhiều người biết đến?
201
- (Why is iced milk coffee well known?)
202
- 4. Đồ uống nào là đặc trưng nổi tiếng ở Việt Nam?
203
- (Which beverage is a famous specialty in Vietnam?)
204
- 5. Cà phê sữa đá thường được nhắc đến như thế nào?
205
- (How is iced milk coffee commonly described?)
206
  ```
 
 
 
207
 
208
- **Common CLI options in `generate_question.py`:**
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
209
 
210
- - `--model_dir`
211
- - `--task_prefix`
212
- - `--num_questions`
213
- - `--device auto|cpu|cuda`
214
- - `--cpu_threads`
215
- - `--gpu_dtype auto|float16|bfloat16|float32`
216
- - `--max_source_length`
217
- - `--max_new_tokens`
218
- - `--output_format text|json`
219
 
220
  ## 📌 Citation
221
-
222
  If you use **HVU_QA** in your research, please cite:
223
 
224
  ```bibtex
@@ -232,47 +130,4 @@ If you use **HVU_QA** in your research, please cite:
232
  address = {Nha Trang, Vietnam},
233
  note = {To appear}
234
  }
235
- ```
236
-
237
- ## ❤️ Support / Funding
238
-
239
- If you find **HVU_QA** useful, please consider supporting our work.
240
- Your contributions help us maintain the dataset, improve quality, and release new versions (cleaning, expansion, benchmarks, and tools).
241
-
242
- ### 🇻🇳 Donate via VietQR (scan to support)
243
-
244
- This **VietQR / NAPAS 247** code can be scanned by Vietnamese banking apps and some international payment apps that support QR bank transfers.
245
-
246
- <img src="QRtk.jpg" alt="VietQR Support" width="320"/>
247
-
248
- **Bank:** VietinBank (Vietnam)
249
- **Account name:** NGUYEN TIEN HA
250
- **Account number:** 103004492490
251
- **Branch:** VietinBank CN PHU THO - HOI SO
252
-
253
- ### 🌍 International Support (Quick card payment)
254
-
255
- If you are outside Vietnam, you can support this project via **Buy Me a Coffee**
256
- (no PayPal account needed; pay directly with a credit/debit card):
257
-
258
- - BuyMeACoffee: https://buymeacoffee.com/hanguyen0408
259
-
260
- ### 🌍 International Support (PayPal)
261
-
262
- If you prefer PayPal, you can also support us here:
263
-
264
- - PayPal.me: https://paypal.me/HaNguyen0408
265
-
266
- ### ✨ Other ways to support
267
-
268
- - Star this repository / dataset on Hugging Face
269
- - Cite our paper if you use it in your research
270
- - Open issues / pull requests to improve the dataset and tools
271
-
272
- ## 📬 Contact / Maintainers
273
-
274
- For questions, feedback, collaborations, or issue reports related to HVU_QA, please contact:
275
-
276
- Dr. Ha Nguyen (Project Lead)
277
- Hung Vuong University, Phu Tho, Vietnam
278
- Email: nguyentienha@hvu.edu.vn
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  # HVU_QA
2
 
3
+ **HVU_QA** is an open-source Vietnamese QuestionContextAnswer (QCA) corpus and supporting tools for building FAQ-style question generation systems in low-resource languages. The dataset was created using a fully automated pipeline that combines web crawling from trustworthy sources, semantic tag-based extraction, and AI-assisted filtering to ensure high factual accuracy.
4
 
5
  ## 📋 Dataset Description
6
 
7
  - **Language:** Vietnamese
8
  - **Format:** SQuAD-style JSON
9
+ - **Total samples:** 39,000 QCA triples (full corpus released)
10
+ - **Domains covered:** Social services, labor law, administrative processes, and other public service topics.
11
  - **Structure of each sample:**
12
  - **Question:** Generated or extracted question
13
  - **Context:** Supporting text passage from which the answer is derived
 
16
  ## ⚙️ Creation Pipeline
17
 
18
  The dataset was built using a 4-stage automated process:
 
19
  1. **Selecting relevant QA websites** from trusted sources.
20
  2. **Automated data crawling** to collect raw QA webpages.
21
+ 3. **Extraction via semantic tags** to obtain clean QuestionContextAnswer triples.
22
  4. **AI-assisted filtering** to remove noisy or factually inconsistent samples.
23
 
24
  ## 📊 Quality Evaluation
25
+ A fine-tuned `vit5-base` model trained on HVU_QA achieved:
26
 
27
+ | Metric | Score |
28
+ |-------------------------|----------------|
29
+ | BLEU | 89.1 |
30
+ | Semantic similarity | 91.5% (cos ≥ 0.8) |
31
+ | Human grammar score | 4.58 / 5 |
32
+ | Human usefulness score | 4.29 / 5 |
 
 
33
 
34
  These results confirm that HVU_QA is a high-quality resource for developing robust FAQ-style question generation models.
35
 
36
+ ## 📁 Dataset Structure
37
+ ```
38
+ .HVU_QA
39
+ ├── t5-viet-qg-finetuned/
40
+ ├── fine_tune_qg.py
41
+ ├── generate_question.py
42
+ ── 39k_train.json
 
 
 
 
 
 
 
 
 
 
 
 
43
  └── README.md
44
  ```
 
45
  ## 📁 Vietnamese Question Generation Tool
46
 
47
+ ## 🛠️ Requirements
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
 
49
+ * Python 3.8+
50
+ * PyTorch >= 1.9
51
+ * Transformers >= 4.30
52
+ * scikit-learn
53
 
54
+ ### 📦 Install Required Libraries
 
 
 
 
 
 
55
 
56
  ```bash
57
+ pip install datasets transformers sentencepiece safetensors accelerate evaluate sacrebleu rouge-score nltk scikit-learn
58
  ```
59
 
60
+ *(Install PyTorch separately from [pytorch.org](https://pytorch.org) if not installed yet.)*
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
 
62
+ ### 📥 Load Dataset from Hugging Face Hub
63
  ```python
64
  from datasets import load_dataset
65
 
66
  ds = load_dataset("DANGDOCAO/GeneratingQuestions", split="train")
67
  print(ds[0])
68
  ```
 
69
  ## 📚 Usage
70
 
71
  * Train and evaluate a question generation model.
 
75
  ### 🔹 Fine-tuning
76
 
77
  ```bash
78
+ python fine_tune_qg.py
79
  ```
80
 
81
  This will:
82
 
83
+ 1. Load the dataset from `39k_train.json`.
84
+ 2. Fine-tune `VietAI/vit5-base`.
85
+ 3. Save the trained model into `t5-viet-qg-finetuned/`.
 
86
 
87
+ *(Or download the pre-trained model: [t5-viet-qg-finetuned](https://huggingface.co/datasets/DANGDOCAO/GeneratingQuestions/tree/main).)*
88
 
89
+ ### 🔹 Generating Questions
90
  ```bash
91
+ python generate_question.py
92
+ ```
 
93
 
94
+ **Example:**
 
 
 
 
 
 
 
 
 
 
95
  ```
96
+ Input passage:
97
+ Cà phê sữa đá là một loại đồ uống nổi tiếng ở Việt Nam
98
+ (Iced milk coffee is a famous drink in Vietnam)
99
 
100
+ Number of questions: 5
101
+ ```
102
+ **Output:**
103
+ ```
104
+ 1. Loại cà phê nào nổi tiếng ở Việt Nam?
105
+ (What type of coffee is famous in Vietnam?)
106
+ 2. Tại sao cà phê sữa đá lại phổ biến?
107
+ (Why is iced milk coffee popular?)
108
+ 3. Cà phê sữa đá bao gồm những nguyên liệu gì?
109
+ (What ingredients are included in iced milk coffee?)
110
+ 4. Cà phê sữa đá có nguồn gốc từ đâu?
111
+ (Where does iced milk coffee originate from?)
112
+ 5. Cà phê sữa đá Việt Nam được pha chế như thế nào?
113
+ (How is Vietnamese iced milk coffee prepared?)
114
+ ```
115
+ **You can adjust** in `generate_question.py`:
116
 
117
+ - `top_k`, `top_p`, `temperature`, `no_repeat_ngram_size`, `repetition_penalty`
 
 
 
 
 
 
 
 
118
 
119
  ## 📌 Citation
 
120
  If you use **HVU_QA** in your research, please cite:
121
 
122
  ```bibtex
 
130
  address = {Nha Trang, Vietnam},
131
  note = {To appear}
132
  }
133
+ ```