Zack Saadioui
8/26/2024
1
2
3
bash
curl -fsSL https://ollama.com/install.sh | sh
ollama serve
1
2
3
bash
pip install --upgrade pymilvus
pip install 'pymilvus[model]'
1
bge_m3_import.py
1
2
3
python
from pymilvus import connections, FieldSchema, CollectionSchema
from FlagEmbedding import BGEM3FlagModel
1
BGEM3FlagModel
1
2
python
bge_m3_model = BGEM3FlagModel(model_name='BAAI/bge-m3', use_fp16=True)
1
2
3
4
5
6
python
documents = [
"Artificial intelligence was founded as an academic discipline in 1956.",
"Alan Turing was the first person to conduct substantial research in AI."
]
doc_embeddings = bge_m3_model.encode_documents(documents)
1
2
3
4
5
6
python
queries = [
"When was artificial intelligence founded?",
"Where was Alan Turing born?"
]
query_embeddings = bge_m3_model.encode_queries(queries)
1
ollama serve
Copyright © Arsturn 2024