You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When launching the agent in Gradio GradioUI(agent).launch(), the agent is kept in the global state of Gradio, meaning all users share the same agent.
Although messages seem to be stored in Gradio Session state, some internal agent state like AgentMemory is saved globally
I would imagine that it would be better to scope everything on Session State.
There is a reset_agent_memory flag on SmolAgents that is False by default, but there is no way to override it.
Code to reproduce the error
Open a chat session in a gradio space and keep talking until you hit the context window limit.
Open a new chat session in a different browser. You will not be able to have a conversation due to the context window limit error that was triggered by the first chat session.
The global agent memory will consume all of the context size.
From that point on the space will be broken for everyone and nobody will be able to start conversations again.
Error logs (if any)
All users will experience an error like this
Input validation error: inputs tokens + max_new_tokens must be <= 16000. Given: 43384 inputs tokens and 2096 max_new_tokens
Make sure 'text-generation' task is supported by the model.
Expected behavior
I would expect that there are proper user scoped sessions. And that one user session cannot influence the behavior of another session.
Packages version: smolagents==1.9.2
Additional context
This issue became clear during the HuggingFace Agents Course, when students were asked to promote their Agents through their spaces. Because the underlying LLM had a small context window, as soon as 1 person hit that max context size the space was ruined for everyone.
HuggingFace provided a template https://huggingface.co/spaces/agents-course/First_agent_template for students to create agents and tools.
That template contains a copy of Gradio_UI.py where we can manipulate the reset_agent_memory flag, but I assume you want to keep Gradio_UI.py a part of SmolAgents and not have people create copies of it.
Otherwise the only way to fix the issue is to restart the entire space
The text was updated successfully, but these errors were encountered:
+1 on this, and also: in the HF agents course (duplicated) space, it would be nice if refreshing the space could cause the current memory of context window to be cleared. Restarting the space does this, of course, and I’ve been able to force it with a prompt like “clear your memory of previous chats”, but that seems like a crude way to do it.
Describe the bug
When launching the agent in Gradio
GradioUI(agent).launch()
, the agent is kept in the global state of Gradio, meaning all users share the same agent.Although messages seem to be stored in Gradio Session state, some internal agent state like AgentMemory is saved globally
I would imagine that it would be better to scope everything on Session State.
There is a
reset_agent_memory
flag on SmolAgents that is False by default, but there is no way to override it.Code to reproduce the error
Open a chat session in a gradio space and keep talking until you hit the context window limit.
Open a new chat session in a different browser. You will not be able to have a conversation due to the context window limit error that was triggered by the first chat session.
The global agent memory will consume all of the context size.
From that point on the space will be broken for everyone and nobody will be able to start conversations again.
Error logs (if any)
All users will experience an error like this
Expected behavior
I would expect that there are proper user scoped sessions. And that one user session cannot influence the behavior of another session.
Packages version:
smolagents==1.9.2
Additional context
This issue became clear during the HuggingFace Agents Course, when students were asked to promote their Agents through their spaces. Because the underlying LLM had a small context window, as soon as 1 person hit that max context size the space was ruined for everyone.
HuggingFace provided a template https://huggingface.co/spaces/agents-course/First_agent_template for students to create agents and tools.
That template contains a copy of
Gradio_UI.py
where we can manipulate thereset_agent_memory
flag, but I assume you want to keepGradio_UI.py
a part of SmolAgents and not have people create copies of it.Otherwise the only way to fix the issue is to restart the entire space
The text was updated successfully, but these errors were encountered: