Skip to content

Commit ad8198e

Browse files
authored
Merge pull request #495 from allenai/add-basic-math
Add basic arithmetic task
2 parents 1511fed + d4677fa commit ad8198e

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3333
- Added support for PyTorch v2.2.
3434
- Added ability to show logs from all ranks
3535
- Added option for QKV clipping.
36+
- Added basic_arithmetic downstream evaluation task
3637

3738
### Changed
3839

olmo/eval/downstream.py

+22
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,27 @@ def __init__(self, tokenizer, dataset_path="ai2_arc", dataset_name="ARC-Challeng
754754
)
755755

756756

757+
class BasicArithmetic(ArcEasy):
758+
"""This is a basic arithmetic task follows the same prompt format as ArcEasy.
759+
Example:
760+
{"id": "q85_1d1d_max1d_plus",
761+
"question": "Calculate 2 + 5 =",
762+
"choices": {"text": ["8", "7", "6", "17"],
763+
"label": ["A", "B", "C", "D"]},
764+
"answerKey": "B", "type_tag": "easy"}
765+
766+
"""
767+
768+
metric_type = "acc"
769+
770+
def __init__(self, tokenizer, dataset_path="allenai/basic_arithmetic", dataset_name=None):
771+
super().__init__(
772+
tokenizer=tokenizer,
773+
dataset_path=dataset_path,
774+
dataset_name=dataset_name,
775+
)
776+
777+
757778
class COPA(ICLMultiChoiceTaskDataset):
758779
"""Prompt: "PREMISE.strip()[:-1] because/therefore"
759780
Req_loglikelihood('The pair of students came under scrutiny by the teacher because', ' the students both received excellent grades.'
@@ -1155,6 +1176,7 @@ def doc_to_domain_conditional(self, doc):
11551176
"sciq": SciQ,
11561177
"arc_easy": ArcEasy,
11571178
"arc_challenge": ArcChallenge,
1179+
"basic_arithmetic": BasicArithmetic,
11581180
"copa": COPA,
11591181
"rte": RTE,
11601182
"commitment_bank": CommitmentBank,

0 commit comments

Comments
 (0)