--- license: mit task_categories: - question-answering - text-generation language: - vi tags: - vietnamese - t5 - nlp - question-generation pretty_name: HVU Question Generation Dataset size_categories: - 10K All files are UTF-8 encoded and ready for direct use in NLP pipelines. --- ## 📊 Evaluation Results We performed **manual evaluation on 500 samples** and **automatic evaluation on 1,000 samples**. | Evaluation Type | Precision | Recall | F1-Score | |------------------|-----------|--------|----------| | Automatic (1000) | 0.85 | 0.83 | 0.84 | | Manual (500) | 0.88 | 0.86 | 0.87 | --- ## 🔧 Installation Create a virtual environment and install dependencies: ### Windows (PowerShell) ```powershell python -m venv .venv .venv\Scripts\Activate.ps1 python -m pip install --upgrade pip pip install torch transformers datasets scikit-learn ``` ### Linux / macOS ```bash python3 -m venv .venv source .venv/bin/activate python -m pip install --upgrade pip pip install torch transformers datasets scikit-learn ``` --- ## 🚀 Training (Fine-tuning) Make sure `30ktrain.json` is in the same folder as `fine_tune_qg.py`. Run: ```bash python fine_tune_qg.py ``` **What happens:** - Loads `30ktrain.json` - Splits into 80% train / 20% validation - Tokenizes using `T5Tokenizer` - Fine-tunes `VietAI/vit5-base` for 3 epochs - Saves model + tokenizer to `t5-viet-qg-finetuned/` **Key training parameters** (edit in `fine_tune_qg.py` if needed): - `per_device_train_batch_size`: 1 - `learning_rate`: 2e-4 - `num_train_epochs`: 3 - `max_input_length`: 512 - `max_target_length`: 64 --- ## 💡 Generating Questions Once training is done, use `generate_question.py` to generate new questions. Ensure: - `MODEL_DIR` → `t5-viet-qg-finetuned/` - `DATA_PATH` → `30ktrain.json` Run: ```bash python generate_question.py ``` Steps: 1. Enter a context passage (Vietnamese) 2. Enter number of questions (default 20, max 200) 3. Script will: - Find best match in dataset by title similarity - Use matched answer + your context - Generate multiple unique questions with top-k & top-p sampling 4. Output lists generated questions. --- ## ⚙️ Generation Settings In `generate_question.py`, tweak: - `top_k` (default 60) - `top_p` (default 0.95) - `temperature` (default 0.9) - `no_repeat_ngram_size` (default 3) - `repetition_penalty` (default 1.12) --- ## 📂 Project Structure ``` . ├── fine_tune_qg.py ├── generate_question.py ├── 30ktrain.json ├── t5-viet-qg-finetuned/ ├── README.md └── LICENSE ``` --- ## 🔍 Example Usage **Training** ```bash python fine_tune_qg.py ``` **Generating** ```bash python generate_question.py ``` Example: ``` Nhập đoạn văn bản: Cà phê sữa đá là đồ uống nổi tiếng ở Việt Nam. Nhập vào số lượng câu hỏi bạn cần: 5 ✅ Các câu hỏi mới được sinh ra: 1. Loại cà phê nào nổi tiếng ở Việt Nam? 2. Tại sao cà phê sữa đá được yêu thích? 3. Cà phê sữa đá gồm những nguyên liệu gì? 4. Nguồn gốc của cà phê sữa đá là từ đâu? 5. Cà phê sữa đá Việt Nam được pha chế như thế nào? ``` --- ## 🤝 Contribution You’re welcome to: - Open issues - Submit pull requests - Suggest new datasets --- ## 📄 License Licensed under the MIT License – see the `LICENSE` file for details. --- ## 📬 Contact - **Ha Nguyen-Tien** (Corresponding author) Email: nguyentienha@hvu.edu.vn - **Phuc Le-Hong** Email: Lehongphuc20021408@gmail.com - **DANG DO CAO** Email: docaodang532001@gmail.com --- *This repository is part of an effort to advance Vietnamese NLP by making question generation more accessible for researchers and developers.*