Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -142,6 +142,12 @@ def bi_encode(bi_enc,passages):
|
|
142 |
|
143 |
corpus_embeddings = bi_encoder.encode(['passage: ' + sentence for sentence in passages], convert_to_tensor=True)
|
144 |
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
else:
|
146 |
|
147 |
corpus_embeddings = bi_encoder.encode(passages, convert_to_tensor=True)
|
@@ -185,7 +191,7 @@ def bm25_api(passages):
|
|
185 |
|
186 |
return bm25
|
187 |
|
188 |
-
bi_enc_options = ["multi-qa-mpnet-base-dot-v1","all-mpnet-base-v2","multi-qa-MiniLM-L6-cos-v1",'intfloat/e5-base-v2'
|
189 |
|
190 |
def display_df_as_table(model,top_k,score='score'):
|
191 |
# Display the df with text and scores as a table
|
@@ -281,7 +287,7 @@ st.markdown("""There models available to choose from:""")
|
|
281 |
st.markdown(
|
282 |
"""
|
283 |
Model Source:
|
284 |
-
- Bi-Encoders - [multi-qa-mpnet-base-dot-v1](https://huggingface.co/sentence-transformers/multi-qa-mpnet-base-dot-v1), [all-mpnet-base-v2](https://huggingface.co/sentence-transformers/all-mpnet-base-v2), [intfloat/e5-base-v2](https://huggingface.co/intfloat/e5-base-v2) and [all-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2)
|
285 |
- Cross-Encoder - [cross-encoder/ms-marco-MiniLM-L-12-v2](https://huggingface.co/cross-encoder/ms-marco-MiniLM-L-12-v2)""")
|
286 |
|
287 |
st.markdown(
|
|
|
142 |
|
143 |
corpus_embeddings = bi_encoder.encode(['passage: ' + sentence for sentence in passages], convert_to_tensor=True)
|
144 |
|
145 |
+
elif bi_enc == 'BAAI/bge-base-en':
|
146 |
+
|
147 |
+
instruction = "Represent this sentence for searching relevant passages: "
|
148 |
+
|
149 |
+
corpus_embeddings = bi_encoder.encode([instruction + sentence for sentence in passages], convert_to_tensor=True)
|
150 |
+
|
151 |
else:
|
152 |
|
153 |
corpus_embeddings = bi_encoder.encode(passages, convert_to_tensor=True)
|
|
|
191 |
|
192 |
return bm25
|
193 |
|
194 |
+
bi_enc_options = ["BAAI/bge-base-en","multi-qa-mpnet-base-dot-v1","all-mpnet-base-v2","multi-qa-MiniLM-L6-cos-v1",'intfloat/e5-base-v2']
|
195 |
|
196 |
def display_df_as_table(model,top_k,score='score'):
|
197 |
# Display the df with text and scores as a table
|
|
|
287 |
st.markdown(
|
288 |
"""
|
289 |
Model Source:
|
290 |
+
- Bi-Encoders - [BAAI/bge-base-en](https://huggingface.co/BAAI/bge-base-en),[multi-qa-mpnet-base-dot-v1](https://huggingface.co/sentence-transformers/multi-qa-mpnet-base-dot-v1), [all-mpnet-base-v2](https://huggingface.co/sentence-transformers/all-mpnet-base-v2), [intfloat/e5-base-v2](https://huggingface.co/intfloat/e5-base-v2) and [all-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2)
|
291 |
- Cross-Encoder - [cross-encoder/ms-marco-MiniLM-L-12-v2](https://huggingface.co/cross-encoder/ms-marco-MiniLM-L-12-v2)""")
|
292 |
|
293 |
st.markdown(
|