norm embbeddings, detach bug fixed
Browse files- .gitignore +1 -0
- embeddings.npy +1 -1
- handler.py +1 -0
.gitignore
CHANGED
@@ -1,2 +1,3 @@
|
|
1 |
.ipynb_checkpoints
|
2 |
compute.ipynb
|
|
|
|
1 |
.ipynb_checkpoints
|
2 |
compute.ipynb
|
3 |
+
normalize_embeddings.ipynb
|
embeddings.npy
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
size 89392256
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:12fdb146f37af5eaaae9ffaf527e46a419c93905048408008146dcdfd4312af0
|
3 |
size 89392256
|
handler.py
CHANGED
@@ -22,6 +22,7 @@ class EndpointHandler:
|
|
22 |
"""
|
23 |
inputs = self.tokenizer(data["inputs"], padding=True, return_tensors="pt")
|
24 |
text_features = self.model.get_text_features(**inputs)
|
|
|
25 |
input_embedding = text_features[0]
|
26 |
input_embedding = input_embedding / np.linalg.norm(input_embedding)
|
27 |
|
|
|
22 |
"""
|
23 |
inputs = self.tokenizer(data["inputs"], padding=True, return_tensors="pt")
|
24 |
text_features = self.model.get_text_features(**inputs)
|
25 |
+
text_features = text_features.detach().numpy()
|
26 |
input_embedding = text_features[0]
|
27 |
input_embedding = input_embedding / np.linalg.norm(input_embedding)
|
28 |
|