-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new functionality to binarize preference datasets directly from d…
…istilabel (#264) * Add prepare dataset function to binarize preference datasets
- Loading branch information
Showing
6 changed files
with
608 additions
and
2 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
docs/snippets/technical-reference/pipeline/prepare_dataset_binarize_random.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from datasets import load_dataset | ||
from distilabel.tasks import JudgeLMTask | ||
from distilabel.dataset import prepare_dataset | ||
|
||
dataset = load_dataset("argilla/distilabel-intel-orca-dpo-pairs", split="train") | ||
dataset.task = JudgeLMTask() | ||
dataset_binarized_random = prepare_dataset(dataset, strategy="random", keep_ties=True) | ||
# >>> len(dataset) | ||
# 12859 | ||
# >>> len(dataset_binarized_random) | ||
# 12817 | ||
dataset_binarized_random = prepare_dataset(dataset, strategy="random", keep_ties=False) | ||
# >>> len(dataset_binarized_random) | ||
# 8850 |
14 changes: 14 additions & 0 deletions
14
docs/snippets/technical-reference/pipeline/prepare_dataset_binarize_worst.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from datasets import load_dataset | ||
from distilabel.tasks import JudgeLMTask | ||
from distilabel.dataset import prepare_dataset | ||
|
||
dataset = load_dataset("argilla/distilabel-intel-orca-dpo-pairs", split="train") | ||
dataset.task = JudgeLMTask() | ||
dataset_binarized_random = prepare_dataset(dataset, strategy="worst", keep_ties=True) | ||
# >>> len(dataset) | ||
# 12859 | ||
# >>> len(dataset_binarized_random) | ||
# 12817 | ||
dataset_binarized_random = prepare_dataset(dataset, strategy="worst", keep_ties=False) | ||
# >>> len(dataset_binarized_random) | ||
# 8850 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.