Logo Lanfrica

addex12/Oromo-Language-Model

Domaine:

natural language processing

Type de record:

modelsoftware
Créateur:
add
Hôte:
Afaan Oromo Translation Model A machine translation model to translate between English and Afaan Oromo using deep learning. This repository contains code for training, fine-tuning, and deploying a neural machine translation (NMT) model using Hugging Face Transformers and datasets. # Afaan Oromo-Language-Model ## Overview This repository provides a **machine translation model** that translates between **English** and **Afaan Oromo**. The model is based on the Hugging Face **transformers** library and uses pre-trained models that are fine-tuned on English ↔ Afaan Oromo datasets. ### Key Features: - **Translation** between English and Afaan Oromo - Fine-tuning of pre-trained models for improved accuracy - Preprocessing and tokenization for datasets - Easy-to-use interface for translation tasks --- ## Installation To get started with this project, follow the steps below: 1. Clone this repository: ```bash git clone github.com cd afaan-oromo-translation Create and activate a Python virtual environment: python -m venv venv source venv/bin/activate # For Linux/Mac venv\Scripts\activate # For Windows Install the required libraries: pip install -r requirements.txt How to Use Translating Text: You can use the pre-trained model for quick translation: from transformers import MarianMTModel, MarianTokenizer # Load the pre-trained model and tokenizer model_name = "Helsinki-NLP/opus-mt-en-orm" tokenizer = MarianTokenizer.from_pretrained(model_name) model = MarianMTModel.from_pretrained(model_name) # Translate text text = "Hello, how are you?" inputs = tokenizer(text, return_tensors="pt") translated = model.generate(**inputs) output = tokenizer.decode(translated[0], skip_special_tokens=True) print(output) # Output: Afaan Oromo translation Fine-tuning the Model: If you want to fine-tune the model with your custom dataset, follow these steps: Prepare your English ↔ Afaan Oromo dataset in CSV format (with columns english_text and afaan_oromo_text). Load and preprocess the dataset: from datasets import load_dataset dataset = load_dataset("csv", data_files={"train": "path/to/your_dataset.csv"}) train_data = dataset["train"] Train the model: from transformers import Trainer, TrainingArgume …