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) | |