hooman650 commited on
Commit
e7d321a
·
1 Parent(s): 8f45b92

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +4 -1
README.md CHANGED
@@ -29,5 +29,8 @@ model.to("cuda")
29
  pairs = ["pandas usually live in the jungles"]
30
  with torch.no_grad():
31
  inputs = tokenizer(pairs, padding=True, truncation=True, return_tensors='pt', max_length=512)
32
- logits = model(**inputs)[0][:, 0]
 
 
 
33
  ```
 
29
  pairs = ["pandas usually live in the jungles"]
30
  with torch.no_grad():
31
  inputs = tokenizer(pairs, padding=True, truncation=True, return_tensors='pt', max_length=512)
32
+ sentence_embeddings = model(**inputs)[0][:, 0]
33
+
34
+ # normalize embeddings
35
+ sentence_embeddings = torch.nn.functional.normalize(sentence_embeddings, p=2, dim=1)
36
  ```