Package: distilabel
⚗️ distilabelAI Feedback (AIF) framework for building datasets with and for LLMs.[!TIP]
To discuss, get support, or give feedbackjoin Argilla's Slack Communityand you will be able to engage with our amazing community and also with the core developers ofargillaanddistilabel.FeaturesIntegrations with the most popular libraries and APIs for LLMs: HF Transformers, OpenAI, vLLM, etc.Multiple tasks for Self-Instruct, Preference datasets and more.Dataset export to Argilla for easy data exploration and further annotation.[!WARNING]distilabelis currently under active development and we're iterating quickly, so take into account that we may introduce breaking changes in the releases during the upcoming weeks, and also theREADMEmight be outdated the best place to get started is thedocumentation.Installationpipinstalldistilabel--upgradeRequires Python 3.8+In addition, the following extras are available:hf-transformers: for using models available intransformerspackage via theTransformersLLMintegration.hf-inference-endpoints: for using theHuggingFace Inference Endpointsvia theInferenceEndpointsLLMintegration.openai: for using OpenAI API models via theOpenAILLMintegration.vllm: for usingvllmserving engine via thevLLMintegration.llama-cpp: for usingllama-cpp-pythonas Python bindings forllama.cpp.ollama: for usingOllamaand their available models via their Python client.together: for usingTogether Inferencevia their Python client.anyscale: for usingAnyscale endpoints.ollama: for usingOllama.mistralai: for usingMistral AIvia their Python client.vertexai: for using bothGoogle Vertex AIofferings: their proprietary models and endpoints via their Python clientgoogle-cloud-aiplatform.argilla: for exporting the generated datasets toArgilla.ExampleTo run the following example you must installdistilabelwith bothopenaiandargillaextras:pipinstall"distilabel[openai,argilla]"--upgradeThen run the following example:fromdatasetsimportload_datasetfromdistilabel.llmimportOpenAILLMfromdistilabel.pipelineimportpipelinefromdistilabel.tasksimportTextGenerationTaskdataset=(load_dataset("HuggingFaceH4/instruction-dataset",split="test[:10]").remove_columns(["completion","meta"]).rename_column("prompt","input"))# Create a `Task` for generating text given an instruction.task=TextGenerationTask()# Create a `LLM` for generating text using the `Task` created in# the first step. As the `LLM` will generate text, it will be a `generator`.generator=OpenAILLM(task=task,max_new_tokens=512)# Create a pre-defined `Pipeline` using the `pipeline` function and the# `generator` created in step 2. The `pipeline` function will create a# `labeller` LLM using `OpenAILLM` with the `UltraFeedback` task for# instruction following assessment.pipeline=pipeline("preference","instruction-following",generator=generator)dataset=pipeline.generate(dataset)Additionally, you can push the generated dataset to Argilla for further exploration and annotation:importargillaasrgrg.init(api_url="<YOUR_ARGILLA_API_URL>",api_key="<YOUR_ARGILLA_API_KEY>")# Convert the dataset to Argilla formatrg_dataset=dataset.to_argilla()# Push the dataset to Argillarg_dataset.push_to_argilla(name="preference-dataset",workspace="admin")More examplesFind more examples of different use cases ofdistilabelunderexamples/.Or check out the following Google Colab Notebook:BadgesIf you build something cool withdistilabelconsider adding one of these badges to your dataset or model card.[<img src="https://raw.githubusercontent.com/argilla-io/distilabel/main/docs/assets/distilabel-badge-light.png" alt="Built with Distilabel" width="200" height="32"/>](https://github.com/argilla-io/distilabel)[<img src="https://raw.githubusercontent.com/argilla-io/distilabel/main/docs/assets/distilabel-badge-dark.png" alt="Built with Distilabel" width="200" height="32"/>](https://github.com/argilla-io/distilabel)ContributeTo directly contribute withdistilabel, check ourgood first issuesoropen a new one.ReferencesUltraFeedback: Boosting Language Models with High-quality FeedbackJudgeLM: Fine-tuned Large Language Models are Scalable JudgesSelf-Instruct: Aligning Language Models with Self-Generated Instructions