Logo Lanfrica

lingvanex-mt/models

Domaine:

natural language processing

Type de record:

modelsoftware
Créateur:
lin
Hôte:
Free and open source pre-trained translation models, including Kurdish, Samoan, Xhosa, Lao, Corsican, Cebuano, Galician, Russian, Belarusian and Yoruba. # Lingvanex Translator Try it online! | Translation API | Blog Free and Open Source Machine Translation Models in 12 languages, entirely self-hosted. Unlike other APIs, it doesn't rely on proprietary providers such as Google or AWS to perform translations. Instead, its translation engine is powered by the open source CTranslate2 library. Also we have translation models for 100 other languages. Contact us info@lingvanex.com Try it online! | API Docs ## Free Language Translation Models for CTranslate2 The models support the following languages: - English-Belarusian - Russian-Belarusian - English-Kurdish - Kurdish-English - English-Samoan - Samoan-English - English-Xhosa - Xhosa-English - English-Lao - Lao-English - English-Corsican - Corsican-English - English-Cebuano - Cebuano-English - English-Galician - Galician-English - English-Yoruba - Yoruba-English The models are available for download and you can use them in your projects. You can easily run them in your Python environment as shown below. ### Requirements To run the models, you need to install ctranslate2 and sentencepiece: ```bash pip install ctranslate2 sentencepiece ``` ### Simple Usage Example The following code demonstrates how to load and use a model for translation from English to Kurdish (en → ku). ```python import sentencepiece as spm from ctranslate2 import Translator path_to_model = source = 'en' target = 'ku' translator = Translator(path_to_model, compute_type='int8') source_tokenizer = spm.SentencePieceProcessor(f'{path_to_model}/{source}.spm.model') target_tokenizer = spm.SentencePieceProcessor(f'{path_to_model}/{target}.spm.model') text = [ 'I need to make a phone call.', 'Can I help you prepare food?', 'We want to go for a walk.' ] input_tokens = source_tokenizer.EncodeAsPieces(text) translator_output = translator.translate_batch( input_tokens, batch_type='tokens', beam_size=2, max_input_length=0, max_decoding_length=256 ) output_tokens = [item.hypotheses[0] for item in tra …