Martin2203 commited on
Commit
4822696
1 Parent(s): 2fe41a6

Add dataset

Browse files
Files changed (4) hide show
  1. HumanEval.csv +0 -0
  2. HumanEval.jsonl +0 -0
  3. convert.ipynb +76 -0
  4. convert.py +5 -0
HumanEval.csv ADDED
The diff for this file is too large to render. See raw diff
 
HumanEval.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
convert.ipynb ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 2,
6
+ "metadata": {},
7
+ "outputs": [],
8
+ "source": [
9
+ "import json\n",
10
+ "import os\n",
11
+ "import pandas as pd\n",
12
+ "\n",
13
+ "x = open(\"./HumanEval.jsonl\")\n",
14
+ "entries = []\n",
15
+ "for line in x:\n",
16
+ " contents = json.loads(line)\n",
17
+ " entries.append(contents)\n",
18
+ "x.close()"
19
+ ]
20
+ },
21
+ {
22
+ "cell_type": "code",
23
+ "execution_count": 3,
24
+ "metadata": {},
25
+ "outputs": [
26
+ {
27
+ "name": "stdout",
28
+ "output_type": "stream",
29
+ "text": [
30
+ "{'task_id': 'HumanEval/0', 'prompt': 'from typing import List\\n\\n\\ndef has_close_elements(numbers: List[float], threshold: float) -> bool:\\n \"\"\" Check if in given list of numbers, are any two numbers closer to each other than\\n given threshold.\\n >>> has_close_elements([1.0, 2.0, 3.0], 0.5)\\n False\\n >>> has_close_elements([1.0, 2.8, 3.0, 4.0, 5.0, 2.0], 0.3)\\n True\\n \"\"\"\\n', 'entry_point': 'has_close_elements', 'canonical_solution': ' for idx, elem in enumerate(numbers):\\n for idx2, elem2 in enumerate(numbers):\\n if idx != idx2:\\n distance = abs(elem - elem2)\\n if distance < threshold:\\n return True\\n\\n return False\\n', 'test': \"\\n\\nMETADATA = {\\n 'author': 'jt',\\n 'dataset': 'test'\\n}\\n\\n\\ndef check(candidate):\\n assert candidate([1.0, 2.0, 3.9, 4.0, 5.0, 2.2], 0.3) == True\\n assert candidate([1.0, 2.0, 3.9, 4.0, 5.0, 2.2], 0.05) == False\\n assert candidate([1.0, 2.0, 5.9, 4.0, 5.0], 0.95) == True\\n assert candidate([1.0, 2.0, 5.9, 4.0, 5.0], 0.8) == False\\n assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.0], 0.1) == True\\n assert candidate([1.1, 2.2, 3.1, 4.1, 5.1], 1.0) == True\\n assert candidate([1.1, 2.2, 3.1, 4.1, 5.1], 0.5) == False\\n\\n\"}\n"
31
+ ]
32
+ }
33
+ ],
34
+ "source": [
35
+ "print(entries[0])"
36
+ ]
37
+ },
38
+ {
39
+ "cell_type": "code",
40
+ "execution_count": null,
41
+ "metadata": {},
42
+ "outputs": [],
43
+ "source": [
44
+ "data = {\"source\": [], \"target\": [], \"program_id\": []}\n",
45
+ "\n",
46
+ "for entry in entries:\n",
47
+ " data[\"source\"].append(entry[\"source\"])\n",
48
+ " data[\"target\"].append(entry[\"target\"])\n",
49
+ " data[\"program_id\"].append(entry[\"program_id\"])\n",
50
+ "\n",
51
+ "pd.DataFrame(data=data).to_csv(\"./HumanEval.csv\")"
52
+ ]
53
+ }
54
+ ],
55
+ "metadata": {
56
+ "kernelspec": {
57
+ "display_name": "Python 3",
58
+ "language": "python",
59
+ "name": "python3"
60
+ },
61
+ "language_info": {
62
+ "codemirror_mode": {
63
+ "name": "ipython",
64
+ "version": 3
65
+ },
66
+ "file_extension": ".py",
67
+ "mimetype": "text/x-python",
68
+ "name": "python",
69
+ "nbconvert_exporter": "python",
70
+ "pygments_lexer": "ipython3",
71
+ "version": "3.11.6"
72
+ }
73
+ },
74
+ "nbformat": 4,
75
+ "nbformat_minor": 2
76
+ }
convert.py ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ import json
2
+ import os
3
+ with open("HumanEval.jsonl") as f:
4
+ for line in f:
5
+ contents = json.loads(line)