Datasets:
Set preview to k1 dataset
Browse files
check.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
from datasets import load_dataset
|
| 3 |
+
|
| 4 |
+
with open('DIA-Benchmark-k100.json') as f:
|
| 5 |
+
dataset = json.load(f)
|
| 6 |
+
|
| 7 |
+
for i, q in enumerate(dataset['questions']):
|
| 8 |
+
# Challenge
|
| 9 |
+
assert 'challenge' in q, f"Missing 'challenge' field in question {i}: \n{q}"
|
| 10 |
+
challenge = q['challenge']
|
| 11 |
+
assert isinstance(challenge['template_id'], int), f"Invalid 'template_id' field in question {i}:\n{q}"
|
| 12 |
+
assert isinstance(challenge['instance'], int), f"Invalid 'instance' field in question {i}:\n{q}"
|
| 13 |
+
assert isinstance(challenge['level'], str), f"Invalid 'level' field in question {i}:\n{q}"
|
| 14 |
+
assert isinstance(challenge['category'], str), f"Invalid 'instance' field in question {i}:\n{q}"
|
| 15 |
+
assert isinstance(challenge['adversarial'], bool), f"Invalid 'adversarial' field in question {i}:\n{q}"
|
| 16 |
+
assert isinstance(challenge['description'], str), f"Invalid 'description' field in question {i}:\n{q}"
|
| 17 |
+
assert isinstance(challenge['instructions'], str), f"Invalid 'instructions' field in question {i}:\n{q}"
|
| 18 |
+
|
| 19 |
+
# Solution
|
| 20 |
+
assert 'solution' in q, f"Missing 'solution' field in question {i}: \n{q}"
|
| 21 |
+
solution = q['solution']
|
| 22 |
+
assert isinstance(solution['challenge_solution'], str), f"Invalid 'challenge_solution' field in question {i}:\n{q}"
|
| 23 |
+
assert isinstance(solution['solution_explanation'], str), f"Invalid 'solution_explanation' field in question {i}:\n{q}"
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
dataset = load_dataset("json", data_files="DIA-Benchmark-k100.json", field="questions")
|