huggingface / huggingface/cookbook

ValidationError: 1 validation error for agenerate

Open
#90 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
2.7k
Forks
417
Avg merge
17h
Merged PRs (30d)
3

Description

Hello, @merveenoyan. While my issue isn't directly related to the cookbook, I've encountered an error while using your reference guide for building an instruct dataset using PDFs. I've raised this concern on the agrilla/distilabel repository but haven't received a proper answer yet.

I've attached my notebook along with your cookbook example.
Reference Cookbook Example: https://huggingface.co/learn/cookbook/pipeline_notus_instructions_preferences_legal
Notebook link: https://github.com/KaifAhmad1/code-test/blob/main/Dataset_Creation_using_Distilabel.ipynb

Issue link that I have raised on distilable: https://github.com/argilla-io/distilabel/issues/612

``` Python
class QuestionAnsweringTask(TextGeneration):
def generate_prompt(self, question: str) -> str:
prompt = Prompt(system_prompt=self.system_prompt, formatted_prompt=question)
formatted_prompt = prompt.format_as("llama2")
return formatted_prompt

def parse_output(self, output: str) -> Dict[str, str]:
return {"answer": output.strip()}

@property
def input_args_names(self) -> list[str]:
return ["question"]

@property
def output_args_names(self) -> list[str]:
return ["answer"]

from distilabel.llms.huggingface import InferenceEndpointsLLM

# Free serverless Inference API
llm = InferenceEndpointsLLM(
model_id="mistralai/Mistral-7B-Instruct-v0.2",
api_key="My HF Token"
)
llm.load()

# input
inputs = [{"question": "What's the second most populated city in Denmark?"}]
generation = llm.generate(inputs)
print(generation[0][0]["parsed_output"]["answer"])
```

```
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ in :3 │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │ Dataset = │ │
│ │ Dict = typing.Dict │ │
│ │ document = [ │ │
│ │ │ Document( │ │
│ │ │ │ page_content='EN EN \n \n \n EUROPEAN │ │
│ │ \nCOMMISSION \nBrussels, 21.4.2021 \nCOM(2021) 206 │ │
│ │ final'+308, │ │
│ │ │ │ metadata={ │ │
│ │ │ │ │ 'source': │ │
│ │ '/content/drive/MyDrive/EU_AI_Act_Doc.pdf', │ │
│ │ │ │ │ 'page': 0 │ │
│ │ │ │ } │ │
│ │ │ ), │ │
│ │ │ Document( │ │
│ │ │ │ page_content='EN 1 EN EXPLANATORY MEMORANDUM \n1. │ │
│ │ CONTEXT OF THE PROPOSAL \n1.1. Reasons fo'+3873, │ │
│ │ │ │ metadata={ │ │
│ │ │ │ │ 'source': │ │
│ │ '/content/drive/MyDrive/EU_AI_Act_Doc.pdf', │ │
│ │ │ │ │ 'page': 1 │ │
│ │ │ │ } │ │
│ │ │ ), │ │
│ │ │ Document( │ │
│ │ │ │ page_content='EN 2 EN intelligence as stated by │ │
│ │ the European Council3 and ensures the protect'+4148, │ │
│ │ │ │ metadata={ │ │
│ │ │ │ │ 'source': │ │
│ │ '/content/drive/MyDrive/EU_AI_Act_Doc.pdf', │ │
│ │ │ │ │ 'page': 2 │ │
│ │ │ │ } │ │
│ │ │ ), │ │
│ │ │ Document( │ │
│ │ │ │ page_content='EN 3 EN proposal takes into account │ │
│ │ the aforementioned resolution of the Europe'+3626, │ │
│ │ │ │ metadata={ │ │
│ │ │ │ │ 'source': │ │
│ │ '/content/drive/MyDrive/EU_AI_Act_Doc.pdf', │ │
│ │ │ │ │ 'page': 3 │ │
│ │ │ │ } │ │
│ │ │ ), │ │
│ │ │ Document( │ │
│ │ │ │ page_content='EN 4 EN 1.2. Consistency with │ │
│ │ existing policy pr ovisions in the policy area \n'+3902, │ │
│ │ │ │ metadata={ │ │
│ │ │ │ │ 'source': │ │
│ │ '/content/drive/MyDrive/EU_AI_Act_Doc.pdf', │ │
│ │ │ │ │ 'page': 4 │ │
│ │ │ │ } │ │
│ │ │ ), │ │
│ │ │ Document( │ │
│ │ │ │ page_content='EN 5 EN This proposal is also │ │
│ │ consistent with the applicable Union legislation '+3839, │ │
│ │ │ │ metadata={ │ │
│ │ │ │ │ 'source': │ │
│ │ '/content/drive/MyDrive/EU_AI_Act_Doc.pdf', │ │
│ │ │ │ │ 'page': 5 │ │
│ │ │ │ } │ │
│ │ │ ), │ │
│ │ │ Document( │ │
│ │ │ │ page_content='EN 6 EN 2. LEGAL BASIS, │ │
│ │ SUBSIDIARITY AND PROPORTIONALITY \n2.1. Legal │ │
│ │ basi'+3628, │ │
│ │ │ │ metadata={ │ │
│ │ │ │ │ 'source': │ │
│ │ '/content/drive/MyDrive/EU_AI_Act_Doc.pdf', │ │
│ │ │ │ │ 'page': 6 │ │
│ │ │ │ } │ │
│ │ │ ), │ │
│ │ │ Document( │ │
│ │ │ │ page_content='EN 7 EN 2.3. Proportionality \nThe │ │
│ │ proposal builds on existing legal frameworks'+3464, │ │
│ │ │ │ metadata={ │ │
│ │ │ │ │ 'source': │ │
│ │ '/content/drive/MyDrive/EU_AI_Act_Doc.pdf', │ │
│ │ │ │ │ 'page': 7 │ │
│ │ │ │ } │ │
│ │ │ ), │ │
│ │ │ Document( │ │
│ │ │ │ page_content='EN 8 EN academic/research │ │
│ │ institutions, a nd 73 from public authorities. Civil │ │
│ │ '+3721, │ │
│ │ │ │ metadata={ │ │
│ │ │ │ │ 'source': │ │
│ │ '/content/drive/MyDrive/EU_AI_Act_Doc.pdf', │ │
│ │ │ │ │ 'page': 8 │ │
│ │ │ │ } │ │
│ │ │ ), │ │
│ │ │ Document( │ │
│ │ │ │ page_content='EN 9 EN In addition, the AI │ │
│ │ Alliance26 was formed as a platform for approximate'+3401, │ │
│ │ │ │ metadata={ │ │
│ │ │ │ │ 'source': │ │
│ │ '/content/drive/MyDrive/EU_AI_Act_Doc.pdf', │ │
│ │ │ │ │ 'page': 9 │ │
│ │ │ │ } │ │
│ │ │ ), │ │
│ │ │ ... +98 │ │
│ │ ] │ │
│ │ drive = │ │
│ │ get_ipython = > │ │
│ │ In = [ │ │
│ │ │ '', │ │
│ │ │ "get_ipython().system('pip install -qU distilabel │ │
│ │ langchain pypdf')", │ │
│ │ │ 'import os\nfrom typing import Dict\nfrom │ │
│ │ distilabel.llms.huggingface import Infere'+120, │ │
│ │ │ 'os.environ["HF_TOKEN"] = │ │
│ │ "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"\nos.environ["HF_'+… │ │
│ │ │ 'from datasets import Dataset\nfrom │ │
│ │ langchain_community.document_loaders import Py'+9, │ │
│ │ │ "from google.colab import │ │
│ │ drive\ndrive.mount('/content/drive')", │ │
│ │ │ 'loader = │ │
│ │ PyPDFLoader("/content/drive/MyDrive/EU_AI_Act_Doc.pdf")\nd… │ │
│ │ = load'+9, │ │
│ │ │ 'print(len(document))', │ │
│ │ │ 'from langchain.text_splitter import │ │
│ │ RecursiveCharacterTextSplitter\nMARKDOWN_SEPA'+318, │ │
│ │ │ 'splits = text_splitter.split_documents(document)', │ │
│ │ │ ... +46 │ │
│ │ ] │ │
│ │ InferenceEndpointsLLM = │ │
│ │ MARKDOWN_SEPARATORS = [ │ │
│ │ │ '\n#{1,6} ', │ │
│ │ │ '```\n', │ │
│ │ │ '\n\\*\\*\\*+\n', │ │
│ │ │ '\n---+\n', │ │
│ │ │ '\n___+\n', │ │
│ │ │ '\n\n', │ │
│ │ │ '\n', │ │
│ │ │ ' ', │ │
│ │ │ '' │ │
│ │ ] │ │
│ │ os = │ │
│ │ Out = { │ │
│ │ │ 10: 'EN 6 EN 2. LEGAL BASIS, SUBSIDIARITY AND │ │
│ │ PROPORTIONALITY \n2.1. Legal basi'+901, │ │
│ │ │ 11: 'EN EN \n \n \n EUROPEAN \nCOMMISSION │ │
│ │ \nBrussels, 21.4.2021 \nCOM(2021) 206 final'+308, │ │
│ │ │ 12: Dataset({ │ │
│ │ │ features: ['input'], │ │
│ │ │ num_rows: 50 │ │
│ │ }), │ │
│ │ │ 31: 'EN 6 EN 2. LEGAL BASIS, SUBSIDIARITY AND │ │
│ │ PROPORTIONALITY \n2.1. Legal basi'+901, │ │
│ │ │ 32: 'EN EN \n \n \n EUROPEAN \nCOMMISSION │ │
│ │ \nBrussels, 21.4.2021 \nCOM(2021) 206 final'+308, │ │
│ │ │ 33: Dataset({ │ │
│ │ │ features: ['input'], │ │
│ │ │ num_rows: 50 │ │
│ │ }), │ │
│ │ │ 47: 'EN 6 EN 2. LEGAL BASIS, SUBSIDIARITY AND │ │
│ │ PROPORTIONALITY \n2.1. Legal basi'+901, │ │
│ │ │ 48: 'EN EN \n \n \n EUROPEAN \nCOMMISSION │ │
│ │ \nBrussels, 21.4.2021 \nCOM(2021) 206 final'+308, │ │
│ │ │ 49: Dataset({ │ │
│ │ │ features: ['input'], │ │
│ │ │ num_rows: 50 │ │
│ │ }) │ │
│ │ } │ │
│ │ Pipeline = │ │
│ │ PyPDFLoader = │ │
│ │ QuestionAnsweringTask = │ │
│ │ quit = │ │
│ │ RecursiveCharacterTextSplitter = │ │
│ │ splits = [ │ │
│ │ │ Document( │ │
│ │ │ │ page_content='EN EN \n \n \n EUROPEAN │ │
│ │ \nCOMMISSION \nBrussels, 21.4.2021 \nCOM(2021) 206 │ │
│ │ final'+305, │ │
│ │ │ │ metadata={ │ │
│ │ │ │ │ 'source': │ │
│ │ '/content/drive/MyDrive/EU_AI_Act_Doc.pdf', │ │
│ │ │ │ │ 'page': 0, │ │
│ │ │ │ │ 'start_index': 0 │ │
│ │ │ │ } │ │
│ │ │ ), │ │
│ │ │ Document( │ │
│ │ │ │ page_content='EN 1 EN EXPLANATORY MEMORANDUM \n1. │ │
│ │ CONTEXT OF THE PROPOSAL \n1.1. Reasons fo'+875, │ │
│ │ │ │ metadata={ │ │
│ │ │ │ │ 'source': │ │
│ │ '/content/drive/MyDrive/EU_AI_Act_Doc.pdf', │ │
│ │ │ │ │ 'page': 1, │ │
│ │ │ │ │ 'start_index': 0 │ │
│ │ │ │ } │ │
│ │ │ ), │ │
│ │ │ Document( │ │
│ │ │ │ page_content='elements and techniques that power │ │
│ │ the socio -economic benefits of AI can also b'+877, │ │
│ │ │ │ metadata={ │ │
│ │ │ │ │ 'source': │ │
│ │ '/content/drive/MyDrive/EU_AI_Act_Doc.pdf', │ │
│ │ │ │ │ 'page': 1, │ │
│ │ │ │ │ 'start_index': 957 │ │
│ │ │ │ } │ │
│ │ │ ), │ │
│ │ │ Document( │ │
│ │ │ │ page_content='to excellence and trust2. The White │ │
│ │ Paper sets out policy options on how to ach'+848, │ │
│ │ │ │ metadata={ │ │
│ │ │ │ │ 'source': │ │
│ │ '/content/drive/MyDrive/EU_AI_Act_Doc.pdf', │ │
│ │ │ │ │ 'page': 1, │ │
│ │ │ │ │ 'start_index': 1916 │ │
│ │ │ │ } │ │
│ │ │ ), │ │
│ │ │ Document( │ │
│ │ │ │ page_content='of fundamental rights. Following the │ │
│ │ publication of the White Paper, the Commiss'+887, │ │
│ │ │ │ metadata={ │ │
│ │ │ │ │ 'source': │ │
│ │ '/content/drive/MyDrive/EU_AI_Act_Doc.pdf', │ │
│ │ │ │ │ 'page': 1, │ │
│ │ │ │ │ 'start_index': 2846 │ │
│ │ │ │ } │ │
│ │ │ ), │ │
│ │ │ Document( │ │
│ │ │ │ page_content='2 European Commission, White Paper on │ │
│ │ Artificial Intelligence - A European appro'+55, │ │
│ │ │ │ metadata={ │ │
│ │ │ │ │ 'source': │ │
│ │ '/content/drive/MyDrive/EU_AI_Act_Doc.pdf', │ │
│ │ │ │ │ 'page': 1, │ │
│ │ │ │ │ 'start_index': 3816 │ │
│ │ │ │ } │ │
│ │ │ ), │ │
│ │ │ Document( │ │
│ │ │ │ page_content='EN 2 EN intelligence as stated by │ │
│ │ the European Council3 and ensures the protect'+836, │ │
│ │ │ │ metadata={ │ │
│ │ │ │ │ 'source': │ │
│ │ '/content/drive/MyDrive/EU_AI_Act_Doc.pdf', │ │
│ │ │ │ │ 'page': 2, │ │
│ │ │ │ │ 'start_index': 0 │ │
│ │ │ │ } │ │
│ │ │ ), │ │
│ │ │ Document( │ │
│ │ │ │ page_content='The most recent Conclusi ons from 21 │ │
│ │ October 2020 further called for addressing'+876, │ │
│ │ │ │ metadata={ │ │
│ │ │ │ │ 'source': │ │
│ │ '/content/drive/MyDrive/EU_AI_Act_Doc.pdf', │ │
│ │ │ │ │ 'page': 2, │ │
│ │ │ │ │ 'start_index': 919 │ │
│ │ │ │ } │ │
│ │ │ ), │ │
│ │ │ Document( │ │
│ │ │ │ page_content='resolution includes a text of the │ │
│ │ legislative proposal for a regulation on ethic'+880, │ │
│ │ │ │ metadata={ │ │
│ │ │ │ │ 'source': │ │
│ │ '/content/drive/MyDrive/EU_AI_Act_Doc.pdf', │ │
│ │ │ │ │ 'page': 2, │ │
│ │ │ │ │ 'start_index': 1877 │ │
│ │ │ │ } │ │
│ │ │ ), │ │
│ │ │ Document( │ │
│ │ │ │ page_content='artificial intelligence -Adoption │ │
│ │ 6177/19, 2019. \n7 European Council, Special '+894, │ │
│ │ │ │ metadata={ │ │
│ │ │ │ │ 'source': │ │
│ │ '/content/drive/MyDrive/EU_AI_Act_Doc.pdf', │ │
│ │ │ │ │ 'page': 2, │ │
│ │ │ │ │ 'start_index': 2839 │ │
│ │ │ │ } │ │
│ │ │ ), │ │
│ │ │ ... +372 │ │
│ │ ] │ │
│ │ text_splitter = │ │
│ │ TextGeneration = │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ /usr/local/lib/python3.10/dist-packages/distilabel/llms/huggingface/inference_endpoints.py:407 │
│ in generate │
│ │
│ 404 │ │ │ ] │
│ 405 │ │ │ return [outputs[0] for outputs in await asyncio.gather(*tasks)] │
│ 406 │ │ │
│ ❱ 407 │ │ outputs = self.event_loop.run_until_complete(agenerate(inputs, **kwargs)) │
│ 408 │ │ return list(grouper(outputs, n=num_generations, incomplete="ignore")) │
│ 409 │
│ │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │ agenerate = .agenerate at │ │
│ │ 0x7db0973eb1c0> │ │
│ │ inputs = [{'question': "What's the second most populated city in Denmark?"}] │ │
│ │ kwargs = {} │ │
│ │ num_generations = 1 │ │
│ │ self = InferenceEndpointsLLM( │ │
│ │ │ generation_kwargs={}, │ │
│ │ │ model_id='mistralai/Mistral-7B-Instruct-v0.2', │ │
│ │ │ endpoint_name=None, │ │
│ │ │ endpoint_namespace=None, │ │
│ │ │ │ │
│ │ base_url='https://api-inference.huggingface.co/models/mistralai/Mistral-7… │ │
│ │ │ api_key=SecretStr('**********'), │ │
│ │ │ tokenizer_id=None, │ │
│ │ │ model_display_name=None, │ │
│ │ │ use_openai_client=False │ │
│ │ ) │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ /usr/local/lib/python3.10/dist-packages/nest_asyncio.py:98 in run_until_complete │
│ │
│ 95 │ │ │ if not f.done(): │
│ 96 │ │ │ │ raise RuntimeError( │
│ 97 │ │ │ │ │ 'Event loop stopped before Future completed.') │
│ ❱ 98 │ │ │ return f.result() │
│ 99 │ │
│ 100 │ def _run_once(self): │
│ 101 │ │ """ │
│ │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │ f = .agenerate() done, defined at │ │
│ │ /usr/local/lib/python3.10/dist-packages/distilabel/llms/huggingface/inference_… │ │
│ │ exception=1 validation error for agenerate │ │
│ │ input │ │
│ │ Input should be a valid list [type=list_type, input_value={'question': │ │
│ │ "What's the ...lated city in Denmark?"}, input_type=dict] │ │
│ │ │ For further information visit https://errors.pydantic.dev/2.7/v/list_type> │ │
│ │ future = .agenerate at │ │
│ │ 0x7db0979c57e0> │ │
│ │ manage_run = .manage_run at 0x7db0ad7fb010> │ │
│ │ self = <_UnixSelectorEventLoop running=True closed=False debug=False> │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ /usr/lib/python3.10/asyncio/futures.py:201 in result │
│ │
│ 198 │ │ │ raise exceptions.InvalidStateError('Result is not ready.') │
│ 199 │ │ self.__log_traceback = False │
│ 200 │ │ if self._exception is not None: │
│ ❱ 201 │ │ │ raise self._exception.with_traceback(self._exception_tb) │
│ 202 │ │ return self._result │
│ 203 │ │
│ 204 │ def exception(self): │
│ │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │ self = .agenerate() done, defined at │ │
│ │ /usr/local/lib/python3.10/dist-packages/distilabel/llms/huggingface/inference_endpoi… │ │
│ │ exception=1 validation error for agenerate │ │
│ │ input │ │
│ │ Input should be a valid list [type=list_type, input_value={'question': "What's the │ │
│ │ ...lated city in Denmark?"}, input_type=dict] │ │
│ │ │ For further information visit https://errors.pydantic.dev/2.7/v/list_type> │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ /usr/lib/python3.10/asyncio/tasks.py:232 in __step │
│ │
│ 229 │ │ │ if exc is None: │
│ 230 │ │ │ │ # We use the `send` method directly, because coroutines │
│ 231 │ │ │ │ # don't have `__iter__` and `__next__` methods. │
│ ❱ 232 │ │ │ │ result = coro.send(None) │
│ 233 │ │ │ else: │
│ 234 │ │ │ │ result = coro.throw(exc) │
│ 235 │ │ except StopIteration as exc: │
│ │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │ coro = .agenerate at │ │
│ │ 0x7db0979c57e0> │ │
│ │ self = None │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ /usr/local/lib/python3.10/dist-packages/distilabel/llms/huggingface/inference_endpoints.py:400 │
│ in agenerate │
│ │
│ 397 │ │ │ inputs: List["ChatType"], **kwargs: Any │
│ 398 │ │ ) -> "GenerateOutput": │
│ 399 │ │ │ """Internal function to parallelize the asynchronous generation of responses │
│ ❱ 400 │ │ │ tasks = [ │
│ 401 │ │ │ │ asyncio.create_task(self.agenerate(input=input, **kwargs)) │
│ 402 │ │ │ │ for input in inputs │
│ 403 │ │ │ │ for _ in range(num_generations) │
│ │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │ inputs = [{'question': "What's the second most populated city in Denmark?"}] │ │
│ │ kwargs = {} │ │
│ │ num_generations = 1 │ │
│ │ self = InferenceEndpointsLLM( │ │
│ │ │ generation_kwargs={}, │ │
│ │ │ model_id='mistralai/Mistral-7B-Instruct-v0.2', │ │
│ │ │ endpoint_name=None, │ │
│ │ │ endpoint_namespace=None, │ │
│ │ │ │ │
│ │ base_url='https://api-inference.huggingface.co/models/mistralai/Mistral-7… │ │
│ │ │ api_key=SecretStr('**********'), │ │
│ │ │ tokenizer_id=None, │ │
│ │ │ model_display_name=None, │ │
│ │ │ use_openai_client=False │ │
│ │ ) │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ /usr/local/lib/python3.10/dist-packages/distilabel/llms/huggingface/inference_endpoints.py:401 │
│ in │
│ │
│ 398 │ │ ) -> "GenerateOutput": │
│ 399 │ │ │ """Internal function to parallelize the asynchronous generation of responses │
│ 400 │ │ │ tasks = [ │
│ ❱ 401 │ │ │ │ asyncio.create_task(self.agenerate(input=input, **kwargs)) │
│ 402 │ │ │ │ for input in inputs │
│ 403 │ │ │ │ for _ in range(num_generations) │
│ 404 │ │ │ ] │
│ │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │ .0 = │ │
│ │ input = {'question': "What's the second most populated city in Denmark?"} │ │
│ │ kwargs = {} │ │
│ │ num_generations = 1 │ │
│ │ self = InferenceEndpointsLLM( │ │
│ │ │ generation_kwargs={}, │ │
│ │ │ model_id='mistralai/Mistral-7B-Instruct-v0.2', │ │
│ │ │ endpoint_name=None, │ │
│ │ │ endpoint_namespace=None, │ │
│ │ │ │ │
│ │ base_url='https://api-inference.huggingface.co/models/mistralai/Mistral-7… │ │
│ │ │ api_key=SecretStr('**********'), │ │
│ │ │ tokenizer_id=None, │ │
│ │ │ model_display_name=None, │ │
│ │ │ use_openai_client=False │ │
│ │ ) │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ /usr/local/lib/python3.10/dist-packages/pydantic/validate_call_decorator.py:59 in │
│ wrapper_function │
│ │
│ 56 │ │ │
│ 57 │ │ @functools.wraps(function) │
│ 58 │ │ def wrapper_function(*args, **kwargs): │
│ ❱ 59 │ │ │ return validate_call_wrapper(*args, **kwargs) │
│ 60 │ │ │
│ 61 │ │ wrapper_function.raw_function = function # type: ignore │
│ 62 │
│ │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │ args = ( │ │
│ │ │ InferenceEndpointsLLM( │ │
│ │ │ │ generation_kwargs={}, │ │
│ │ │ │ model_id='mistralai/Mistral-7B-Instruct-v0.2', │ │
│ │ │ │ endpoint_name=None, │ │
│ │ │ │ endpoint_namespace=None, │ │
│ │ │ │ │ │
│ │ base_url='https://api-inference.huggingface.co/models/mistralai/Mis… │ │
│ │ │ │ api_key=SecretStr('**********'), │ │
│ │ │ │ tokenizer_id=None, │ │
│ │ │ │ model_display_name=None, │ │
│ │ │ │ use_openai_client=False │ │
│ │ │ ), │ │
│ │ ) │ │
│ │ kwargs = { │ │
│ │ │ 'input': { │ │
│ │ │ │ 'question': "What's the second most populated city in │ │
│ │ Denmark?" │ │
│ │ │ } │ │
│ │ } │ │
│ │ validate_call_wrapper = │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ /usr/local/lib/python3.10/dist-packages/pydantic/_internal/_validate_call.py:81 in __call__ │
│ │
│ 78 │ │ │ self.__return_pydantic_validator__ = None │
│ 79 │ │
│ 80 │ def __call__(self, *args: Any, **kwargs: Any) -> Any: │
│ ❱ 81 │ │ res = self.__pydantic_validator__.validate_python(pydantic_core.ArgsKwargs(args, │
│ 82 │ │ if self.__return_pydantic_validator__: │
│ 83 │ │ │ return self.__return_pydantic_validator__(res) │
│ 84 │ │ return res │
│ │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │ args = ( │ │
│ │ │ InferenceEndpointsLLM( │ │
│ │ │ │ generation_kwargs={}, │ │
│ │ │ │ model_id='mistralai/Mistral-7B-Instruct-v0.2', │ │
│ │ │ │ endpoint_name=None, │ │
│ │ │ │ endpoint_namespace=None, │ │
│ │ │ │ │ │
│ │ base_url='https://api-inference.huggingface.co/models/mistralai/Mistral-7B-Instruc… │ │
│ │ │ │ api_key=SecretStr('**********'), │ │
│ │ │ │ tokenizer_id=None, │ │
│ │ │ │ model_display_name=None, │ │
│ │ │ │ use_openai_client=False │ │
│ │ │ ), │ │
│ │ ) │ │
│ │ kwargs = {'input': {'question': "What's the second most populated city in Denmark?"}} │ │
│ │ self = │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
ValidationError: 1 validation error for agenerate
input
Input should be a valid list [type=list_type, input_value={'question': "What's the ...lated city in Denmark?"},
input_type=dict]
For further information visit https://errors.pydantic.dev/2.7/v/list_type

```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by comparing the linked cookbook example with Dataset_Creation_using_Distilabel.ipynb and reproduce the shown ValidationError using the provided Python snippet. Read the related distilabel issue 612 alongside the traceback to determine whether the problem is in the cookbook example or the referenced dependency. Done should be a confirmed cause and a clear resolution or correction to the guide.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter-notebook, python
Domain
documentation, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.