custom code
Browse files- .gitignore +1 -0
- 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
|