efederici commited on
Commit
171b21b
1 Parent(s): 55ed9f4

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +14 -0
README.md CHANGED
@@ -11,6 +11,20 @@ language:
11
 
12
  Below is an example to encode queries and passages from the MS-MARCO passage ranking dataset.
13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  ```python
15
  import torch.nn.functional as F
16
  from torch import Tensor
 
11
 
12
  Below is an example to encode queries and passages from the MS-MARCO passage ranking dataset.
13
 
14
+ ```python
15
+ from sentence_transformers import SentenceTransformer
16
+ model = SentenceTransformer('efederici/e5-base-v2-4096', {"trust_remote_code": True})
17
+ input_texts = [
18
+ 'query: how much protein should a female eat',
19
+ 'query: summit define',
20
+ "passage: As a general guideline, the CDC's average requirement of protein for women ages 19 to 70 is 46 grams per day. But, as you can see from this chart, you'll need to increase that if you're expecting or training for a marathon. Check out the chart below to see how much protein you should be eating each day.",
21
+ "passage: Definition of summit for English Language Learners. : 1 the highest point of a mountain : the top of a mountain. : 2 the highest level. : 3 a meeting or series of meetings between the leaders of two or more governments."
22
+ ]
23
+ embeddings = model.encode(input_texts, normalize_embeddings=True)
24
+ ```
25
+
26
+ or...
27
+
28
  ```python
29
  import torch.nn.functional as F
30
  from torch import Tensor