File size: 5,790 Bytes
e2208f5 2c29590 62c7862 2c29590 62c7862 77024ce 32c1bc9 9d3c3af 8705bac b185a5e 32c1bc9 77024ce 32c1bc9 9d3c3af 8705bac b185a5e 77024ce e2208f5 2c29590 c3cfcde 2c29590 b1e3d2c 2c29590 3c0affa 2c29590 bc20598 2c29590 04a1512 2c29590 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 |
---
annotations_creators: []
language_creators:
- crowdsourced
- expert-generated
language:
- code
license:
- apache-2.0
multilinguality:
- multilingual
size_categories:
- unknown
source_datasets: []
task_categories:
- text-generation
task_ids:
- language-modeling
pretty_name: HumanEval-X
dataset_info:
- config_name: cpp
features:
- name: task_id
dtype: string
- name: prompt
dtype: string
- name: declaration
dtype: string
- name: canonical_solution
dtype: string
- name: test
dtype: string
- name: example_test
dtype: string
splits:
- name: test
num_bytes: 276141
num_examples: 164
download_size: 101881
dataset_size: 276141
- config_name: go
features:
- name: task_id
dtype: string
- name: prompt
dtype: string
- name: declaration
dtype: string
- name: canonical_solution
dtype: string
- name: test
dtype: string
- name: example_test
dtype: string
splits:
- name: test
num_bytes: 250979
num_examples: 164
download_size: 102355
dataset_size: 250979
- config_name: java
features:
- name: task_id
dtype: string
- name: prompt
dtype: string
- name: declaration
dtype: string
- name: canonical_solution
dtype: string
- name: test
dtype: string
- name: example_test
dtype: string
splits:
- name: test
num_bytes: 376189
num_examples: 164
download_size: 111925
dataset_size: 376189
- config_name: js
features:
- name: task_id
dtype: string
- name: prompt
dtype: string
- name: declaration
dtype: string
- name: canonical_solution
dtype: string
- name: test
dtype: string
- name: example_test
dtype: string
splits:
- name: test
num_bytes: 249916
num_examples: 164
download_size: 102493
dataset_size: 249916
- config_name: python
features:
- name: task_id
dtype: string
- name: prompt
dtype: string
- name: declaration
dtype: string
- name: canonical_solution
dtype: string
- name: test
dtype: string
- name: example_test
dtype: string
splits:
- name: test
num_bytes: 249240
num_examples: 164
download_size: 101470
dataset_size: 249240
configs:
- config_name: cpp
data_files:
- split: test
path: cpp/test-*
- config_name: go
data_files:
- split: test
path: go/test-*
- config_name: java
data_files:
- split: test
path: java/test-*
- config_name: js
data_files:
- split: test
path: js/test-*
- config_name: python
data_files:
- split: test
path: python/test-*
default: true
---
# HumanEval-X
## Dataset Description
[HumanEval-X](https://github.com/THUDM/CodeGeeX) is a benchmark for evaluating the multilingual ability of code generative models. It consists of 820 high-quality human-crafted data samples (each with test cases) in Python, C++, Java, JavaScript, and Go, and can be used for various tasks, such as code generation and translation.
## Languages
The dataset contains coding problems in 5 programming languages: Python, C++, Java, JavaScript, and Go.
## Dataset Structure
To load the dataset you need to specify a subset among the 5 exiting languages `[python, cpp, go, java, js]`. By default `python` is loaded.
```python
from datasets import load_dataset
load_dataset("THUDM/humaneval-x", "js")
DatasetDict({
test: Dataset({
features: ['task_id', 'prompt', 'declaration', 'canonical_solution', 'test', 'example_test'],
num_rows: 164
})
})
```
```python
next(iter(data["test"]))
{'task_id': 'JavaScript/0',
'prompt': '/* Check if in given list of numbers, are any two numbers closer to each other than\n given threshold.\n >>> hasCloseElements([1.0, 2.0, 3.0], 0.5)\n false\n >>> hasCloseElements([1.0, 2.8, 3.0, 4.0, 5.0, 2.0], 0.3)\n true\n */\nconst hasCloseElements = (numbers, threshold) => {\n',
'declaration': '\nconst hasCloseElements = (numbers, threshold) => {\n',
'canonical_solution': ' for (let i = 0; i < numbers.length; i++) {\n for (let j = 0; j < numbers.length; j++) {\n if (i != j) {\n let distance = Math.abs(numbers[i] - numbers[j]);\n if (distance < threshold) {\n return true;\n }\n }\n }\n }\n return false;\n}\n\n',
'test': 'const testHasCloseElements = () => {\n console.assert(hasCloseElements([1.0, 2.0, 3.9, 4.0, 5.0, 2.2], 0.3) === true)\n console.assert(\n hasCloseElements([1.0, 2.0, 3.9, 4.0, 5.0, 2.2], 0.05) === false\n )\n console.assert(hasCloseElements([1.0, 2.0, 5.9, 4.0, 5.0], 0.95) === true)\n console.assert(hasCloseElements([1.0, 2.0, 5.9, 4.0, 5.0], 0.8) === false)\n console.assert(hasCloseElements([1.0, 2.0, 3.0, 4.0, 5.0, 2.0], 0.1) === true)\n console.assert(hasCloseElements([1.1, 2.2, 3.1, 4.1, 5.1], 1.0) === true)\n console.assert(hasCloseElements([1.1, 2.2, 3.1, 4.1, 5.1], 0.5) === false)\n}\n\ntestHasCloseElements()\n',
'example_test': 'const testHasCloseElements = () => {\n console.assert(hasCloseElements([1.0, 2.0, 3.0], 0.5) === false)\n console.assert(\n hasCloseElements([1.0, 2.8, 3.0, 4.0, 5.0, 2.0], 0.3) === true\n )\n}\ntestHasCloseElements()\n'}
```
## Data Fields
* ``task_id``: indicates the target language and ID of the problem. Language is one of ["Python", "Java", "JavaScript", "CPP", "Go"].
* ``prompt``: the function declaration and docstring, used for code generation.
* ``declaration``: only the function declaration, used for code translation.
* ``canonical_solution``: human-crafted example solutions.
* ``test``: hidden test samples, used for evaluation.
* ``example_test``: public test samples (appeared in prompt), used for evaluation.
## Data Splits
Each subset has one split: test.
## Citation Information
Refer to https://github.com/THUDM/CodeGeeX. |