-
Notifications
You must be signed in to change notification settings - Fork 817
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
The InferenceClient
and AsyncInferenceClient
both hardcode the conversational
task when creating the TaskProviderHelper
. Since the conversational
task is now deprecated, many models use the more general text-generation
task, which causes chat_completion
inference to fail.
AsyncInferenceClient call to get_provider_helper
:
provider_helper = get_provider_helper(self.provider, task="conversational", model=payload_model) |
Reproduction
# Only slightly modified from the Chat Completion example:
# https://huggingface.co/docs/inference-providers/en/tasks/chat-completion#code-snippet-example-for-conversational-llms
import os
from huggingface_hub import InferenceClient
client = InferenceClient(
api_key=os.environ["HUGGINGFACEHUB_API_TOKEN"],
)
completion = client.chat.completions.create(
model="SanjiWatsuki/Kunoichi-DPO-v2-7B",
messages=[
{
"role": "user",
"content": "How are you today?"
}
],
)
print(completion.choices[0].message)
Logs
Traceback (most recent call last):
File "/home/user/dev/python/test/repro.py", line 8, in <module>
completion = client.chat.completions.create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.pyenv/versions/venv/lib/python3.12/site-packages/huggingface_hub/inference/_client.py", line 912, in chat_completion
request_parameters = provider_helper.prepare_request(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.pyenv/versions/venv/lib/python3.12/site-packages/huggingface_hub/inference/_providers/_common.py", line 92, in prepare_request
provider_mapping_info = self._prepare_mapping_info(model)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.pyenv/versions/venv/lib/python3.12/site-packages/huggingface_hub/inference/_providers/_common.py", line 170, in _prepare_mapping_info
raise ValueError(
ValueError: Model SanjiWatsuki/Kunoichi-DPO-v2-7B is not supported for task conversational and provider featherless-ai. Supported task: text-generation.
System info
- huggingface-hub version: 0.35.3
- Python version: 3.12.8
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working