I use Vertex in my application with FastApi, but when importing Vertex it takes about 30 seconds aprox.
does anyone know how to reduce this time?
Hi @snaki,
Welcome to Google Cloud Community!
The 30-second import time for Vertex AI within your FastAPI application is likely due to a combination of factors.
You can also check the following key consideration that might help you resolve the issue:
Network Latency - The initial connection to Google Cloud services might experience slow, particularly if your location is distant from the Vertex AI servers. Ensure you have a stable and fast internet connection and choose a Vertex AI region that's geographically closer to your application.
Vertex AI Initialization -When you first import Vertex AI, it may take some time due to the initial setup and resource allocation requirements. Import Vertex AI modules only when you need them. This can help avoid unnecessary initialization overhead.
Vertex AI Model Loading - To enhance the speed of loading and inference, consider optimizing your models. Loading large models from Vertex AI can be a time-consuming process.
For more information about Vertex AI model optimization, you can read this documentation.
I hope the above information is helpful.
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |