Update README.md
Browse files
README.md
CHANGED
@@ -22,4 +22,34 @@ task_categories:
|
|
22 |
- sentence-similarity
|
23 |
language:
|
24 |
- es
|
25 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
- sentence-similarity
|
23 |
language:
|
24 |
- es
|
25 |
+
---
|
26 |
+
|
27 |
+
# Modelo
|
28 |
+
|
29 |
+
- "Alibaba-NLP/gte-multilingual-base"
|
30 |
+
|
31 |
+
Puedes obtener toda la información relaciondo con el modelo <a href="https://huggingface.co/Alibaba-NLP/gte-multilingual-base">aquí</a>
|
32 |
+
|
33 |
+
# Busqueda
|
34 |
+
|
35 |
+
```python
|
36 |
+
from sentence_transformers import SentenceTransformer
|
37 |
+
from sentence_transformers.util import cos_sim
|
38 |
+
from datasets import load_dataset
|
39 |
+
import numpy as np
|
40 |
+
|
41 |
+
model_name = "Alibaba-NLP/gte-multilingual-base"
|
42 |
+
model = SentenceTransformer(model_name, trust_remote_code=True)
|
43 |
+
|
44 |
+
raw_data = load_dataset('Manyah/incrustaciones')
|
45 |
+
|
46 |
+
question = ""
|
47 |
+
question_embedding = model.encode(question)
|
48 |
+
|
49 |
+
sim = [cos_sim(raw_data['train'][i]['embedding'],question_embedding).numpy() for i in range(0,len(raw_data['train']))]
|
50 |
+
|
51 |
+
index = sim.index(max(sim))
|
52 |
+
|
53 |
+
print(raw_data['train'][index]['context'])
|
54 |
+
|
55 |
+
```
|