transformers safetensors marian text2text-generation translation seq2seq huggingface english-to-hindi dataset:iitb-english-hindi autotrain_compatible endpoints_compatible region:us
---
datasets:
- iitb-english-hindi
library_name: transformers
tags:
- translation
- seq2seq
- huggingface
- english-to-hindi
---

# Model Card for Fine-tuned Helsinki-NLP/opus-mt-en-hi on IITB English-Hindi Dataset

## Model Details

### Model Description

This model is a fine-tuned version of [Helsinki-NLP/opus-mt-en-hi](https://huggingface.co/Helsinki-NLP/opus-mt-en-hi) for English-to-Hindi translation using the [IIT Bombay English-Hindi Parallel Corpus](https://huggingface.co/datasets/cfilt/iitb-english-hindi). The model is designed to translate English sentences into Hindi with improved accuracy and fluency.

- **Developed by:** [shogun-the-great](https://huggingface.co/shogun-the-great)
- **Model type:** Seq2Seq (Sequence-to-Sequence) for Translation  
- **Language(s):** English to Hindi  
- **License:** Apache-2.0 (or specify your license)  
- **Finetuned from model:** Helsinki-NLP/opus-mt-en-hi  

### Model Sources

- **Dataset:** [IITB English-Hindi Dataset](https://huggingface.co/datasets/cfilt/iitb-english-hindi)  

## Uses

### Direct Use

This model can be directly used for English-to-Hindi translation tasks, such as:

- Translating text-based content (e.g., documents, articles) from English to Hindi.  
- Assisting in bilingual applications requiring English-Hindi translation.  
- Language learning and cross-lingual understanding.  

### Out-of-Scope Use

This model may not perform well on:

- Specialized domains like medical, legal, or technical text.  
- Translation of highly idiomatic, ambiguous, or informal sentences.  

## Bias, Risks, and Limitations

### Bias

The model may inherit biases from the IIT Bombay English-Hindi dataset, such as:

- Translation bias in cultural, gender, or regional contexts.  
- Limited coverage of less frequent phrases or idioms.  

### Risks

- Inaccurate translations in critical scenarios (e.g., medical or legal use cases).  
- Possible loss of nuance or meaning in complex sentences.  

### Recommendations

- Validate translations for critical use cases.  
- Fine-tune further on domain-specific datasets if required.  

## How to Get Started with the Model

You can load and use the fine-tuned model directly from the Hugging Face Hub:

```python
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM

# Load the tokenizer and model
model_name = "YourUsername/finetuned-opus-mt-en-hi"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)

# Example usage for translation
text = "Hello, how are you?"
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=128)
translation_ids = model.generate(inputs['input_ids'], max_length=128, num_beams=4, early_stopping=True)

# Decode the translated text
translation = tokenizer.decode(translation_ids[0], skip_special_tokens=True)
print("Translation:", translation)
