--- license: mit base_model: - facebook/m2m100_1.2B tags: - translation - dotnet --- # M2M100 Model 1.2B for Lopatnov.Translate This repository contains an ONNX-converted version of the M2M100 1.2B model, optimized for the [Lopatnov.Translate](https://github.com/lopatnov/translate) service. These files are converted from the original weights in the [facebook/m2m100_1.2B](https://huggingface.co/facebook/m2m100_1.2B) repository. ## Conversion recipe ```bash conda create -n model_export python=3.10 -y conda activate model_export pip install "optimum[onnxruntime,export,openvino]" transformers sentencepiece optimum-cli export onnx --model facebook/m2m100_1.2B --task seq2seq-lm --dtype fp32 --opset 18 ./m2m100_1.2B ``` ## Configuration To configure model for the service, please modify `appsettings.json`: ### Example configuration: ```json { "Models": { "m2m100_1.2B": { "Type": "M2M100", "Path": "../../models/translate/m2m100_1.2B", "EncoderFile": "encoder_model.onnx", "DecoderFile": "decoder_model.onnx", "TokenizerFile": "sentencepiece.bpe.model", "TokenizerConfigFile": "added_tokens.json", "MaxTokens": 512, "VocabFile": "vocab.json" } }, // These configurations are optional "Translation": { "AllowedModels": [ "m2m100_1.2B" ], // Whitelist allowed models if needed "DefaultModel": "m2m100_1.2B", // Set this model as the default "WarmUp": [ "m2m100_1.2B" ] // Load the model into memory on startup } } ``` *Note: Make sure the `Path` correctly points to the location of your downloaded `.onnx` files relative to application.* ## Documentation For advanced configuration options, visit the [Official Documentation](https://github.com/lopatnov/translate/blob/main/docs/models.md#m2m-100-12b).