Datasets:
Update README.md
Browse files
README.md
CHANGED
|
@@ -25,14 +25,14 @@ configs:
|
|
| 25 |
---
|
| 26 |
# HVU_QA
|
| 27 |
|
| 28 |
-
**HVU_QA** is an open-source Vietnamese Question
|
| 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,56 +41,131 @@ configs:
|
|
| 41 |
## ⚙️ Creation Pipeline
|
| 42 |
|
| 43 |
The dataset was built using a 4-stage automated process:
|
|
|
|
| 44 |
1. **Selecting relevant QA websites** from trusted sources.
|
| 45 |
2. **Automated data crawling** to collect raw QA webpages.
|
| 46 |
-
3. **Extraction via semantic tags** to obtain clean Question
|
| 47 |
4. **AI-assisted filtering** to remove noisy or factually inconsistent samples.
|
| 48 |
|
| 49 |
## 📊 Quality Evaluation
|
| 50 |
-
A fine-tuned `vit5-base` model trained on HVU_QA achieved:
|
| 51 |
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
|
| 55 |
-
|
|
| 56 |
-
|
|
| 57 |
-
|
|
|
|
|
|
|
|
| 58 |
|
| 59 |
These results confirm that HVU_QA is a high-quality resource for developing robust FAQ-style question generation models.
|
| 60 |
|
| 61 |
-
## 📁
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
├──
|
| 66 |
-
├──
|
| 67 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
└── README.md
|
| 69 |
```
|
|
|
|
| 70 |
## 📁 Vietnamese Question Generation Tool
|
| 71 |
|
| 72 |
-
## 🛠️
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
* scikit-learn
|
| 78 |
|
| 79 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
|
| 81 |
```bash
|
| 82 |
-
|
| 83 |
```
|
| 84 |
|
| 85 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
|
| 87 |
-
### 📥 Load Dataset from Hugging Face Hub
|
| 88 |
```python
|
| 89 |
from datasets import load_dataset
|
| 90 |
|
| 91 |
ds = load_dataset("DANGDOCAO/GeneratingQuestions", split="train")
|
| 92 |
print(ds[0])
|
| 93 |
```
|
|
|
|
| 94 |
## 📚 Usage
|
| 95 |
|
| 96 |
* Train and evaluate a question generation model.
|
|
@@ -100,48 +175,50 @@ print(ds[0])
|
|
| 100 |
### 🔹 Fine-tuning
|
| 101 |
|
| 102 |
```bash
|
| 103 |
-
python fine_tune_qg.py
|
| 104 |
```
|
| 105 |
|
| 106 |
This will:
|
| 107 |
|
| 108 |
-
1. Load the dataset from `40k_train.json`.
|
| 109 |
-
2. Fine-tune `VietAI/vit5-base`.
|
| 110 |
-
3. Save the trained model into `t5-viet-qg-finetuned/`.
|
| 111 |
-
|
| 112 |
-
*(Or download the pre-trained model: [t5-viet-qg-finetuned](https://huggingface.co/datasets/DANGDOCAO/GeneratingQuestions/tree/main).)*
|
| 113 |
|
| 114 |
### 🔹 Generating Questions
|
|
|
|
| 115 |
```bash
|
| 116 |
-
python generate_question.py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
```
|
| 118 |
|
| 119 |
-
**
|
| 120 |
-
```
|
| 121 |
-
Input passage:
|
| 122 |
-
Cà phê sữa đá là một loại đồ uống nổi tiếng ở Việt Nam
|
| 123 |
-
(Iced milk coffee is a famous drink in Vietnam)
|
| 124 |
|
| 125 |
-
|
| 126 |
-
``
|
| 127 |
-
|
| 128 |
-
``
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
(What ingredients are included in iced milk coffee?)
|
| 135 |
-
4. Cà phê sữa đá có nguồn gốc từ đâu?
|
| 136 |
-
(Where does iced milk coffee originate from?)
|
| 137 |
-
5. Cà phê sữa đá Việt Nam được pha chế như thế nào?
|
| 138 |
-
(How is Vietnamese iced milk coffee prepared?)
|
| 139 |
-
```
|
| 140 |
-
**You can adjust** in `generate_question.py`:
|
| 141 |
-
|
| 142 |
-
- `top_k`, `top_p`, `temperature`, `no_repeat_ngram_size`, `repetition_penalty`
|
| 143 |
|
| 144 |
## 📌 Citation
|
|
|
|
| 145 |
If you use **HVU_QA** in your research, please cite:
|
| 146 |
|
| 147 |
```bibtex
|
|
@@ -156,12 +233,14 @@ If you use **HVU_QA** in your research, please cite:
|
|
| 156 |
note = {To appear}
|
| 157 |
}
|
| 158 |
```
|
|
|
|
| 159 |
## ❤️ Support / Funding
|
| 160 |
|
| 161 |
If you find **HVU_QA** useful, please consider supporting our work.
|
| 162 |
Your contributions help us maintain the dataset, improve quality, and release new versions (cleaning, expansion, benchmarks, and tools).
|
| 163 |
|
| 164 |
### 🇻🇳 Donate via VietQR (scan to support)
|
|
|
|
| 165 |
This **VietQR / NAPAS 247** code can be scanned by Vietnamese banking apps and some international payment apps that support QR bank transfers.
|
| 166 |
|
| 167 |
<img src="QRtk.jpg" alt="VietQR Support" width="320"/>
|
|
@@ -172,21 +251,28 @@ This **VietQR / NAPAS 247** code can be scanned by Vietnamese banking apps and s
|
|
| 172 |
**Branch:** VietinBank CN PHU THO - HOI SO
|
| 173 |
|
| 174 |
### 🌍 International Support (Quick card payment)
|
|
|
|
| 175 |
If you are outside Vietnam, you can support this project via **Buy Me a Coffee**
|
| 176 |
-
(no PayPal account needed
|
|
|
|
| 177 |
- BuyMeACoffee: https://buymeacoffee.com/hanguyen0408
|
| 178 |
|
| 179 |
### 🌍 International Support (PayPal)
|
|
|
|
| 180 |
If you prefer PayPal, you can also support us here:
|
|
|
|
| 181 |
- PayPal.me: https://paypal.me/HaNguyen0408
|
| 182 |
|
| 183 |
### ✨ Other ways to support
|
| 184 |
-
|
| 185 |
-
-
|
| 186 |
-
-
|
| 187 |
-
-
|
| 188 |
-
|
|
|
|
|
|
|
| 189 |
For questions, feedback, collaborations, or issue reports related to HVU_QA, please contact:
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
|
|
|
|
|
| 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 |
## ⚙️ 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 |
### 🔹 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
|
|
|
|
| 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"/>
|
|
|
|
| 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
|