I am on a M3 Macbook with 16GB and I am trying to add a context to llama3 model:
from pathlib import Path
import qdrant_client
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader
from llama_index.llms.ollama import Ollama
from llama_index.core import StorageContext
from llama_index.vector_stores.qdrant import QdrantVectorStore
from llama_index.core import Settings
documents = SimpleDirectoryReader("./data").load_data()
client = qdrant_client.QdrantClient(path="./data")
vector_store = QdrantVectorStore(client=client, collection_name="perso")
storage_context = StorageContext.from_defaults(vector_store=vector_store)
Settings.llm = Ollama(model="llama3", request_timeout=120.0)
Settings.embed_model = "local:BAAI/bge-small-en-v1.5"
index = VectorStoreIndex.from_documents(documents, settings=Settings, storage_context=storage_context)
query_engine = index.as_query_engine()
prompt = "Test"
response = query_engine.query(prompt)
print(response)
But I get this error:
python specialized_test_v1.py
modules.json: 100%|█████████████████████████████████████████████████████████| 349/349 [00:00<00:00, 624kB/s]
config_sentence_transformers.json: 100%|████████████████████████████████████| 124/124 [00:00<00:00, 337kB/s]
README.md: 100%|███████████████████████████████████████████████████████| 94.8k/94.8k [00:00<00:00, 1.07MB/s]
sentence_bert_config.json: 100%|██████████████████████████████████████████| 52.0/52.0 [00:00<00:00, 145kB/s]
config.json: 100%|█████████████████████████████████████████████████████████| 743/743 [00:00<00:00, 2.39MB/s]
model.safetensors: 100%|█████████████████████████████████████████████████| 133M/133M [00:01<00:00, 74.0MB/s]
Segmentation fault: 11
(base) CSG-Book:LLM kal$ /opt/anaconda3/lib/python3.11/multiprocessing/resource_tracker.py:254: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown
warnings.warn('resource_tracker: There appear to be %d '
I tried some other ways to adding embed models with HuggingFaceEmbedding
Settings.embed_model = HuggingFaceEmbedding(model_name="BAAI/bge-small-en-v1.5")
and also I tried with a deprecated ServiceContext:
llm = Ollama(model=”llama3″, request_timeout=120.0)
service_context = ServiceContext.from_defaults(llm=llm, embed_model=”local”)
But I have another kind of errors.
thank you !
New contributor
CSG is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.