add
Browse files- .gitattributes +5 -32
- .gitignore +2 -0
- README.md +1 -3
- pipeline.py +32 -0
- requirements.txt +1 -0
.gitattributes
CHANGED
@@ -1,35 +1,8 @@
|
|
1 |
-
*.
|
2 |
-
*.
|
3 |
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
-
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
5 |
-
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
6 |
-
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
-
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
-
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
-
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
-
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
12 |
-
*.model filter=lfs diff=lfs merge=lfs -text
|
13 |
-
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
14 |
-
*.npy filter=lfs diff=lfs merge=lfs -text
|
15 |
-
*.npz filter=lfs diff=lfs merge=lfs -text
|
16 |
-
*.onnx filter=lfs diff=lfs merge=lfs -text
|
17 |
-
*.ot filter=lfs diff=lfs merge=lfs -text
|
18 |
-
*.parquet filter=lfs diff=lfs merge=lfs -text
|
19 |
-
*.pb filter=lfs diff=lfs merge=lfs -text
|
20 |
-
*.pickle filter=lfs diff=lfs merge=lfs -text
|
21 |
-
*.pkl filter=lfs diff=lfs merge=lfs -text
|
22 |
-
*.pt filter=lfs diff=lfs merge=lfs -text
|
23 |
-
*.pth filter=lfs diff=lfs merge=lfs -text
|
24 |
-
*.rar filter=lfs diff=lfs merge=lfs -text
|
25 |
-
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
26 |
-
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
27 |
-
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
28 |
-
*.tar filter=lfs diff=lfs merge=lfs -text
|
29 |
*.tflite filter=lfs diff=lfs merge=lfs -text
|
30 |
-
*.
|
31 |
-
*.
|
32 |
-
*.
|
33 |
-
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
-
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
-
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
1 |
+
*.bin.* filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
3 |
*.bin filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
4 |
*.h5 filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
*.tflite filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.tar.gz fKilter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
.gitignore
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
venv
|
2 |
+
.idea
|
README.md
CHANGED
@@ -1,3 +1 @@
|
|
1 |
-
|
2 |
-
license: apache-2.0
|
3 |
-
---
|
|
|
1 |
+
carenet model
|
|
|
|
pipeline.py
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from typing import List
|
2 |
+
from sentence_transformers import SentenceTransformer
|
3 |
+
import os
|
4 |
+
|
5 |
+
class PreTrainedPipeline:
|
6 |
+
def __init__(self, path=""):
|
7 |
+
"""
|
8 |
+
Initialize model
|
9 |
+
"""
|
10 |
+
self.model = SentenceTransformer(os.path.join(path))
|
11 |
+
# os.path.join(path, 'quora-distilbert-multilingual')
|
12 |
+
#"sentence-transformers/quora-distilbert-multilingual"
|
13 |
+
#)
|
14 |
+
|
15 |
+
|
16 |
+
|
17 |
+
|
18 |
+
def __call__(self, inputs: str) -> List[float]:
|
19 |
+
"""
|
20 |
+
Args:
|
21 |
+
inputs (:obj:`str`):
|
22 |
+
a string to get the features of.
|
23 |
+
Return:
|
24 |
+
A :obj:`list` of floats: The features computed by the model.
|
25 |
+
"""
|
26 |
+
return self.model.encode(inputs).tolist()
|
27 |
+
|
28 |
+
#
|
29 |
+
if __name__ == "__main__":
|
30 |
+
xx = PreTrainedPipeline()
|
31 |
+
|
32 |
+
print(xx.__call__("hei"))
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
sentence-transformers==2.2.2
|