Skip to content
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

[HANDS-ON BUG] Error creating first agent with smolagent #222

Open
Lucas-CE opened this issue Feb 21, 2025 · 1 comment
Open

[HANDS-ON BUG] Error creating first agent with smolagent #222

Lucas-CE opened this issue Feb 21, 2025 · 1 comment

Comments

@Lucas-CE
Copy link

Describe the bug
When I try to send a message to my agent created with smolagent I get this error:

╭────────────────────────────────── New run ───────────────────────────────────╮
│ │
│ hello │
│ │
╰─ HfApiModel - Qwen/Qwen2.5-Coder-32B-Instruct ───────────────────────────────╯
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Step 1 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
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-67b8da1f-1e195d3648979d905facf775;086617d1-6834-4aa1-bfde-99f5e767bd3e)

Invalid username or password.
[Step 1: Duration 0.03 seconds]
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/gradio/queueing.py", line 715, in process_events
response = await route_utils.call_process_api(
File "/usr/local/lib/python3.10/site-packages/gradio/route_utils.py", line 322, in call_process_api
output = await app.get_blocks().process_api(
File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 2088, in process_api
result = await self.call_function(
File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 1647, in call_function
prediction = await utils.async_iteration(iterator)
File "/usr/local/lib/python3.10/site-packages/gradio/utils.py", line 728, in async_iteration
return await anext(iterator)
File "/usr/local/lib/python3.10/site-packages/gradio/utils.py", line 722, 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 2461, in run_sync_in_worker_thread
return await future
File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 962, in run
result = context.run(func, *args)
File "/usr/local/lib/python3.10/site-packages/gradio/utils.py", line 705, in run_sync_iterator_async
return next(iterator)
File "/usr/local/lib/python3.10/site-packages/gradio/utils.py", line 866, in gen_wrapper
response = next(iterator)
File "/home/user/app/Gradio_UI.py", line 197, in interact_with_agent
for msg in stream_to_gradio(self.agent, task=prompt, reset_agent_memory=False):
File "/home/user/app/Gradio_UI.py", line 145, in stream_to_gradio
total_input_tokens += agent.model.last_input_token_count
TypeError: unsupported operand type(s) for +=: 'int' and 'NoneType'

I encounter a similar error when running the template agent: https://huggingface.co/spaces/agents-course/First_agent_template

@iosuslov
Copy link

iosuslov commented Feb 22, 2025

You need to create Hugging Face access token here https://huggingface.co/settings/tokens and then add it to you space settings here https://huggingface.co/spaces/<USER_NAME>/First_agent_template/settings -> Secrets as HF_TOKEN

Image

Probably, you need to restart you deployment, so it will be pulled to runtime

And we absolutely need to add this information to course unit

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

No branches or pull requests

2 participants