Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Sst2 #250

Merged
merged 3 commits into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tests/dry_test/test_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"real_toxicity_prompts": None,
"rte": [],
"siqa": [],
"sst2": [],
"squad": [],
"squad_v2": [],
"story_cloze": None,
Expand Down
27 changes: 27 additions & 0 deletions utilization/dataset/sst2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from functools import cached_property

from .multiple_choice_dataset import MultipleChoiceDataset


class Sst2(MultipleChoiceDataset):
"""The dataset of Sst2.

The Stanford Sentiment Treebank consists of sentences from movie reviews and human annotations of their sentiment. The task is to predict the sentiment of a given sentence. It uses the two-way (positive/negative) class split, with only sentence-level labels.

Example:
sentence: hide new secretions from the parental units
label: 1
"""

instruction = "Determine the sentiment of the following sentence.\n{{sentence.strip()}}{{ '\n' + options if options }}\nAnswer:"
evaluation_set = "validation"
example_set = "train"
load_args = ("nyu-mll/glue", "sst2")

def format_instance(self, instance):
instance["options"] = ["negative", "positive"]
return instance

@cached_property
def references(self):
return [instance["label"] for instance in self.evaluation_data]
Loading