-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
[Question]: How to speed up index loading time #9019
Comments
🤖 Hello @SCUT-ChenBD, Great to see you again in the LlamaIndex repository! I hope you've been doing well. I appreciate your patience and your detailed question about improving the loading time for the index. I'm currently looking into your issue and I'll get back to you with a comprehensive response soon. |
🤖 Hello @SCUT-ChenBD! It's good to see you back. I hope you're doing well. Based on your question, it seems you're looking to improve the index loading time in LlamaIndex or possibly convert it into a more efficient storage method like faiss or pgvector. To speed up the index loading time, you can use the from llama_index.storage.storage_context import StorageContext
from llama_index.indices.loading import load_index_from_storage, load_indices_from_storage
# Create a StorageContext instance
storage_context = StorageContext(docstore=docstore, index_store=index_store, vector_store=vector_store)
# To load a single index from storage
index = load_index_from_storage(storage_context, index_id='your_index_id')
# To load multiple indices from storage
indices = load_indices_from_storage(storage_context, index_ids=['index_id1', 'index_id2']) You can find more details about these methods in the llama_index/indices/loading.py file. As for using faiss or pgvector as a storage method, you can use the import faiss
from llama_index.storage.storage_context import StorageContext
from llama_index.storage.docstore.simple_docstore import SimpleDocumentStore
from llama_index.storage.index_store.simple_index_store import SimpleIndexStore
from llama_index.vector_stores.faiss import FaissVectorStore
# construct custom storage context
storage_context = StorageContext.from_defaults(
docstore=SimpleDocumentStore(),
index_store=SimpleIndexStore(),
vector_store=FaissVectorStore(faiss_index=faiss.IndexFlatL2(5)),
) In this example, a faiss index with a dimension of 5 is used as the vector store in the storage context. This storage context can then be used to construct an index and persist it to disk. The index can be loaded from storage using the You can find more details about this in the tests/indices/test_loading.py file. I hope this helps! If you have any other questions, feel free to ask. Sources
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot. |
@SCUT-ChenBD I would use a db integration to speed this up for sure. Qdrant and Chroma are easy to get started with |
Hi, @SCUT-ChenBD, I'm helping the LlamaIndex team manage our backlog and am marking this issue as stale. From what I understand, you were looking for ways to improve the loading time of the index in the LlamaIndex repository and exploring more efficient storage methods such as faiss or pgvector. I provided detailed suggestions for improving the loading time, including specific methods within the LlamaIndex framework, and examples of using faiss as a storage method. Additionally, logan-markewich recommended database integrations like Qdrant or Chroma to improve performance. Could you please confirm if this issue is still relevant to the latest version of the LlamaIndex repository? If it is, please let the LlamaIndex team know by commenting on the issue. Otherwise, feel free to close the issue yourself, or it will be automatically closed in 7 days. Thank you! |
Question Validation
Question
In actual use, I found that the process of loading the index takes a long time, which greatly affects the real-time performance of the retrieval. Is there any way to speed it up? Or can it be converted into other more efficient storage methods (faiss, pgvector)?
The text was updated successfully, but these errors were encountered: