-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Agent will get stuck after a few iterations if used in a loop #582
Comments
I have a feeling it is because it does not get the final answer. So the problem is somewhere here: smolagents/src/smolagents/agents.py Line 388 in 8359283
Check the output, see if it returns smolagents/src/smolagents/utils.py Line 171 in 8359283
THe model you have is very small, it might not be doing thiat. |
Will it use up all tokens eventually and return due to A quick way to test this is to reduce your |
Thanks, now I think the issue is connected to I removed the [BUG] tag, because this is perhaps just my misuse of the agents. I will investigate more on that |
Since this sounds a lot like what I encountered, here are more details of what happened in my case and could explain what happened here as well.
In summary the model generates valid python code but doesn't produce a stop sequence. I don't think this a bug either, since the model isn't following the instruction it receives to produce a stop sequence, but it is wasteful of compute resources. The only sure fire way to prevent the issue I've found is to use a logits processor to force the model to produce structured output that ends with |
@g-eoj yeah, that's what I have assumed is happening. :/ |
Hello,
I am trying to run an agent in a for loop, and after just a few iterations it gets stuck for no reason if I use
TransformersModel
withCodeAgent
running on a GPU.I observe this behavior on Linux cloud and on my private Windows PC for any version of smolagents.
Minimal code to reproduce the error
The LLama 1B model fits nicely on my 8GB GPU and there is a lot of free VRAM left. After a few failed steps of some iteration the agent will get stuck on response generation stage. On Windows PC I see that the GPU memory controller load increases dramatically with time while no output is generated, so perhaps this is a VRAM related issue.
I can run the same LLM without smolagents using
transformers
directly in a simple loop and it successfully finishes all iterations.I can also run
LiteLLMModel
model withsmolagents
that is connected to Ollama server on my PC, and it is running fine.Could you please take a look at it?
Packages versions:
transformers 4.47.0
smolagents 1.8.0 or main
The text was updated successfully, but these errors were encountered: