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 new functionality to binarize preference datasets directly from distilabel #264

Merged
merged 10 commits into from
Jan 19, 2024

Conversation

plaguss
Copy link
Contributor

@plaguss plaguss commented Jan 17, 2024

Description

This PR adds a function to binarize a CustomDataset with a PreferenceTask:

from distilabel.utils import prepare_dataset
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")
# Add the task that originally was used for the labelling
dataset.task = JudgeLMTask()
dataset_binarized_random = prepare_dataset(dataset, strategy="random", keep_ties=True)

Closes #263

@plaguss plaguss added enhancement New feature or request team: ml A tag for the ML team. labels Jan 17, 2024
@plaguss plaguss added this to the 0.4.0 milestone Jan 17, 2024
@plaguss plaguss self-assigned this Jan 17, 2024
Copy link
Member

@davidberenstein1957 davidberenstein1957 left a comment

Choose a reason for hiding this comment

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

Looking good, added some comments :)

docs/technical-reference/pipeline.md Outdated Show resolved Hide resolved
src/distilabel/utils/dataset.py Outdated Show resolved Hide resolved
keep_ties: bool = True,
**kwargs: Any,
) -> "CustomDataset":
"""Binarizes a distilabel dataset.

Choose a reason for hiding this comment

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

again, some people might be like: "what is binarizing?"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could you both @davidberenstein1957 and @dvsrepo take a look at the new section of the docs for the dataset preparation/binarization? This commit e4602d4 contains the updates.

src/distilabel/utils/dataset.py Show resolved Hide resolved
src/distilabel/utils/dataset.py Show resolved Hide resolved
src/distilabel/utils/dataset.py Show resolved Hide resolved
src/distilabel/utils/dataset.py Outdated Show resolved Hide resolved
@dvsrepo
Copy link
Member

dvsrepo commented Jan 17, 2024

@plaguss it looks good, I don't have cycles to do an in-depth review.

One suggestion: would it be possible to return the chosen and rejected in the OpenAI format, like this?

https://huggingface.co/datasets/HuggingFaceH4/ultrafeedback_binarized?row=0

I think this would make it more interoperable

@plaguss
Copy link
Contributor Author

plaguss commented Jan 17, 2024

@plaguss it looks good, I don't have cycles to do an in-depth review.

One suggestion: would it be possible to return the chosen and rejected in the OpenAI format, like this?

https://huggingface.co/datasets/HuggingFaceH4/ultrafeedback_binarized?row=0

I think this would make it more interoperable

It should be easy, will take a look and update the code
Done!

@davidberenstein1957
Copy link
Member

davidberenstein1957 commented Jan 18, 2024

@plaguss can you resolve the merge conflicts. After that you can merge it. @sdiazlor, this might be interesting to include or at least briefly mention in your tutorial too. #247

"this dataset is already binarized don't know about binarization or do you want to know how to binarize a dataset?" look here

@plaguss plaguss merged commit c7fd1ad into main Jan 19, 2024
4 checks passed
@plaguss plaguss deleted the prepare-dataset branch January 19, 2024 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request team: ml A tag for the ML team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Add functionality to binarize datasets for fine-tuning directly from distilabel
3 participants