How to convert a Model to ONNX?

I downloaded Microsoft’s Phi-2 Model from HuggingFace, it is saved as .safetensors, and as far as I understand Sentis require them to be on the ONNX format, so I tried to convert it but everything I tried is plagued with error, does anyone have a simple converter that works?

try use optimum-cli

optimum-cli export ONNX -m xxx xxx

I assume -m is to specify the model, should I give it the path to mymodel.safetensors ?

This is what’s driving me insane in anything I try, just the most nonsense errors

The -m parameter is the model path of huggingface.

optimum-cli export onnx -m microsoft/phi-2 phi-2

And also, maybe you can specify the --task text-generation instead of text-generation-with-past. It will not output the kv but only the tokens.

Hi, I am also facing some issue to convert a model (from huggingface) to ONNX. The model is a .safetensors (parler-tts/parler-tts-mini-v1.1 · Hugging Face).
I’ve tried the command :
optimum-cli export onnx --model .\ --task default onnx-directory\
by specifying .\ instead of directly the model.safetensors file I was trying to use the local_path option and therefore account for all the files (tokens etc…) to produce the ONNX but it asks for task (this is why I have added the --task option but as there is no task for text-to-speech I have put default. But I have errors
ValueError: The checkpoint you are trying to load has model type parler_tts but Transformers does not recognize this architecture. This could be because of an issue with the checkpoint, or because your version of Transformers is out of date.