Spaces:
Running
Running
Pclanglais
commited on
Commit
•
cc4fb7d
1
Parent(s):
208476f
Update app.py
Browse files
app.py
CHANGED
@@ -16,7 +16,7 @@ from sklearn.metrics.pairwise import cosine_similarity
|
|
16 |
|
17 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
18 |
|
19 |
-
|
20 |
use_fp16=True) # Setting use_fp16 to True speeds up computation with a slight performance degradation
|
21 |
|
22 |
embeddings = np.load("embeddings_tchap.npy")
|
@@ -40,7 +40,7 @@ system_prompt = "<|begin_of_text|><|start_header_id|>system<|end_header_id|>\n\n
|
|
40 |
#Vector search over the database
|
41 |
def vector_search(sentence_query):
|
42 |
|
43 |
-
query_embedding =
|
44 |
batch_size=12,
|
45 |
max_length=256, # If you don't need such a long length, you can set a smaller value to speed up the encoding process.
|
46 |
)['dense_vecs']
|
|
|
16 |
|
17 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
18 |
|
19 |
+
embedding_model = BGEM3FlagModel('BAAI/bge-m3',
|
20 |
use_fp16=True) # Setting use_fp16 to True speeds up computation with a slight performance degradation
|
21 |
|
22 |
embeddings = np.load("embeddings_tchap.npy")
|
|
|
40 |
#Vector search over the database
|
41 |
def vector_search(sentence_query):
|
42 |
|
43 |
+
query_embedding = embedding_model.encode(sentence_query,
|
44 |
batch_size=12,
|
45 |
max_length=256, # If you don't need such a long length, you can set a smaller value to speed up the encoding process.
|
46 |
)['dense_vecs']
|