artms007 commited on
Commit
8dae608
1 Parent(s): 576567e

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +29 -4
README.md CHANGED
@@ -51,6 +51,31 @@ The programming problems are written in Python and contain English and Japanese
51
 
52
  Pythonで書かれたプログラミング問題のデータセットには、英語と日本語のコメントやドキュメントストリングがそれぞれ別々に含まれています。
53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  ## Dataset Structure
55
 
56
  ```python
@@ -65,7 +90,7 @@ DatasetDict({
65
  })
66
  ```
67
 
68
- ### Data Instances
69
  An example of a dataset instance:
70
 
71
  ```
@@ -79,7 +104,7 @@ An example of a dataset instance:
79
  }
80
  ```
81
 
82
- ### Data Fields
83
  - `task_id` : Unique identifier for a task.
84
  - `prompt_en` : Function header and English docstrings as model input.
85
  - `prompt` : Function header and Japanese docstrings, parallel to prompt_en.
@@ -87,11 +112,11 @@ An example of a dataset instance:
87
  - `test` : Function to verify the correctness of generated code.
88
  - `entry_point` : Function name to initiate the test.
89
 
90
- ### Data Splits
91
  The dataset only consists of a test split with 164 samples.
92
 
93
  ## Additional Information
94
 
95
- ### Licensing Information
96
  MIT License
97
 
 
51
 
52
  Pythonで書かれたプログラミング問題のデータセットには、英語と日本語のコメントやドキュメントストリングがそれぞれ別々に含まれています。
53
 
54
+ ## How to use
55
+
56
+ 参照コードでpass@1を算出する例:
57
+
58
+ ```python
59
+ import os
60
+ from evaluate import load
61
+
62
+ os.environ["HF_ALLOW_CODE_EVAL"] = "1"
63
+
64
+ code_eval = load("code_eval")
65
+
66
+ candidates = []
67
+ test_cases = []
68
+
69
+ for d in ds:
70
+ # FIXME: 参照コードをそのまま入れているが、予測コードに置き換えるべき
71
+ candidates.append([d['prompt']+d['canonical_solution']])
72
+ # テストケースを実行可能な形式にする
73
+ text_cases.append([d['test']+f"\n\ncheck({d['entry_point']})\n"v])
74
+
75
+ pass_at_k, results = code_eval.compute(references=test_cases, predictions=candidates, k=[1])
76
+ print(pass_at_k)
77
+ ```
78
+
79
  ## Dataset Structure
80
 
81
  ```python
 
90
  })
91
  ```
92
 
93
+ ## Data Instances
94
  An example of a dataset instance:
95
 
96
  ```
 
104
  }
105
  ```
106
 
107
+ ## Data Fields
108
  - `task_id` : Unique identifier for a task.
109
  - `prompt_en` : Function header and English docstrings as model input.
110
  - `prompt` : Function header and Japanese docstrings, parallel to prompt_en.
 
112
  - `test` : Function to verify the correctness of generated code.
113
  - `entry_point` : Function name to initiate the test.
114
 
115
+ ## Data Splits
116
  The dataset only consists of a test split with 164 samples.
117
 
118
  ## Additional Information
119
 
120
+ ## Licensing Information
121
  MIT License
122