File size: 4,089 Bytes
3fa8f3e
 
00c68bb
3fa8f3e
 
00c68bb
 
 
 
 
 
 
3fa8f3e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
00c68bb
3fa8f3e
00c68bb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3fa8f3e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
00c68bb
 
 
3fa8f3e
 
 
00c68bb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
---
license: mit
pipeline_tag: translation
library_name: transformers
tags:
- translation
- multilingual
- indic
- mbart
- model
- pytorch
- transformers
---

# Transync

[![Hugging Face Hub](https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Model-blue)](https://huggingface.co/RohanMuralidharan/transync)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
[![PyTorch](https://img.shields.io/badge/PyTorch-%23EE4C2C.svg?style=flat&logo=pytorch&logoColor=white)](https://pytorch.org/)

## Model Overview

Transync is a multilingual translation model based on the MBart architecture, designed for offline neural machine translation. This repository provides inference capabilities for translating between 50+ languages including all major Indian languages (Hindi, Telugu, Tamil, Bengali, Gujarati, Marathi, Punjabi, Urdu, and more).

## Features

- βœ… **Multilingual Support**: 50+ languages including all major Indian languages
- βœ… **High-Quality Translations**: Based on the MBart architecture
- βœ… **Offline Operation**: Works without internet connection
- βœ… **Efficient Inference**: Optimized for both CPU and GPU
- βœ… **Batch Processing**: Supports batch translation for efficiency
- βœ… **CLI Interface**: Command-line interface for easy usage

## Supported Languages

The model supports 50+ languages including:

## Supported Languages

| Short Code | Language | Script | MBart Code |
|---|---|---|---|
| `eng` | English | Latin | `en_XX` |
| `hin` | Hindi | Devanagari | `hi_IN` |
| `tel` | Telugu | Telugu | `te_IN` |
| `tam` | Tamil | Tamil | `ta_IN` |
| `mal` | Malayalam | Malayalam | `ml_IN` |
| `kan` | Kannada | Kannada | `kn_IN` |
| `ben` | Bengali | Bengali | `bn_IN` |
| `guj` | Gujarati | Gujarati | `gu_IN` |
| `mar` | Marathi | Devanagari | `mr_IN` |
| `pan` | Punjabi | Gurmukhi | `pa_IN` |
| `urd` | Urdu | Arabic | `ur_PK` |
| `asm` | Assamese | Bengali | `as_IN` |
| `npi` | Nepali | Devanagari | `ne_NP` |
| `ory` | Odia | Odia | `or_IN` |
| `san` | Sanskrit | Devanagari | `sa_IN` |
| `mai` | Maithili | Devanagari | `mai_IN` |
| `brx` | Bodo | Devanagari | `brx_IN` |
| `doi` | Dogri | Devanagari | `doi_IN` |
| `gom` | Konkani | Devanagari | `gom_IN` |
| `mni` | Meitei | Bengali | `mni_IN` |
| `sat` | Santali | Ol Chiki | `sat_IN` |
| `kas` | Kashmiri | Arabic | `ks_IN` |
| `snd` | Sindhi | Arabic | `sd_IN` |

## Installation

Install the required dependencies:

```bash
pip install -r requirements.txt
```

## CLI Example

```bash
# Translate single text
python transync_inference.py eng hin "Hello, how are you?"

# Batch translation from file
python transync_inference.py --batch eng hin -f input.txt -o output.txt
```

## Repository Structure

```
transync/
β”œβ”€β”€ config.json                 # Model configuration
β”œβ”€β”€ generation_config.json      # Generation configuration
β”œβ”€β”€ pytorch_model.bin           # Model weights
β”œβ”€β”€ sentencepiece.bpe.model     # SentencePiece tokenizer model
β”œβ”€β”€ tokenizer_config.json       # Tokenizer configuration
β”œβ”€β”€ special_tokens_map.json     # Special tokens mapping
β”œβ”€β”€ README.md                   # This file
β”œβ”€β”€ LICENSE                     # MIT License
β”œβ”€β”€ requirements.txt            # Dependencies
└── transync_inference.py       # Inference code
```

## Model Architecture

This model is built on the MBart (Multilingual BART) architecture, which is a sequence-to-sequence model pre-trained on multilingual data. It leverages the power of BART's bidirectional encoder and autoregressive decoder for translation tasks.

## Tokenizer

The model uses SentencePiece tokenizer for subword tokenization. The tokenizer is compatible with the MBart50 tokenizer format and supports 50+ languages.

## Limitations

- Translation quality varies across language pairs.
- The model should be evaluated before production use.
- Performance depends on hardware and input length.

## License

MIT