shuttie
commited on
Commit
•
6f23931
0
Parent(s):
initial commit
Browse files- .gitattributes +1 -0
- .gitignore +1 -0
- README.md +2 -0
- convert.py +11 -0
- pytorch_model.onnx +3 -0
- requirements.txt +3 -0
.gitattributes
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
.gitignore
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
.venv
|
README.md
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
# ONNX port of sentence-transormers/all-MiniLM-L6-v2
|
2 |
+
|
convert.py
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import AutoTokenizer, AutoModel
|
2 |
+
import torch
|
3 |
+
|
4 |
+
model = AutoModel.from_pretrained("sentence-transformers/all-MiniLM-L6-v2")
|
5 |
+
model.eval()
|
6 |
+
|
7 |
+
sample = torch.randint(low=0, high=1, size=(1,128))
|
8 |
+
input = (sample, sample, sample)
|
9 |
+
|
10 |
+
torch.onnx.export(model, input, 'pytorch_model.onnx', export_params=True)
|
11 |
+
|
pytorch_model.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5ec02f3d61fd002cc3c4220ba2f7851fad67abf4004312753f866a9c37a5693c
|
3 |
+
size 90933591
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
sentence-transformers==2.2.2
|
2 |
+
torch==2.0.0
|
3 |
+
onnx=1.13.1
|