--- dataset_info: features: - name: id dtype: string - name: question dtype: string - name: choices sequence: string - name: answer dtype: string - name: prompt dtype: string splits: - name: dev num_bytes: 221914 num_examples: 303 - name: test num_bytes: 8061049 num_examples: 9833 - name: valid num_bytes: 569931 num_examples: 744 download_size: 3249881 dataset_size: 8852894 configs: - config_name: default data_files: - split: dev path: data/dev-* - split: test path: data/test-* - split: valid path: data/valid-* --- # Description This dataset, [anhdungitvn/vmlu_v1.5](https://huggingface.co/datasets/anhdungitvn/vmlu_v1.5), was originally created from [vmlu_v1.5](https://vmlu.ai/#DataSection) by formatting it into the Hugging Face datasets format for easier use. ## Example ```python { "id": "28-0023", "question": "Tỷ giá thay đổi sẽ ảnh hưởng đến", "choices": [ "A. Cán cân thương mại", "B. Cán cân thanh toán", "C. Sản lượng quốc gia", "D. Các lựa chọn đều đúng" ], "answer": "", "prompt": "Chỉ đưa ra chữ cái đứng trước câu trả lời đúng (A, B, C, D hoặc E) của câu hỏi trắc nghiệm sau: \nTỷ giá thay đổi sẽ ảnh hưởng đến\n\nA. Cán cân thương mại\nB. Cán cân thanh toán\nC. Sản lượng quốc gia\nD. Các lựa chọn đều đúng\nĐáp án: " } ``` # How to use? ```python from datasets import load_dataset dataset_name_or_path = "anhdungitvn/vmlu_v1.5" dataset = load_dataset(dataset_name_or_path) ``` # How was the dataset converted?
Step 1: JSONL to dataset ```python import json from datasets import Dataset from datasets import DatasetDict def read(file): data = [] with open(file, 'r') as f: lines = f.readlines() for line in lines: data.append(json.loads(line)) return Dataset.from_list(data) dataset = DatasetDict( { "dev": read("dev.jsonl"), "valid": read("valid.jsonl"), "test": read("test.jsonl"), } ) dataset['test'] = dataset['test'].add_column("answer", [""]*len(dataset['test'])) ``` Output: ```python DatasetDict({ dev: Dataset({ features: ['id', 'question', 'choices', 'answer'], num_rows: 303 }) test: Dataset({ features: ['id', 'question', 'choices', 'answer'], num_rows: 9833 }) valid: Dataset({ features: ['id', 'question', 'choices', 'answer'], num_rows: 744 }) }) ```
Step 2: Add prompt ```python def doc2prompt(doc): text_choice = '\n'.join(doc['choices']) prompt = "Chỉ đưa ra chữ cái đứng trước câu trả lời đúng (A, B, C, D hoặc E) của câu hỏi trắc nghiệm sau: \n" \ + doc["question"] \ + "\n\n" \ + text_choice \ + "\n" \ + "Đáp án: " return {"prompt": prompt} dataset = dataset.map(doc2prompt, batched=False) ``` Output: ```python DatasetDict({ dev: Dataset({ features: ['id', 'question', 'choices', 'answer', 'prompt'], num_rows: 303 }) test: Dataset({ features: ['id', 'question', 'choices', 'answer', 'prompt'], num_rows: 9833 }) valid: Dataset({ features: ['id', 'question', 'choices', 'answer', 'prompt'], num_rows: 744 }) }) ```
‎ # References - [VMLU](https://vmlu.ai/)