DANGDOCAO commited on
Commit
76e3516
·
verified ·
1 Parent(s): 0c2bd79

Delete README.md

Browse files
Files changed (1) hide show
  1. README.md +0 -239
README.md DELETED
@@ -1,239 +0,0 @@
1
- # HVU_QA_NLP
2
-
3
- **HVU_QA_NLP** 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
- 1. Fine-tune the [[VietAI/vit5-base](https://huggingface.co/datasets/DANGDOCAO/GeneratingQuestions) model on your own QA dataset.
12
- 2. Generate multiple, diverse questions given a user-provided text passage (context).
13
-
14
- ---
15
-
16
- ## 📁 Dataset Format
17
-
18
- Your dataset must follow the **SQuAD v2.0** JSON structure:
19
-
20
- ```json
21
- {
22
- "version": "v2.0",
23
- "data": [
24
- {
25
- "title": "Đồ uống nào của Việt Nam từng lọt top ngon nhất thế giới?",
26
- "paragraphs": [
27
- {
28
- "qas": [
29
- {
30
- "id": "q1_1",
31
- "question": "Đồ uống nào của Việt Nam từng lọt top ngon nhất thế giới?",
32
- "answers": [
33
- {
34
- "text": "Theo bản đánh giá tháng 2/2023 của Taste Atlas...",
35
- "answer_start": "Theo bản đánh giá tháng 2/2023 của Taste Atlas..."
36
- }
37
- ],
38
- "is_impossible": false
39
- }
40
- ]
41
- }
42
- ]
43
- }
44
- ]
45
- }
46
- ```
47
-
48
- **Required fields:**
49
- - `title` → used as context
50
- - `question` → target question
51
- - `answers[0].text` → seed answer for training
52
- - `is_impossible` → filter for valid QAs
53
-
54
- **File name:** `30ktrain.json` (UTF-8)
55
-
56
- ---
57
-
58
- ## 📁 Datasets
59
-
60
- This repository provides datasets for **training** and **evaluating** Vietnamese question generation models.
61
-
62
- ### 🔹 `DataTotalQCAtriples30k/`
63
- - **`30ktrain.json`** → 30,000 QCA triples for training.
64
-
65
- ### 🔹 `Datatest1k/`
66
- - **`testorgin1k.json`** → 1,000 examples for manual & automatic evaluation.
67
-
68
- ### 🔹 `Datatrain29k/`
69
- - **`29kcorpustag.json`** → 29,000 preprocessed QCA triples.
70
-
71
- > All files are UTF-8 encoded and ready for direct use in NLP pipelines.
72
-
73
- ---
74
-
75
- ## 📊 Evaluation Results
76
-
77
- We performed **manual evaluation on 500 samples** and **automatic evaluation on 1,000 samples**.
78
-
79
- | Evaluation Type | Precision | Recall | F1-Score |
80
- |------------------|-----------|--------|----------|
81
- | Automatic (1000) | 0.85 | 0.83 | 0.84 |
82
- | Manual (500) | 0.88 | 0.86 | 0.87 |
83
-
84
- ---
85
-
86
- ## 🔧 Installation
87
-
88
- Create a virtual environment and install dependencies:
89
-
90
- ### Windows (PowerShell)
91
- ```powershell
92
- python -m venv .venv
93
- .venv\Scripts\Activate.ps1
94
- python -m pip install --upgrade pip
95
- pip install torch transformers datasets scikit-learn
96
- ```
97
-
98
- ### Linux / macOS
99
- ```bash
100
- python3 -m venv .venv
101
- source .venv/bin/activate
102
- python -m pip install --upgrade pip
103
- pip install torch transformers datasets scikit-learn
104
- ```
105
-
106
- ---
107
-
108
- ## 🚀 Training (Fine-tuning)
109
-
110
- Make sure `30ktrain.json` is in the same folder as `fine_tune_qg.py`.
111
-
112
- Run:
113
- ```bash
114
- python fine_tune_qg.py
115
- ```
116
-
117
- **What happens:**
118
- - Loads `30ktrain.json`
119
- - Splits into 80% train / 20% validation
120
- - Tokenizes using `T5Tokenizer`
121
- - Fine-tunes `VietAI/vit5-base` for 3 epochs
122
- - Saves model + tokenizer to `t5-viet-qg-finetuned/`
123
-
124
- **Key training parameters** (edit in `fine_tune_qg.py` if needed):
125
- - `per_device_train_batch_size`: 1
126
- - `learning_rate`: 2e-4
127
- - `num_train_epochs`: 3
128
- - `max_input_length`: 512
129
- - `max_target_length`: 64
130
-
131
- ---
132
-
133
- ## 💡 Generating Questions
134
-
135
- Once training is done, use `generate_question.py` to generate new questions.
136
-
137
- Ensure:
138
- - `MODEL_DIR` → `t5-viet-qg-finetuned/`
139
- - `DATA_PATH` → `30ktrain.json`
140
-
141
- Run:
142
- ```bash
143
- python generate_question.py
144
- ```
145
-
146
- Steps:
147
- 1. Enter a context passage (Vietnamese)
148
- 2. Enter number of questions (default 20, max 200)
149
- 3. Script will:
150
- - Find best match in dataset by title similarity
151
- - Use matched answer + your context
152
- - Generate multiple unique questions with top-k & top-p sampling
153
- 4. Output lists generated questions.
154
-
155
- ---
156
-
157
- ## ⚙️ Generation Settings
158
-
159
- In `generate_question.py`, tweak:
160
- - `top_k` (default 60)
161
- - `top_p` (default 0.95)
162
- - `temperature` (default 0.9)
163
- - `no_repeat_ngram_size` (default 3)
164
- - `repetition_penalty` (default 1.12)
165
-
166
- ---
167
-
168
- ## 📂 Project Structure
169
-
170
- ```
171
- .
172
- ├── fine_tune_qg.py
173
- ├── generate_question.py
174
- ├── 30ktrain.json
175
- ├── t5-viet-qg-finetuned/
176
- ├── README.md
177
- └── LICENSE
178
- ```
179
-
180
- ---
181
-
182
- ## 🔍 Example Usage
183
-
184
- **Training**
185
- ```bash
186
- python fine_tune_qg.py
187
- ```
188
-
189
- **Generating**
190
- ```bash
191
- python generate_question.py
192
- ```
193
-
194
- Example:
195
- ```
196
- Nhập đoạn văn bản:
197
- Cà phê sữa đá là đồ uống nổi tiếng ở Việt Nam.
198
-
199
- Nhập vào số lượng câu hỏi bạn cần: 5
200
-
201
- ✅ Các câu hỏi mới được sinh ra:
202
- 1. Loại cà phê nào nổi ti���ng ở Việt Nam?
203
- 2. Tại sao cà phê sữa đá được yêu thích?
204
- 3. Cà phê sữa đá gồm những nguyên liệu gì?
205
- 4. Nguồn gốc của cà phê sữa đá là từ đâu?
206
- 5. Cà phê sữa đá Việt Nam được pha chế như thế nào?
207
- ```
208
-
209
- ---
210
-
211
- ## 🤝 Contribution
212
-
213
- You’re welcome to:
214
- - Open issues
215
- - Submit pull requests
216
- - Suggest new datasets
217
-
218
- ---
219
-
220
- ## 📄 License
221
-
222
- Licensed under the MIT License – see the `LICENSE` file for details.
223
-
224
- ---
225
-
226
- ## 📬 Contact
227
-
228
- - **Ha Nguyen-Tien** (Corresponding author)
229
- Email: nguyentienha@hvu.edu.vn
230
-
231
- - **Phuc Le-Hong**
232
- Email: Lehongphuc20021408@gmail.com
233
-
234
- - **DANG DO CAO**
235
- Email: docaodang532001@gmail.com
236
-
237
- ---
238
-
239
- *This repository is part of an effort to advance Vietnamese NLP by making question generation more accessible for researchers and developers.*