Agent wont respond

The code provided in the course using the Qwen model build and runs fine, there are no log errors either. However when i attempt to chat with agent it never responds. The only advice given was to change the model…which I did but still no answer. Really want to proceed with the course but i cant till i can get this agent responding. Any help would be appreciated. Thank you

1 Like

can you share your space if it’s public?

1 Like

Hello, i made the space public now. I’m unsure how to share it but maybe you can see it now that its public. Thank you for the help

1 Like

Hi @12GaugeMage,

I’m also facing the same issue. Based on your agent’s weblink here, I checked the logs (you can view them by clicking the “Logs” button on the webpage where your space is running). The logs indicate the following error:

Error in generating model output:
401 Client Error: Unauthorized for url: 
https://router.huggingface.co/hf-inference/models/Qwen/Qwen2.5-Coder-32B-Instruc
t/v1/chat/completions (Request ID: 
Root=1-67c03071-27d09e05777ee5be59165163;7c1a7376-6f61-4430-8dc4-e93100cb7646)

Invalid username or password.

This suggests an authentication issue when trying to access the Hugging Face inference API for the Qwen model. Additionally, the traceback error at:

total_input_tokens += agent.model.last_input_token_count
TypeError: unsupported operand type(s) for +=: 'int' and 'NoneType'

indicates that last_input_token_count might be returning None, which is causing the agent to fail.

I noticed that a commit has already been made addressing this issue here. To resolve the problem, try updating the model_id in your code as follows:

model_id = 'https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'

This should fix the issue and allow your agent to respond. Let me know if you need any further help!

2 Likes

Thank you! It worked. I appreciate the help :slight_smile:

1 Like