all-MiniLM-L6-v2 / convert.py
shuttie's picture
initial commit
6f23931
raw
history blame
315 Bytes
from transformers import AutoTokenizer, AutoModel
import torch
model = AutoModel.from_pretrained("sentence-transformers/all-MiniLM-L6-v2")
model.eval()
sample = torch.randint(low=0, high=1, size=(1,128))
input = (sample, sample, sample)
torch.onnx.export(model, input, 'pytorch_model.onnx', export_params=True)