shamaayan commited on
Commit
0d1febe
1 Parent(s): ab10c1a

custom code

Browse files
Files changed (2) hide show
  1. .gitignore +1 -0
  2. code/inference.py +8 -0
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ .idea
code/inference.py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ from typing import List, Union
3
+
4
+
5
+ def predict_fn(data: Union[List[str], str], model):
6
+ outputs = model(input_texts, padding=False, truncation=True)
7
+ embeddings = [np.array(r[0]).mean(axis=0).tolist() for r in outputs]
8
+ return embeddings