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 Dataset Presets #76

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
24 changes: 12 additions & 12 deletions walledeval/data/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import datasets #Dataset

from walledeval.types import (
MultipleChoiceQuestion, MultipleResponseQuestion,
MultipleChoiceQuestion, MultipleResponseQuestion,
OpenEndedQuestion,
Prompt,
AutocompletePrompt,
Expand Down Expand Up @@ -57,7 +57,7 @@ def from_hub(cls, name: str,
**ds_kwargs):
dataset = load_dataset(name, config, split=split, **ds_kwargs)
return cls(
name + ("/" + config if config else "") + "/" + split,
name + ("/" + config if config else "") + "/" + split,
dataset
)

Expand All @@ -79,13 +79,13 @@ def sample(self, samples: Optional[int] = None) -> list[T]:
class _HuggingFaceDatasetAlias:
def __init__(self, model: type = Prompt):
self.model = model

def __call__(self, name: str, dataset: datasets.Dataset):
return HuggingFaceDataset(name, dataset, self.model)
def from_hub(self,
name: str,
config: Optional[str] = None,

def from_hub(self,
name: str,
config: Optional[str] = None,
split: str = "train",
**ds_kwargs):
return HuggingFaceDataset.from_hub(
Expand All @@ -97,7 +97,7 @@ class HuggingFaceDataset(_HuggingFaceDataset):
def __init__(self, name: str, dataset: datasets.Dataset, model: type = Prompt):
_HuggingFaceDataset.__init__(self, name, dataset)
self.model = model

@classmethod
def from_hub(cls, name: str,
config: Optional[str] = None,
Expand All @@ -106,11 +106,11 @@ def from_hub(cls, name: str,
**ds_kwargs):
dataset = load_dataset(name, config, split=split, **ds_kwargs)
return cls(
name + ("/" + config if config else "") + "/" + split,
name + ("/" + config if config else "") + "/" + split,
dataset,
model
)

def __class_getitem__(cls, model: type = Prompt):
# Refer to https://stackoverflow.com/questions/73464414/why-are-generics-in-python-implemented-using-class-getitem-instead-of-geti
# for why it is implemented like this
Expand Down Expand Up @@ -173,7 +173,7 @@ def convert(self, sample: dict) -> SystemAssistedPrompt:
)


class JudgeQuestioningDataset(_HuggingFaceDataset[JudgeQuestioningPrompt]):
class JudgeQuestioningsafeteDataset(_HuggingFaceDataset[JudgeQuestioningPrompt]):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is safete lmao, remove!

def convert(self, sample: dict) -> JudgeQuestioningPrompt:
return JudgeQuestioningPrompt(
prompt=sample["prompt"],
Expand All @@ -186,4 +186,4 @@ def convert(self, sample: dict) -> InjectionPrompt:
return SystemAssistedPrompt(
prompt=sample["prompt"],
system=sample["system"]
)
)
3 changes: 3 additions & 0 deletions walledeval/data/presets/walledai/AART.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: walledai/AART
split: train
type: Prompt
3 changes: 3 additions & 0 deletions walledeval/data/presets/walledai/AdvBench.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: walledai/AdvBench
split: train
type: Prompt
5 changes: 5 additions & 0 deletions walledeval/data/presets/walledai/AdvancedAIRisk.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name: AdvancedAIRisk
split:
- lm
- human
type: MultipleChoiceQuestion
3 changes: 3 additions & 0 deletions walledeval/data/presets/walledai/AegisSafetyTest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: walledai/AegisSafetyTest
split: train
type: Prompt
11 changes: 11 additions & 0 deletions walledeval/data/presets/walledai/AyaRedTeaming.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: walledai/AyaRedTeaming
split:
- arabic
- english
- filipino
- french
- hindi
- russian
- serbian
- spanish
type: Prompt
14 changes: 14 additions & 0 deletions walledeval/data/presets/walledai/BBQ.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: walledai/BBQ
split:
- age
- disabilityStatus
- genderIdentity
- nationality
- physicalAppearance
- raceEthnicity
- raceXSes
- raceXGender
- religion
- ses
- sexualOrientation
type: MultipleChoiceQuestion
3 changes: 3 additions & 0 deletions walledeval/data/presets/walledai/BeaverTailsEval.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: walledai/BeaverTailsEval
split: train
type: Prompt
17 changes: 17 additions & 0 deletions walledeval/data/presets/walledai/CBBQ.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: walledai/CBBQ
split:
- ses
- age
- disability
- disease
- educationalQualification
- ethnicity
- gender
- householdRegistration
- nationality
- physicalAppearance
- race
- region
- religion
- sexualOrientation
type: MultipleChoiceQuestion
3 changes: 3 additions & 0 deletions walledeval/data/presets/walledai/CDNA.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: walledai/CDNA
split: train
type: Prompt
3 changes: 3 additions & 0 deletions walledeval/data/presets/walledai/CPAD.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: walledai/CPAD
split: train
type: Prompt
6 changes: 6 additions & 0 deletions walledeval/data/presets/walledai/CatHarmfulQA.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: walledai/CatHarmfulQA
split:
- en
- zh
- vi
type: Prompt
11 changes: 11 additions & 0 deletions walledeval/data/presets/walledai/CyberSecEval.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: walledai/CyberSecEval
split:
- python
- php
- javascript
- rust
- java
- cpp
- c
- csharp
type: Prompt
3 changes: 3 additions & 0 deletions walledeval/data/presets/walledai/DELPHI.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: walledai/DELPHI
split: train
type: Prompt
3 changes: 3 additions & 0 deletions walledeval/data/presets/walledai/DNA.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: walledai/DNA
split: train
type: Prompt
3 changes: 3 additions & 0 deletions walledeval/data/presets/walledai/DT-OOD.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: walledai/DT-OOD
split: train
type: MultipleChoiceQuestion
3 changes: 3 additions & 0 deletions walledeval/data/presets/walledai/DTStereotype.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: walledai/DTStereotype
split: train
type: Prompt
6 changes: 6 additions & 0 deletions walledeval/data/presets/walledai/DTToxicity.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: walledai/DTToxicity
split:
- rtp
- gpt3.5
- gpt4
type: Prompt
3 changes: 3 additions & 0 deletions walledeval/data/presets/walledai/ForbiddenQuestions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: walledai/ForbiddenQuestions
split: train
type: Prompt
3 changes: 3 additions & 0 deletions walledeval/data/presets/walledai/HarmBench.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: walledai/HarmBench
split: train
type: Prompt
3 changes: 3 additions & 0 deletions walledeval/data/presets/walledai/JailbreakBench.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: walledai/JailbreakBench
split: train
type: Prompt
3 changes: 3 additions & 0 deletions walledeval/data/presets/walledai/JailbreakHub.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: walledai/JailbreakHub
split: train
type: Prompt
3 changes: 3 additions & 0 deletions walledeval/data/presets/walledai/MaliciousInstruct.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: walledai/MaliciousInstruct
split: train
type: Prompt
3 changes: 3 additions & 0 deletions walledeval/data/presets/walledai/RTP.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: walledai/RTP
split: train
type: Prompt
3 changes: 3 additions & 0 deletions walledeval/data/presets/walledai/SGSafetyQuestions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: walledai/SGSafetyQuestions
split: train
type: Prompt
3 changes: 3 additions & 0 deletions walledeval/data/presets/walledai/SafeText.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: walledai/SafeText
split: train
type: AutocompletePrompt
3 changes: 3 additions & 0 deletions walledeval/data/presets/walledai/SafetyDatasets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: walledai/SafetyDatasets
split: train
type: Prompt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where are my subsets bro, this one got lots of subsets hehe

3 changes: 3 additions & 0 deletions walledeval/data/presets/walledai/SaladBench.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: walledai/SaladBench
split: train
type: MultipleResponseQuestion
5 changes: 5 additions & 0 deletions walledeval/data/presets/walledai/SimpleSafetyTests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name: walledai/SimpleSafetyTests
split:
- info
- instruct
type: Prompt
3 changes: 3 additions & 0 deletions walledeval/data/presets/walledai/StrongREJECT.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: walledai/StrongREJECT
split: train
type: Prompt
3 changes: 3 additions & 0 deletions walledeval/data/presets/walledai/TDC23-RedTeaming.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: walledai/TDC23-RedTeaming
split: train
type: Prompt
3 changes: 3 additions & 0 deletions walledeval/data/presets/walledai/TET.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: walledai/TET
split: train
type: Prompt
6 changes: 6 additions & 0 deletions walledeval/data/presets/walledai/WMDP.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: walledai/WMDP
split:
- bio
- chem
- cyber
type: MultipleChoiceQuestion
3 changes: 3 additions & 0 deletions walledeval/data/presets/walledai/WildGuardTest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: walledai/WildGuardTest
split: train
type: Prompt
3 changes: 3 additions & 0 deletions walledeval/data/presets/walledai/WildJailbreak.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: walledai/WildJailbreak
split: train
type: Prompt
3 changes: 3 additions & 0 deletions walledeval/data/presets/walledai/XSTest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: walledai/XSTest
split: test
type: Prompt