Skip to content

Fix Unit 1 dummy_agent_library.ipynb ValueError #495

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

insdout
Copy link

@insdout insdout commented May 17, 2025

Description

This pull request addresses huggingface/agents-course#487, which reports an issue in Unit 1 ("Dummy Agents Library" section) of the AI Agents course. The provided code attempts to use the meta-llama/Llama-3.2-3B-Instruct model for text generation, resulting in a ValueError:


ValueError: Model meta-llama/Llama-3.2-3B-Instruct is not supported for task text-generation and provider together. Supported task: conversational.

This indicates that the selected model is not compatible with the text-generation task as expected in the course materials.

Fix

The following line:

client = InferenceClient("meta-llama/Llama-3.3-70B-Instruct")

has been updated to:

client = InferenceClient(provider="hf-inference", model="meta-llama/Llama-3.3-70B-Instruct")

This explicitly sets the provider to hf-inference and uses a compatible model for the intended task.

Outcome

The updated code resolves the model compatibility error and allows the example in Unit 1 to execute successfully.

Linked Issue

Fixes #487

@insdout insdout changed the title Update dummy_agent_library.ipynb Fix Unit 1 dummy_agent_library.ipynb ValueError May 17, 2025
@ashishsamant2311
Copy link

ashishsamant2311 commented May 17, 2025

Thanks @insdout. This change works as expected.

However, after running the code a couple of times, I get the following issue.

HfHubHTTPError: 402 Client Error: Payment Required for url: https://router.huggingface.co/hf-inference/models/meta-llama/Llama-3.3-70B-Instruct (Request ID: Root=1-682887f2-3e7d738459d115754906ebf1;1959db62-e5df-4b7e-9531-0b6180242d07)

You have exceeded your monthly included credits for Inference Providers. Subscribe to PRO to get 20x more monthly included credits.

@yuka-with-data
Copy link
Contributor

@ashishsamant2311 I think the issue you've encountering now is related to HF's inference usage limits, not the model compatibility problem that this PR was addressing. The error indicates you've exceeded your monthly quota for the hf-inference provider under the free tier. There is an existing issue that discusses this quota limit and potential workarounds: #465. You can also run the model locally using Ollama.

@insdout
Copy link
Author

insdout commented May 22, 2025

Hi @sergiopaniego

Would you mind reviewing this PR when you have a moment? It addresses #487 by explicitly include the provider="hf-inference" argument to resolve the ValueError due to task incompatibility.

Let me know if any further changes are needed!

Thanks a lot

@iamcam
Copy link

iamcam commented May 23, 2025

@insdout I had issues using a number of models, even when specifying other providers. I'm not a HF Pro subscriber, so I'm not able to test directly against the hf-inference provider, but using Together and Nebius (auto-routed through HF) resulted in the same error:

ValueError: Model meta-llama/Llama-3.3-70B-Instruct is not supported for task text-generation and provider nebius. Supported task: conversational.

It's not just Llama models - I had similar results with Qwen and Mistral models.

Does this work for you using other providers?

PS: I'm using the notebook linked from this page - I assume that is the only one.

@insdout
Copy link
Author

insdout commented May 23, 2025

@iamcam I encountered the same issue when attempting to use Llama, Qwen and Mistral models with various providers - the error persisted across different configurations.

The only solutions that worked for me were:

  1. Explicitly setting provider="hf-inference" in the InferenceClient. I am also not a PRO subscriber, so it works only until I exhaust my free quota.
  2. Switching from text_generation to chat.completion for all client calls. That worked with different providers.

@iamcam
Copy link

iamcam commented May 23, 2025

Switching out text_generation might be a nice addition to the PR, with a note about changing providers if needed. (IMO)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error with meta-llama/Llama-3.2-3B-Instruct Model in Unit 1 "Dummy Agents Library" Section
4 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy