Comments (4)
Hi @KaifAhmad1! name
is not the name of the Hugging Face repo, but the name of the step that will be assigned to the LoadHubDataset
instance that you're creating. As the error says, the name cannot contain certain characters such as /
or .
.
If you change the name to something like name="load_dataset"
, it should work as you're providing the dataset that you want to load in the runtime parameters.
from distilabel.
Thanks @gabrielmbmb
from distilabel.
Hey, @gabrielmbmb Now getting this exception
from distilabel.llms import OpenAILLM
from distilabel.pipeline import Pipeline
from distilabel.steps import LoadHubDataset
from distilabel.steps.tasks import TextGeneration
with Pipeline(
name="simple-text-generation-pipeline",
description="A simple text generation pipeline",
) as pipeline:
load_dataset = LoadHubDataset(
name="load_dataset",
output_mappings={"Question": "Answer"},
)
generate_with_openai = TextGeneration(
name="generate_with_gpt35", llm=OpenAILLM(model="gpt-3.5-turbo")
)
load_dataset.connect(generate_with_openai)
if __name__ == "__main__":
distiset = pipeline.run(
parameters={
"load_dataset": {
"repo_id": "kaifahmad/indian-history-hindi-QA-3.4k",
"split": "train",
},
"generate_with_gpt35": {
"llm": {
"generation_kwargs": {
"temperature": 0.7,
"max_new_tokens": 512,
}
}
},
},
)
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ in <cell line: 21>:22 │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │ exit = <IPython.core.autocall.ZMQExitAutocall object at 0x7a2535a27d90> │ │
│ │ generate_with_openai = TextGeneration( │ │
│ │ │ name='generate_with_gpt35', │ │
│ │ │ input_mappings={}, │ │
│ │ │ output_mappings={}, │ │
│ │ │ input_batch_size=50, │ │
│ │ │ llm=OpenAILLM( │ │
│ │ │ │ generation_kwargs={ │ │
│ │ │ │ │ 'temperature': 0.7, │ │
│ │ │ │ │ 'max_new_tokens': 512 │ │
│ │ │ │ }, │ │
│ │ │ │ model='gpt-3.5-turbo', │ │
│ │ │ │ base_url='https://api.openai.com/v1', │ │
│ │ │ │ api_key=None, │ │
│ │ │ │ max_retries=6, │ │
│ │ │ │ timeout=120 │ │
│ │ │ ), │ │
│ │ │ group_generations=False, │ │
│ │ │ num_generations=1 │ │
│ │ ) │ │
│ │ get_ipython = <bound method InteractiveShell.get_ipython of │ │
│ │ <google.colab._shell.Shell object at 0x7a2535a277f0>> │ │
│ │ In = [ │ │
│ │ │ '', │ │
│ │ │ "get_ipython().system('pip install --quiet distilabel==1.0.0 │ │
│ │ distilabel[openai]=="+7, │ │
│ │ │ 'from distilabel.llms import OpenAILLM\nfrom distilabel.pipeline │ │
│ │ import Pipeline\nf'+1023, │ │
│ │ │ 'from distilabel.llms import OpenAILLM\nfrom distilabel.pipeline │ │
│ │ import Pipeline\nf'+1016, │ │
│ │ │ 'from distilabel.llms import OpenAILLM\nfrom distilabel.pipeline │ │
│ │ import Pipeline\nf'+1006, │ │
│ │ │ 'from distilabel.llms import OpenAILLM\nfrom distilabel.pipeline │ │
│ │ import Pipeline\nf'+1003 │ │
│ │ ] │ │
│ │ load_dataset = LoadHubDataset( │ │
│ │ │ name='load_dataset', │ │
│ │ │ input_mappings={}, │ │
│ │ │ output_mappings={'Question': 'Answer'}, │ │
│ │ │ batch_size=50, │ │
│ │ │ repo_id='kaifahmad/indian-history-hindi-QA-3.4k', │ │
│ │ │ split='train', │ │
│ │ │ config=None │ │
│ │ ) │ │
│ │ LoadHubDataset = <class 'distilabel.steps.generators.huggingface.LoadHubDataset'> │ │
│ │ OpenAILLM = <class 'distilabel.llms.openai.OpenAILLM'> │ │
│ │ Out = {} │ │
│ │ Pipeline = <class 'distilabel.pipeline.local.Pipeline'> │ │
│ │ pipeline = <distilabel.pipeline.local.Pipeline object at 0x7a24ea48e0b0> │ │
│ │ quit = <IPython.core.autocall.ZMQExitAutocall object at 0x7a2535a27d90> │ │
│ │ TextGeneration = <class 'distilabel.steps.tasks.text_generation.TextGeneration'> │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ /usr/local/lib/python3.10/dist-packages/distilabel/pipeline/local.py:93 in run │
│ │
│ 90 │ │ setup_logging(log_queue) # type: ignore │
│ 91 │ │ self._logger = logging.getLogger("distilabel.pipeline.local") │
│ 92 │ │ │
│ ❱ 93 │ │ super().run(parameters, use_cache) │
│ 94 │ │ │
│ 95 │ │ if self._batch_manager is None: │
│ 96 │ │ │ self._batch_manager = _BatchManager.from_dag(self.dag) │
│ │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │ log_queue = <multiprocessing.queues.Queue object at 0x7a24ea48d5d0> │ │
│ │ parameters = { │ │
│ │ │ 'load_dataset': { │ │
│ │ │ │ 'repo_id': 'kaifahmad/indian-history-hindi-QA-3.4k', │ │
│ │ │ │ 'split': 'train' │ │
│ │ │ }, │ │
│ │ │ 'generate_with_gpt35': { │ │
│ │ │ │ 'llm': { │ │
│ │ │ │ │ 'generation_kwargs': { │ │
│ │ │ │ │ │ 'temperature': 0.7, │ │
│ │ │ │ │ │ 'max_new_tokens': 512 │ │
│ │ │ │ │ } │ │
│ │ │ │ } │ │
│ │ │ } │ │
│ │ } │ │
│ │ self = <distilabel.pipeline.local.Pipeline object at 0x7a24ea48e0b0> │ │
│ │ use_cache = True │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ /usr/local/lib/python3.10/dist-packages/distilabel/pipeline/base.py:211 in run │
│ │
│ 208 │ │ if use_cache: │
│ 209 │ │ │ self._load_from_cache() │
│ 210 │ │ self._set_runtime_parameters(parameters or {}) │
│ ❱ 211 │ │ self.dag.validate() │
│ 212 │ │
│ 213 │ def get_runtime_parameters_info(self) -> Dict[str, List[Dict[str, Any]]]: │
│ 214 │ │ """Get the runtime parameters for the steps in the pipeline. │
│ │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │ parameters = { │ │
│ │ │ 'load_dataset': { │ │
│ │ │ │ 'repo_id': 'kaifahmad/indian-history-hindi-QA-3.4k', │ │
│ │ │ │ 'split': 'train' │ │
│ │ │ }, │ │
│ │ │ 'generate_with_gpt35': { │ │
│ │ │ │ 'llm': { │ │
│ │ │ │ │ 'generation_kwargs': { │ │
│ │ │ │ │ │ 'temperature': 0.7, │ │
│ │ │ │ │ │ 'max_new_tokens': 512 │ │
│ │ │ │ │ } │ │
│ │ │ │ } │ │
│ │ │ } │ │
│ │ } │ │
│ │ self = <distilabel.pipeline.local.Pipeline object at 0x7a24ea48e0b0> │ │
│ │ use_cache = True │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ /usr/local/lib/python3.10/dist-packages/distilabel/pipeline/_dag.py:260 in validate │
│ │
│ 257 │ │ │ │ │ │ ) │
│ 258 │ │ │ │ │ self._validate_generator_step_process_signature(step) │
│ 259 │ │ │ │ else: │
│ ❱ 260 │ │ │ │ │ self._step_inputs_are_available(step) │
│ 261 │ │
│ 262 │ def _step_inputs_are_available(self, step: "_Step") -> None: │
│ 263 │ │ """Validates that the `Step.inputs` will be available when the step gets to be │
│ │
│ ╭──────────────────────────────────────── locals ────────────────────────────────────────╮ │
│ │ self = <distilabel.pipeline._dag.DAG object at 0x7a24ea48e4a0> │ │
│ │ step = TextGeneration( │ │
│ │ │ name='generate_with_gpt35', │ │
│ │ │ input_mappings={}, │ │
│ │ │ output_mappings={}, │ │
│ │ │ input_batch_size=50, │ │
│ │ │ llm=OpenAILLM( │ │
│ │ │ │ generation_kwargs={ │ │
│ │ │ │ │ 'temperature': 0.7, │ │
│ │ │ │ │ 'max_new_tokens': 512 │ │
│ │ │ │ }, │ │
│ │ │ │ model='gpt-3.5-turbo', │ │
│ │ │ │ base_url='https://api.openai.com/v1', │ │
│ │ │ │ api_key=None, │ │
│ │ │ │ max_retries=6, │ │
│ │ │ │ timeout=120 │ │
│ │ │ ), │ │
│ │ │ group_generations=False, │ │
│ │ │ num_generations=1 │ │
│ │ ) │ │
│ │ step_name = 'generate_with_gpt35' │ │
│ │ steps = ['generate_with_gpt35'] │ │
│ │ trophic_level = 2 │ │
│ ╰────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ /usr/local/lib/python3.10/dist-packages/distilabel/pipeline/_dag.py:277 in │
│ _step_inputs_are_available │
│ │
│ 274 │ │ ] │
│ 275 │ │ step_inputs = step.get_inputs() │
│ 276 │ │ if not all(input in inputs_available_for_step for input in step_inputs): │
│ ❱ 277 │ │ │ raise ValueError( │
│ 278 │ │ │ │ f"Step '{step.name}' requires inputs {step_inputs} which are not" │
│ 279 │ │ │ │ f" available when the step gets to be executed in the pipeline." │
│ 280 │ │ │ │ f" Please make sure previous steps to '{step.name}' are generating" │
│ │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │ inputs_available_for_step = ['Answer', 'Answer'] │ │
│ │ self = <distilabel.pipeline._dag.DAG object at 0x7a24ea48e4a0> │ │
│ │ step = TextGeneration( │ │
│ │ │ name='generate_with_gpt35', │ │
│ │ │ input_mappings={}, │ │
│ │ │ output_mappings={}, │ │
│ │ │ input_batch_size=50, │ │
│ │ │ llm=OpenAILLM( │ │
│ │ │ │ generation_kwargs={ │ │
│ │ │ │ │ 'temperature': 0.7, │ │
│ │ │ │ │ 'max_new_tokens': 512 │ │
│ │ │ │ }, │ │
│ │ │ │ model='gpt-3.5-turbo', │ │
│ │ │ │ base_url='https://api.openai.com/v1', │ │
│ │ │ │ api_key=None, │ │
│ │ │ │ max_retries=6, │ │
│ │ │ │ timeout=120 │ │
│ │ │ ), │ │
│ │ │ group_generations=False, │ │
│ │ │ num_generations=1 │ │
│ │ ) │ │
│ │ step_inputs = ['instruction'] │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
ValueError: Step 'generate_with_gpt35' requires inputs ['instruction'] which are not available when the step gets
to be executed in the pipeline. Please make sure previous steps to 'generate_with_gpt35' are generating the
required inputs. Available inputs are: ['Answer', 'Answer']
from distilabel.
Hi @KaifAhmad1 as the error says, the step generate_with_gpt35
requires an input named instruction
, but the dataset you are loading doesn't have a column with that name.
Assuming the Question
is the instruction you want to use as the instruction for the task, you could do the following:
load_dataset = LoadHubDataset(
name="load_dataset",
output_mappings={"Question": "instruction"},
)
or instead if you don't modify the output_mappings
, you can get the same from:
generate_with_openai = TextGeneration(
name="generate_with_gpt35", llm=OpenAILLM(model="gpt-3.5-turbo"),
input_mappings={"instruction": "Question"}
)
You can find more info here in the docs.
from distilabel.
Related Issues (20)
- [FEATURE] Add `O1AILLM`
- [FEATURE] Saving/Loading of Distiset with S3 bucket (or locally) HOT 4
- [FEATURE] Improve cache writing
- [FEATURE] Add `requirements` in `Pipeline`
- [CI] Install both `minimum` and `latest` dependencies in CI HOT 2
- [IMPROVEMENT] `PrometheusEval` support for multi-turn evaluation HOT 1
- [FEATURE] Implement "Improving Text Embeddings with LLMs"
- [BUG] 501 (Not Implemented) Response when trying to load HF dataset HOT 7
- [BUG] "An attempt has been made to start a new process before the current process has finished its bootstrapping phase." HOT 1
- [BUG] reponse_format - Unexpected keyword argument HOT 1
- [FEATURE] Make `LoadHubDataset` more general to read local files HOT 3
- [DOCS] Update cite information HOT 3
- [FEATURE] Add functionality to read/pass HF_TOKEN from cache/env var.
- [DOCS] Update document structure and format
- [DOCS] Update document phrasing and funnel
- [DOCS] Add examples for the components gallery
- [FEATURE] show raw input/response within tasks
- [FEATURE] trying to reload a already loaded `Step` results in an ambiguous error
- [BUG] `TogetherLLM` only works with json response format
- [BUG] `EvolQuality._apply_random_mutation` only uses last character of response
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from distilabel.