Commit ·
742aecd
1
Parent(s): 772e491
Upload atlas-preprocessed-code.py
Browse files- atlas-preprocessed-code.py +30 -0
atlas-preprocessed-code.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import evaluate
|
| 2 |
+
from evaluate.evaluation_suite import SubTask
|
| 3 |
+
|
| 4 |
+
class Suite(evaluate.EvaluationSuite):
|
| 5 |
+
def __init__(self, name):
|
| 6 |
+
super().__init__(name)
|
| 7 |
+
self.preprocessor = lambda x: {"text": x["code"].lower()}
|
| 8 |
+
self.suite = [
|
| 9 |
+
SubTask(
|
| 10 |
+
task_type="text-classification",
|
| 11 |
+
data="atlas-preprocessed-code",
|
| 12 |
+
split="validation[:10]",
|
| 13 |
+
args_for_task={
|
| 14 |
+
"metric": "accuracy",
|
| 15 |
+
"input_column": "code",
|
| 16 |
+
"label_column": "programming_language",
|
| 17 |
+
"label_mapping": {
|
| 18 |
+
"Python": 0,
|
| 19 |
+
"Java": 1,
|
| 20 |
+
"C++": 2,
|
| 21 |
+
"JavaScript": 3,
|
| 22 |
+
# Add the rest of your languages here
|
| 23 |
+
}
|
| 24 |
+
}
|
| 25 |
+
)
|
| 26 |
+
]
|
| 27 |
+
|
| 28 |
+
if __name__ == "__main__":
|
| 29 |
+
suite = Suite("my_evaluation_suite")
|
| 30 |
+
suite.save("atlas-preprocessed-code.py")
|