Views
No views yet
1conda create -n model_export python=3.10 -y
2conda activate model_export
3pip install "optimum[onnxruntime,export,openvino]" transformers sentencepiece
4optimum-cli export onnx --model facebook/m2m100_1.2B --task seq2seq-lm --dtype fp32 --opset 18 ./m2m100_1.2B appsettings.json:1{
2 "Models": {
3 "m2m100_1.2B": {
4 "Type": "M2M100",
5 "Path": "../../models/translate/m2m100_1.2B",
6 "EncoderFile": "encoder_model.onnx",
7 "DecoderFile": "decoder_model.onnx",
8 "TokenizerFile": "sentencepiece.bpe.model",
9 "TokenizerConfigFile": "added_tokens.json",
10 "MaxTokens": 512,
11 "VocabFile": "vocab.json"
12 }
13 },
14
15 // These configurations are optional
16 "Translation": {
17 "AllowedModels": [ "m2m100_1.2B" ], // Whitelist allowed models if needed
18 "DefaultModel": "m2m100_1.2B", // Set this model as the default
19 "WarmUp": [ "m2m100_1.2B" ] // Load the model into memory on startup
20 }
21}Path correctly points to the location of your downloaded .onnx files relative to application.