Kernal crash while excecuting vector embedding operation #24607
Replies: 2 comments 2 replies
-
@mehar-tejat Hello there! I'm here to help you with any bugs, questions, or contributions you may have. The kernel crash during the execution of your vector embedding operation could be due to several factors, including deprecated classes, incorrect imports, or suboptimal configurations for your hardware. Here are some steps to help you resolve the issue:
Here is an example of how to enable debugging and ensure correct imports: from langchain.globals import set_debug
set_debug(True)
from langchain_community.document_loaders import PyPDFLoader
from langchain.text_splitter import RecursiveCharacterTextSplitter
from langchain_community.embeddings import OllamaEmbeddings
from langchain_community.vectorstores import Chroma
# Load PDF
loader = PyPDFLoader('hi.pdf')
docs = loader.load()
# Split text
text_splitter = RecursiveCharacterTextSplitter(chunk_size=10, chunk_overlap=1)
documents = text_splitter.split_documents(docs)
# Vector embedding and vector store
db = Chroma.from_documents(documents[:1], OllamaEmbeddings()) By following these steps, you can identify and resolve the cause of the kernel crash during your vector embedding operation [1][2][3]. |
Beta Was this translation helpful? Give feedback.
-
Hello @mehar-tejat , I have faced this issue before when i was trying to run similar code on my PC (Windows 11, 16gb RAM). I found many talking about OOM error causing the kernel to crash, but that wasn't the case for me, I monitored my memory and tried with very small data and the issue persisted. I still don't know what's causing this. However, I found a workaround that worked for me. I simply saved the ChromaDB on my disk and then load it to memory when computing similarity. vectorstore = Chroma.from_documents(documents[:1], OllamaEmbeddings(), persist_directory="./chroma_db") I have to mention that I used I hope this helps. |
Beta Was this translation helpful? Give feedback.
-
Checked other resources
Commit to Help
Example Code
Description
i am trying to build vector embedding using OllamaEmbeddings, as you can see in the image , while I'm trying to run this, i am getting "Kernel crash" I'm using environment python 3.10 .0 ,
i am getting in log "18:07:26.644 [error] Disposing session as kernel process died ExitCode: 3221225477 "
the error is showing in red as in below image
any help
System Info
data ingestion from pdf
pdf reader
this will take each single page
from langchain_community.document_loaders import PyPDFLoader
loader = PyPDFLoader('hi.pdf')
docs = loader.load()
from langchain.text_splitter import RecursiveCharacterTextSplitter
text_splitter = RecursiveCharacterTextSplitter(chunk_size=10,chunk_overlap=1)
documents = text_splitter.split_documents(docs)
documents[:5]
vector embedding and vector store
from langchain_community.embeddings import OllamaEmbeddings
from langchain_community.vectorstores import Chroma
giving first 20 documents
db = Chroma.from_documents(documents[:1], OllamaEmbeddings())
Beta Was this translation helpful? Give feedback.
All reactions