--- license: mit datasets: - skypro1111/ubertext-2-news-verbalized language: - uk base_model: - skypro1111/m2m100-ukr-verbalization pipeline_tag: text2text-generation library_name: transformers widget: - text: >- Очікувалось, що цей застосунок буде запущено о 11 ранку 22.08.2025, але розробники затягнули святкування і запуск був відкладений на 2 тижні. --- # m2m100-ukr-verbalization-ct2 This is the CTranslate2-optimized version of [skypro1111/m2m100-ukr-verbalization](https://huggingface.co/skypro1111/m2m100-ukr-verbalization). ## About CTranslate2 Optimization CTranslate2 is an optimized inference engine for Transformer models that provides much faster inference than standard implementations. This repository contains the m2m100-418M model for Ukrainian verbalization, optimized for production deployment. Key advantages: - **Faster inference**: 3-5x speed improvement over the standard Transformers implementation - **Lower memory footprint**: Uses efficient int8/float16 quantization - **Better hardware utilization**: Optimized for both CPU and GPU - **Efficient batching**: Improved batch processing for production workloads ## Usage ```python import os import ctranslate2 from transformers import M2M100Tokenizer def process_sentence(translator, tokenizer, sentence: str): # Tokenize input source = tokenizer.convert_ids_to_tokens(tokenizer.encode(sentence)) target_prefix = [tokenizer.lang_code_to_token["uk"]] # Run inference results = translator.translate_batch( [source], target_prefix=[target_prefix], beam_size=1, num_hypotheses=1, use_vmap=True, ) # Get target tokens and decode target = results[0].hypotheses[0][1:] # Remove language token return tokenizer.decode(tokenizer.convert_tokens_to_ids(target)) # Initialize translator with optimizations translator = ctranslate2.Translator( "path/to/m2m100-ukr-verbalization-ct2", device="cuda", compute_type="int8_float16", # Options: int8, int8_float16, float16, float32 intra_threads=16, ) # Load tokenizer from the original model tokenizer = M2M100Tokenizer.from_pretrained("skypro1111/m2m100-ukr-verbalization") tokenizer.src_lang = "uk" # Example text = "Моя бабуся народилася 07.11.1919, у важкий післявоєнний час." result = process_sentence(translator, tokenizer, text) print(result) # Output: "Моя бабуся народилася сьомого листопада тисяча дев'ятсот дев'ятнадцятого року, у важкий післявоєнний час." ``` ## Performance Comparison | Metric | Original Model | CTranslate2 Model | |--------|---------------|-------------------| | Inference time (avg) | ~300ms | ~70ms | | Memory usage | ~2.5GB | ~900MB | | Batch processing (10) | ~2.8s | ~0.7s | *Measurements taken on NVIDIA T4 GPU with int8_float16 quantization ## Integration This model can be easily integrated into production systems using: - Python with CTranslate2 library - C++ applications via CTranslate2 C++ API - REST API services - Docker containers ## Model Information For detailed information about the model capabilities, training data, and usage examples, please refer to the original model: [skypro1111/m2m100-ukr-verbalization](https://huggingface.co/skypro1111/m2m100-ukr-verbalization) ## License This model is released under the MIT License, in line with the original m2m100-ukr-verbalization model.