Skip to content

Add Ethical Red Team dataset loader#1519

Open
96528025 wants to merge 1 commit intoAzure:mainfrom
96528025:codex/add-ethical-redteam-dataset
Open

Add Ethical Red Team dataset loader#1519
96528025 wants to merge 1 commit intoAzure:mainfrom
96528025:codex/add-ethical-redteam-dataset

Conversation

@96528025
Copy link

Summary

  • add a remote dataset loader for the Hugging Face dataset srushtisingh/Ethical_redteam
  • register the loader in the remote dataset package for automatic discovery
  • add unit tests for dataset loading and custom config handling

Testing

  • .venv/bin/python -m pytest tests/unit/datasets/test_ethical_redteam_dataset.py -q
  • .venv/bin/python -m pytest tests/unit/datasets/test_harmful_qa_dataset.py tests/unit/datasets/test_toxic_chat_dataset.py -q
  • .venv/bin/python -m ruff check pyrit/datasets/seed_datasets/remote/ethical_redteam_dataset.py tests/unit/datasets/test_ethical_redteam_dataset.py pyrit/datasets/seed_datasets/remote/__init__.py

@96528025
Copy link
Author

@microsoft-github-policy-service agree

@romanlutz
Copy link
Contributor

You will need to rerun notebook 1 from the datasets docs to show the dataset in the list there.

def __init__(
self,
*,
source: str = "srushtisingh/Ethical_redteam",
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably needn't be configurable

"Ethical Red Team dataset from Hugging Face. "
"Contains prompts intended for red-teaming and safety testing of language models."
),
source=f"https://huggingface.co/datasets/{self.source}",
Copy link
Contributor

Choose a reason for hiding this comment

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

Authors/groups missing.


logger.info(f"Successfully loaded {len(seed_prompts)} prompts from Ethical Red Team dataset")

return SeedDataset(seeds=seed_prompts, dataset_name=self.dataset_name)
Copy link
Contributor

Choose a reason for hiding this comment

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

A maintainer should run the integration test and make sure it works and looks as expected

SeedPrompt(
value=item["prompt"],
data_type="text",
dataset_name=self.dataset_name,
Copy link
Contributor

Choose a reason for hiding this comment

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

Sadly the dataset is not annotated with harm categories... That would be really useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants