Spaces:
Sleeping
Sleeping
Upload embeddings.py
Browse files- embeddings.py +1 -6
embeddings.py
CHANGED
|
@@ -66,8 +66,6 @@ class EmbeddingManager:
|
|
| 66 |
self._prefix_p = ""
|
| 67 |
self._prefix_q = ""
|
| 68 |
|
| 69 |
-
# lower !!!!!!!!!!!!!!
|
| 70 |
-
|
| 71 |
# Creation du Sentence transformer model
|
| 72 |
logger.info(f"Initialisation du modèle d'embeddings: {model_name}")
|
| 73 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
@@ -169,12 +167,9 @@ class EmbeddingManager:
|
|
| 169 |
|
| 170 |
if theme not in seen_themes:
|
| 171 |
seen_themes.add(theme)
|
| 172 |
-
normalized_document = self._normalize_text(document)
|
| 173 |
-
if self._prefix_p and normalized_document.startswith(self._prefix_p):
|
| 174 |
-
normalized_document = normalized_document[len(self._prefix_p):]
|
| 175 |
candidates.append(
|
| 176 |
SemanticSearchCandidate(
|
| 177 |
-
formulation=
|
| 178 |
theme=theme,
|
| 179 |
response=metadata["response"],
|
| 180 |
similarity_score=similarity,
|
|
|
|
| 66 |
self._prefix_p = ""
|
| 67 |
self._prefix_q = ""
|
| 68 |
|
|
|
|
|
|
|
| 69 |
# Creation du Sentence transformer model
|
| 70 |
logger.info(f"Initialisation du modèle d'embeddings: {model_name}")
|
| 71 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
|
|
| 167 |
|
| 168 |
if theme not in seen_themes:
|
| 169 |
seen_themes.add(theme)
|
|
|
|
|
|
|
|
|
|
| 170 |
candidates.append(
|
| 171 |
SemanticSearchCandidate(
|
| 172 |
+
formulation=document.removeprefix(self._prefix_p),
|
| 173 |
theme=theme,
|
| 174 |
response=metadata["response"],
|
| 175 |
similarity_score=similarity,
|