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

Delete README.md

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