-
Notifications
You must be signed in to change notification settings - Fork 588
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
Importing smolagents takes a large amount of time #424
Comments
@lukegormsen Which version of smolagent are you using? because the import time in Your code :
Output ;
|
As @touseefahmed96 mentioned, it is important to know which smolagents version you are using, @lukegormsen. Concretely, for import time, we had a regression, but this is fixed since v1.5.0. |
Yup because i checked no issue in 1.5.0 1.6.0 1.7.0(dev) import time is less than 1.8 sec |
@touseefahmed96 I'm using 1.6.0 as well
For more context of this test I'm installing smolagents by itself in a fresh pipenv with python 3.13 and am still getting ~8 seconds. This seems to be reflected in my lambda init time I'm deploying smolagents in but I could be doing something else wrong? Running |
Also @lukegormsen which version have you installed, is it a particular bundle of requirements like |
Is your feature request related to a problem? Please describe.
The was referenced #100 and was addressed by not making certain heavy dependencies required like torch. After this was addressed, the import time was cut in half down to a much more manageable 3.8s #147 . However, the import time has now gone back up significantly seen after running
which results in ~
Import time: 7.92 seconds
.Describe the solution you'd like
Ideally, I’d love to see smolagents import faster, especially since it was optimized in a previous issue (#100). Maybe there’s an opportunity to revisit that optimization or find another way to delay some of the heavier imports until they’re actually needed.
That said, I totally get that some libraries just take time to load, and maybe this is unavoidable. If that’s the case, I’d appreciate any insight into why it’s happening and if there are any best practices for mitigating it (like lazy loading, import restructuring, etc.).
Is this not possible with the current options.
I’m not sure! It might be that smolagents is doing exactly what it needs to do, and this is just the reality of working with it. But if there’s an easy way to improve things, I’d be curious to hear about it.
Describe alternatives you've considered
I’ve thought about breaking up the import so that I only bring in the specific pieces I need instead of the full package, but since I’m using CodeAgent, I’m not sure if that would help much. Another option could be lazy-loading some dependencies, but I don’t know enough about the internals of smolagents to say if that would work here.
Additional context
The text was updated successfully, but these errors were encountered: