Update app.py
Browse files
app.py
CHANGED
@@ -118,16 +118,12 @@ def bi_encoder(bi_enc,passages):
|
|
118 |
|
119 |
#We use the Bi-Encoder to encode all passages, so that we can use it with sematic search
|
120 |
bi_encoder = SentenceTransformer(bi_enc)
|
121 |
-
#Start the multi-process pool on all available CUDA devices
|
122 |
-
pool = bi_encoder.start_multi_process_pool()
|
123 |
|
124 |
#Compute the embeddings using the multi-process pool
|
125 |
print('encoding passages into a vector space...')
|
126 |
-
corpus_embeddings = bi_encoder.
|
127 |
-
print("Embeddings computed. Shape:", corpus_embeddings.shape)
|
128 |
|
129 |
-
|
130 |
-
bi_encoder.stop_multi_process_pool(pool)
|
131 |
|
132 |
return corpus_embeddings
|
133 |
|
|
|
118 |
|
119 |
#We use the Bi-Encoder to encode all passages, so that we can use it with sematic search
|
120 |
bi_encoder = SentenceTransformer(bi_enc)
|
|
|
|
|
121 |
|
122 |
#Compute the embeddings using the multi-process pool
|
123 |
print('encoding passages into a vector space...')
|
124 |
+
corpus_embeddings = bi_encoder.encode(passages, convert_to_tensor=True, show_progress_bar=True)
|
|
|
125 |
|
126 |
+
print("Embeddings computed. Shape:", corpus_embeddings.shape)
|
|
|
127 |
|
128 |
return corpus_embeddings
|
129 |
|