# Problem arise after one week: Bad request: "Task not found for this model"

**URL:** <https://discuss.huggingface.co/t/problem-arise-after-one-week-bad-request-task-not-found-for-this-model/130130>\
**Category:** Beginners\
**Created:** [December 9, 2024, 9:54am UTC](https://discuss.huggingface.co/t/problem-arise-after-one-week-bad-request-task-not-found-for-this-model/130130 "2024-12-09T09:54:22Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![davnas](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/davnas/32/37113_2.png) [@davnas](https://discuss.huggingface.co/u/davnas)\
**Post date:** [December 9, 2024, 9:54am UTC](https://discuss.huggingface.co/t/problem-arise-after-one-week-bad-request-task-not-found-for-this-model/130130/1 "2024-12-09T09:54:23Z")

</div>

Hello, sorry for the unusual request. I’m working on an assignment where we need to fine-tune a model using Unsloath and then publish a UI on Hugging Face. I created my model called `"davnas/Italian_Cuisine_1.2"` using the Unsloath Colab, and I successfully uploaded it to Hugging Face.

Last week, everything was working fine. However, yesterday, after switching from my friend’s model back to mine, I started encountering the following error:

**Bad request: Task not found for this model**

Even after attempting to revert to the original setup, the problem persists.

Could someone please help me troubleshoot this issue? Apologies for any mistakes in the description—I’m still learning and just getting started. Thank you!

I usually perform inference with

```auto
from transformers import AutoModel, AutoTokenizer

max_seq_length = 2048 # Choose any! We auto support ROPE scaling internally!
dtype = None # None for auto detection. Float16 for Tesla T4, V100, bFloat16 for Ampere+

model_name_or_path = "davnas/Italian_Cousine_1.2"

from unsloth import FastLanguageModel
import torch

model, tokenizer = FastLanguageModel.from_pretrained(
    model_name=model_name_or_path,
    max_seq_length=max_seq_length,
    dtype=dtype,
    load_in_4bit=True,
    # token = "hf_...", #se il nostro modello non è public
    # Use one if using gated models like meta-llama/Llama-2-7b-hf
)

```

and

```auto

from unsloth import FastLanguageModel

FastLanguageModel.for_inference(model) # Enable native 2x faster inference

messages = [
    {"role": "user", "content": "How can I cook an smoothie?"},
]

inputs = tokenizer.apply_chat_template(
    messages,
    tokenize=True,
    add_generation_prompt=True, # Must add for generation
    return_tensors="pt",
).to("cuda")

from transformers import TextStreamer
text_streamer = TextStreamer(tokenizer, skip_prompt=True)

model.generate(input_ids=inputs, streamer=text_streamer, max_new_tokens=128,
               use_cache=True, temperature=1.5, min_p=0.1)

```

the code used for training the model can be found here

> <https://github.com/davidenascivera/LAB2_Scalable/blob/main/FineTunedItalianCousineReview.ipynb>

lastly the full error is:

```auto
===== Application Startup at 2024-12-07 09:20:41 =====

/usr/local/lib/python3.10/site-packages/gradio/components/chatbot.py:228: UserWarning: The 'tuples' format for chatbot messages is deprecated and will be removed in a future version of Gradio. Please set type='messages' instead, which uses openai-style 'role' and 'content' keys.
  warnings.warn(
* Running on local URL: http://0.0.0.0:7860, with SSR ⚡

To create a public link, set `share=True` in `launch()`.
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/huggingface_hub/utils/_http.py", line 406, in hf_raise_for_status
    response.raise_for_status()
  File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 1024, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://api-inference.huggingface.co/models/davnas/Italian_Cousine_1.2/v1/chat/completions

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/gradio/queueing.py", line 622, in process_events
    response = await route_utils.call_process_api(
  File "/usr/local/lib/python3.10/site-packages/gradio/route_utils.py", line 323, in call_process_api
    output = await app.get_blocks().process_api(
  File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 2016, in process_api
    result = await self.call_function(
  File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 1581, in call_function
    prediction = await utils.async_iteration(iterator)
  File "/usr/local/lib/python3.10/site-packages/gradio/utils.py", line 691, in async_iteration
    return await anext(iterator)
  File "/usr/local/lib/python3.10/site-packages/gradio/utils.py", line 796, in asyncgen_wrapper
    response = await iterator. __anext__ ()
  File "/usr/local/lib/python3.10/site-packages/gradio/chat_interface.py", line 667, in _stream_fn
    first_response = await async_iteration(generator)
  File "/usr/local/lib/python3.10/site-packages/gradio/utils.py", line 691, in async_iteration
    return await anext(iterator)
  File "/usr/local/lib/python3.10/site-packages/gradio/utils.py", line 685, in __anext__
    return await anyio.to_thread.run_sync(
  File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 56, in run_sync
    return await get_async_backend().run_sync_in_worker_thread(
  File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2441, in run_sync_in_worker_thread
    return await future
  File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 943, in run
    result = context.run(func, *args)
  File "/usr/local/lib/python3.10/site-packages/gradio/utils.py", line 668, in run_sync_iterator_async
    return next(iterator)
  File "/home/user/app/app.py", line 30, in respond
    for message in client.chat_completion(
  File "/usr/local/lib/python3.10/site-packages/huggingface_hub/inference/_client.py", line 842, in chat_completion
    data = self.post(model=model_url, json=payload, stream=stream)
  File "/usr/local/lib/python3.10/site-packages/huggingface_hub/inference/_client.py", line 305, in post
    hf_raise_for_status(response)
  File "/usr/local/lib/python3.10/site-packages/huggingface_hub/utils/_http.py", line 460, in hf_raise_for_status
    raise _format(BadRequestError, message, response) from e
huggingface_hub.errors.BadRequestError: (Request ID: BwTVVHXLmrcuAlpoxR2bH)

Bad request:
Task not found for this model
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/huggingface_hub/utils/_http.py", line 406, in hf_raise_for_status
    response.raise_for_status()
  File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 1024, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://api-inference.huggingface.co/models/davnas/Italian_Cousine_1.2/v1/chat/completions

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/gradio/queueing.py", line 622, in process_events
    response = await route_utils.call_process_api(
  File "/usr/local/lib/python3.10/site-packages/gradio/route_utils.py", line 323, in call_process_api
    output = await app.get_blocks().process_api(
  File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 2016, in process_api
    result = await self.call_function(
  File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 1581, in call_function
    prediction = await utils.async_iteration(iterator)
  File "/usr/local/lib/python3.10/site-packages/gradio/utils.py", line 691, in async_iteration
    return await anext(iterator)
  File "/usr/local/lib/python3.10/site-packages/gradio/utils.py", line 796, in asyncgen_wrapper
    response = await iterator. __anext__ ()
  File "/usr/local/lib/python3.10/site-packages/gradio/chat_interface.py", line 667, in _stream_fn
    first_response = await async_iteration(generator)
  File "/usr/local/lib/python3.10/site-packages/gradio/utils.py", line 691, in async_iteration
    return await anext(iterator)
  File "/usr/local/lib/python3.10/site-packages/gradio/utils.py", line 685, in __anext__
    return await anyio.to_thread.run_sync(
  File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 56, in run_sync
    return await get_async_backend().run_sync_in_worker_thread(
  File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2441, in run_sync_in_worker_thread
    return await future
  File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 943, in run
    result = context.run(func, *args)
  File "/usr/local/lib/python3.10/site-packages/gradio/utils.py", line 668, in run_sync_iterator_async
    return next(iterator)
  File "/home/user/app/app.py", line 30, in respond
    for message in client.chat_completion(
  File "/usr/local/lib/python3.10/site-packages/huggingface_hub/inference/_client.py", line 842, in chat_completion
    data = self.post(model=model_url, json=payload, stream=stream)
  File "/usr/local/lib/python3.10/site-packages/huggingface_hub/inference/_client.py", line 305, in post
    hf_raise_for_status(response)
  File "/usr/local/lib/python3.10/site-packages/huggingface_hub/utils/_http.py", line 460, in hf_raise_for_status
    raise _format(BadRequestError, message, response) from e
huggingface_hub.errors.BadRequestError: (Request ID: GueVsTq3CZ9CNO2c2jVEg)

Bad request:
Task not found for this model

```

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](https://discuss.huggingface.co/u/John6666)\
**Post date:** [December 9, 2024, 10:42am UTC](https://discuss.huggingface.co/t/problem-arise-after-one-week-bad-request-task-not-found-for-this-model/130130/2 "2024-12-09T10:42:45Z")

</div>

The **Serverless Inference API is currently being degraded** , and all but the most famous models have been turned off. Since **unsloth** is relatively famous, it may still be usable in some cases…  
This is probably the cause.

There has also been a problem since the beginning that it does not work properly without a **README.md**. This is the configuration problem mentioned below.

> <https://github.com/huggingface/chat-ui/issues/1415>
>
> Hi all,
> I am facing the following issue when using HuggingFaceEndpoint for my c…ustom finetuned model in my repository "Nithish-2001/RAG-29520hd0-1-chat-finetune" which is public with gradio. 
> 
> llm\_name: Nithish-2001/RAG-29520hd0-1-chat-finetune
> Traceback (most recent call last):
> File "/usr/local/lib/python3.10/dist-packages/huggingface\_hub/utils/\_errors.py", line 304, in hf\_raise\_for\_status
> response.raise\_for\_status()
> File "/usr/local/lib/python3.10/dist-packages/requests/models.py", line 1024, in raise\_for\_status
> raise HTTPError(http\_error\_msg, response=self)
> requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://api-inference.huggingface.co/models/Nithish-2001/RAG-29520hd0-1-chat-finetune
> 
> The above exception was the direct cause of the following exception:
> 
> Traceback (most recent call last):
> File "/usr/local/lib/python3.10/dist-packages/gradio/routes.py", line 763, in predict
> output = await route\_utils.call\_process\_api(
> File "/usr/local/lib/python3.10/dist-packages/gradio/route\_utils.py", line 288, in call\_process\_api
> output = await app.get\_blocks().process\_api(
> File "/usr/local/lib/python3.10/dist-packages/gradio/blocks.py", line 1931, in process\_api
> result = await self.call\_function(
> File "/usr/local/lib/python3.10/dist-packages/gradio/blocks.py", line 1516, in call\_function
> prediction = await anyio.to\_thread.run\_sync( # type: ignore
> File "/usr/local/lib/python3.10/dist-packages/anyio/to\_thread.py", line 33, in run\_sync
> return await get\_asynclib().run\_sync\_in\_worker\_thread(
> File "/usr/local/lib/python3.10/dist-packages/anyio/\_backends/\_asyncio.py", line 877, in run\_sync\_in\_worker\_thread
> return await future
> File "/usr/local/lib/python3.10/dist-packages/anyio/\_backends/\_asyncio.py", line 807, in run
> result = context.run(func, \*args)
> File "/usr/local/lib/python3.10/dist-packages/gradio/utils.py", line 826, in wrapper
> response = f(\*args, \*\*kwargs)
> File "\<ipython-input-7-4e46265a5151\>", line 90, in conversation
> response = qa\_chain.invoke({"question": message, "chat\_history": formatted\_chat\_history})
> File "/usr/local/lib/python3.10/dist-packages/langchain/chains/base.py", line 164, in invoke
> raise e
> File "/usr/local/lib/python3.10/dist-packages/langchain/chains/base.py", line 154, in invoke
> self.\_call(inputs, run\_manager=run\_manager)
> File "/usr/local/lib/python3.10/dist-packages/langchain/chains/conversational\_retrieval/base.py", line 169, in \_call
> answer = self.combine\_docs\_chain.run(
> File "/usr/local/lib/python3.10/dist-packages/langchain\_core/\_api/deprecation.py", line 170, in warning\_emitting\_wrapper
> return wrapped(\*args, \*\*kwargs)
> File "/usr/local/lib/python3.10/dist-packages/langchain/chains/base.py", line 603, in run
> return self(kwargs, callbacks=callbacks, tags=tags, metadata=metadata)\[
> File "/usr/local/lib/python3.10/dist-packages/langchain\_core/\_api/deprecation.py", line 170, in warning\_emitting\_wrapper
> return wrapped(\*args, \*\*kwargs)
> File "/usr/local/lib/python3.10/dist-packages/langchain/chains/base.py", line 381, in \_\_call\_\_
> return self.invoke(
> File "/usr/local/lib/python3.10/dist-packages/langchain/chains/base.py", line 164, in invoke
> raise e
> File "/usr/local/lib/python3.10/dist-packages/langchain/chains/base.py", line 154, in invoke
> self.\_call(inputs, run\_manager=run\_manager)
> File "/usr/local/lib/python3.10/dist-packages/langchain/chains/combine\_documents/base.py", line 138, in \_call
> output, extra\_return\_dict = self.combine\_docs(
> File "/usr/local/lib/python3.10/dist-packages/langchain/chains/combine\_documents/stuff.py", line 257, in combine\_docs
> return self.llm\_chain.predict(callbacks=callbacks, \*\*inputs), {}
> File "/usr/local/lib/python3.10/dist-packages/langchain/chains/llm.py", line 316, in predict
> return self(kwargs, callbacks=callbacks)\[self.output\_key\]
> File "/usr/local/lib/python3.10/dist-packages/langchain\_core/\_api/deprecation.py", line 170, in warning\_emitting\_wrapper
> return wrapped(\*args, \*\*kwargs)
> File "/usr/local/lib/python3.10/dist-packages/langchain/chains/base.py", line 381, in \_\_call\_\_
> return self.invoke(
> File "/usr/local/lib/python3.10/dist-packages/langchain/chains/base.py", line 164, in invoke
> raise e
> File "/usr/local/lib/python3.10/dist-packages/langchain/chains/base.py", line 154, in invoke
> self.\_call(inputs, run\_manager=run\_manager)
> File "/usr/local/lib/python3.10/dist-packages/langchain/chains/llm.py", line 126, in \_call
> response = self.generate(\[inputs\], run\_manager=run\_manager)
> File "/usr/local/lib/python3.10/dist-packages/langchain/chains/llm.py", line 138, in generate
> return self.llm.generate\_prompt(
> File "/usr/local/lib/python3.10/dist-packages/langchain\_core/language\_models/llms.py", line 750, in generate\_prompt
> return self.generate(prompt\_strings, stop=stop, callbacks=callbacks, \*\*kwargs)
> File "/usr/local/lib/python3.10/dist-packages/langchain\_core/language\_models/llms.py", line 944, in generate
> output = self.\_generate\_helper(
> File "/usr/local/lib/python3.10/dist-packages/langchain\_core/language\_models/llms.py", line 787, in \_generate\_helper
> raise e
> File "/usr/local/lib/python3.10/dist-packages/langchain\_core/language\_models/llms.py", line 774, in \_generate\_helper
> self.\_generate(
> File "/usr/local/lib/python3.10/dist-packages/langchain\_core/language\_models/llms.py", line 1508, in \_generate
> self.\_call(prompt, stop=stop, run\_manager=run\_manager, \*\*kwargs)
> File "/usr/local/lib/python3.10/dist-packages/langchain\_community/llms/huggingface\_endpoint.py", line 265, in \_call
> response = self.client.post(
> File "/usr/local/lib/python3.10/dist-packages/huggingface\_hub/inference/\_client.py", line 273, in post
> hf\_raise\_for\_status(response)
> File "/usr/local/lib/python3.10/dist-packages/huggingface\_hub/utils/\_errors.py", line 358, in hf\_raise\_for\_status
> raise BadRequestError(message, response=response) from e
> huggingface\_hub.utils.\_errors.BadRequestError: (Request ID: JoV91bXHMHzsDi4vyFyXj)
> 
> Bad request:
> Task not found for this model.
> 
> Kindly please help me with this issue.
> THank you.

---

<div class="post-metadata">

**Author:** ![kyubert](https://avatars.discourse-cdn.com/v4/letter/k/a88e4f/32.png) [@kyubert](https://discuss.huggingface.co/u/kyubert)\
**Post date:** [December 28, 2024, 8:22pm UTC](https://discuss.huggingface.co/t/problem-arise-after-one-week-bad-request-task-not-found-for-this-model/130130/3 "2024-12-28T20:22:37Z")

</div>

So, what are our options then? I’m also very new and got here through a tutorial. I’m not sure what the alternative is to the Inference API, or if I would have to migrate my project somewhere else.

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](https://discuss.huggingface.co/u/John6666)\
**Post date:** [December 29, 2024, 3:41pm UTC](https://discuss.huggingface.co/t/problem-arise-after-one-week-bad-request-task-not-found-for-this-model/130130/4 "2024-12-29T15:41:56Z")

</div>

To be honest, there is no substitute for the Inference API. There are plenty of paid services online, but we’ll exclude them this time.

What you can do for free with HF is use the Inference API from Gradio, and this is still relatively easy to use even for new models created by the user, as long as the model size is within 10GB (there is a limit here).  
For more details, please see below.

> **[Getting Started With The Python Client](https://www.gradio.app/guides/getting-started-with-the-python-client)**
>
> A Step-by-Step Gradio Tutorial

> **[Gradio Demo Space creation helper - a Hugging Face Space by John6666](https://huggingface.co/spaces/John6666/t2i-demo-helper)**
>
> Discover amazing ML apps made by the community

Also, if you want to use high-speed inference, the Pro subscription for $9 a month comes with 10 units of Zero GPU space, which is convenient, but it’s quite tricky to use, and there is also a 25-minute GPU usage limit per day. It’s not as easy as the Inference API. However, it can do a lot of things and is extremely powerful…

> **[zero-gpu-explorers (ZeroGPU Explorers)](https://huggingface.co/zero-gpu-explorers)**
>
> Org profile for ZeroGPU Explorers on Hugging Face, the AI community building the future.

---

<div class="post-metadata">

**Author:** ![kyubert](https://avatars.discourse-cdn.com/v4/letter/k/a88e4f/32.png) [@kyubert](https://discuss.huggingface.co/u/kyubert)\
**Post date:** [December 29, 2024, 4:32pm UTC](https://discuss.huggingface.co/t/problem-arise-after-one-week-bad-request-task-not-found-for-this-model/130130/5 "2024-12-29T16:32:46Z")

</div>

Thanks for all the help. I’m kind of stuck on Gradio though because I’m getting this error. Not sure if there’s something wrong with how I made the original repo.

 ![image](https://us1.discourse-cdn.com/hellohellohello/original/3X/5/f/5ffa6d24d7798dda3b93eae9f655a9cad6aa3802.png)

---

<div class="post-metadata">

**Author:** ![kyubert](https://avatars.discourse-cdn.com/v4/letter/k/a88e4f/32.png) [@kyubert](https://discuss.huggingface.co/u/kyubert)\
**Post date:** [December 29, 2024, 7:16pm UTC](https://discuss.huggingface.co/t/problem-arise-after-one-week-bad-request-task-not-found-for-this-model/130130/6 "2024-12-29T19:16:58Z")

</div>

Nvm got it working. Apparently in the app.py the `hf_token` parameter needs to be replaced with `token`

---

<div class="post-metadata">

**Author:** ![kyubert](https://avatars.discourse-cdn.com/v4/letter/k/a88e4f/32.png) [@kyubert](https://discuss.huggingface.co/u/kyubert)\
**Post date:** [December 29, 2024, 7:48pm UTC](https://discuss.huggingface.co/t/problem-arise-after-one-week-bad-request-task-not-found-for-this-model/130130/7 "2024-12-29T19:48:57Z")

</div>

Is there any point when we can expect the Inference API to be back up? I tried getting it to work with the Gradio space but it didn’t seem to help much

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](https://discuss.huggingface.co/u/John6666)\
**Post date:** [December 30, 2024, 2:18am UTC](https://discuss.huggingface.co/t/problem-arise-after-one-week-bad-request-task-not-found-for-this-model/130130/8 "2024-12-30T02:18:32Z")

</div>

I don’t think it will be restored, because the problem is caused by a shortage of shared resources.

---

<div class="post-metadata">

**Author:** ![kyubert](https://avatars.discourse-cdn.com/v4/letter/k/a88e4f/32.png) [@kyubert](https://discuss.huggingface.co/u/kyubert)\
**Post date:** [December 30, 2024, 2:57am UTC](https://discuss.huggingface.co/t/problem-arise-after-one-week-bad-request-task-not-found-for-this-model/130130/9 "2024-12-30T02:57:06Z")

</div>

Well… Darn. I guess I’ll just have to either figure out how to modify my code to work with the Gradio space or figure out how to work with the Pro features. Thanks for the help either way.
