Instructions to use RohanMuralidharan/Transync with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use RohanMuralidharan/Transync with Transformers:
# Use a pipeline as a high-level helper # Warning: Pipeline type "translation" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # 'pip install "transformers<5.0.0' from transformers import pipeline pipe = pipeline("translation", model="RohanMuralidharan/Transync")# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("RohanMuralidharan/Transync") model = AutoModelForSeq2SeqLM.from_pretrained("RohanMuralidharan/Transync") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,38 +1,15 @@
|
|
| 1 |
---
|
| 2 |
-
language:
|
| 3 |
-
- asm
|
| 4 |
-
- ben
|
| 5 |
-
- brx
|
| 6 |
-
- doi
|
| 7 |
-
- gom
|
| 8 |
-
- guj
|
| 9 |
-
- hin
|
| 10 |
-
- kan
|
| 11 |
-
- kas
|
| 12 |
-
- mai
|
| 13 |
-
- mal
|
| 14 |
-
- mar
|
| 15 |
-
- mni
|
| 16 |
-
- npi
|
| 17 |
-
- ory
|
| 18 |
-
- pan
|
| 19 |
-
- san
|
| 20 |
-
- sat
|
| 21 |
-
- snd
|
| 22 |
-
- tam
|
| 23 |
-
- tel
|
| 24 |
-
- urd
|
| 25 |
-
- eng
|
| 26 |
license: mit
|
|
|
|
| 27 |
library_name: transformers
|
| 28 |
-
pipeline_tag: text2text-generation
|
| 29 |
tags:
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
|
|
|
| 36 |
---
|
| 37 |
|
| 38 |
# Transync
|
|
@@ -59,73 +36,33 @@ Transync is a multilingual translation model based on the MBart architecture, de
|
|
| 59 |
|
| 60 |
The model supports 50+ languages including:
|
| 61 |
|
| 62 |
-
##
|
| 63 |
-
- Assamese (asm)
|
| 64 |
-
- Bengali (ben)
|
| 65 |
-
- Bodo (brx)
|
| 66 |
-
- Dogri (doi)
|
| 67 |
-
- Konkani (gom)
|
| 68 |
-
- Gujarati (guj)
|
| 69 |
-
- Hindi (hin)
|
| 70 |
-
- Kannada (kan)
|
| 71 |
-
- Kashmiri (kas)
|
| 72 |
-
- Maithili (mai)
|
| 73 |
-
- Malayalam (mal)
|
| 74 |
-
- Marathi (mar)
|
| 75 |
-
- Manipuri (mni)
|
| 76 |
-
- Nepali (npi)
|
| 77 |
-
- Odia (ory)
|
| 78 |
-
- Punjabi (pan)
|
| 79 |
-
- Sanskrit (san)
|
| 80 |
-
- Santali (sat)
|
| 81 |
-
- Sindhi (snd)
|
| 82 |
-
- Tamil (tam)
|
| 83 |
-
- Telugu (tel)
|
| 84 |
-
- Urdu (urd)
|
| 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 |
-
- Portuguese (por)
|
| 112 |
-
- Romanian (ron)
|
| 113 |
-
- Russian (rus)
|
| 114 |
-
- Sinhala (sin)
|
| 115 |
-
- Slovak (slk)
|
| 116 |
-
- Swedish (swe)
|
| 117 |
-
- Swahili (swa)
|
| 118 |
-
- Thai (tha)
|
| 119 |
-
- Tagalog (tgl)
|
| 120 |
-
- Turkish (tur)
|
| 121 |
-
- Ukrainian (ukr)
|
| 122 |
-
- Vietnamese (vie)
|
| 123 |
-
- Xhosa (xho)
|
| 124 |
-
- Chinese (zho)
|
| 125 |
-
- Azerbaijani (aze)
|
| 126 |
-
- Persian (fas)
|
| 127 |
-
- Galician (glg)
|
| 128 |
-
- Afrikaans (afr)
|
| 129 |
|
| 130 |
## Installation
|
| 131 |
|
|
@@ -135,67 +72,6 @@ Install the required dependencies:
|
|
| 135 |
pip install -r requirements.txt
|
| 136 |
```
|
| 137 |
|
| 138 |
-
## Quick Start
|
| 139 |
-
|
| 140 |
-
```python
|
| 141 |
-
from transync_inference import translate_onemt
|
| 142 |
-
|
| 143 |
-
# Translate English to Hindi
|
| 144 |
-
result = translate_onemt("Hello, how are you?", "eng", "hin")
|
| 145 |
-
print(result) # नमस्ते, आप कैसे हैं?
|
| 146 |
-
```
|
| 147 |
-
|
| 148 |
-
## Python Example
|
| 149 |
-
|
| 150 |
-
```python
|
| 151 |
-
from transync_inference import translate_onemt, translate_batch
|
| 152 |
-
|
| 153 |
-
# Single translation
|
| 154 |
-
translation = translate_onemt(
|
| 155 |
-
text="Good morning!",
|
| 156 |
-
source_lang="eng",
|
| 157 |
-
target_lang="hin"
|
| 158 |
-
)
|
| 159 |
-
print(translation)
|
| 160 |
-
|
| 161 |
-
# Batch translation
|
| 162 |
-
texts = ["Hello", "How are you?", "Goodbye"]
|
| 163 |
-
results = translate_batch(
|
| 164 |
-
texts=texts,
|
| 165 |
-
source_lang="eng",
|
| 166 |
-
target_lang="hin"
|
| 167 |
-
)
|
| 168 |
-
print(results)
|
| 169 |
-
```
|
| 170 |
-
|
| 171 |
-
## Transformers Example
|
| 172 |
-
|
| 173 |
-
```python
|
| 174 |
-
from transformers import MBartForConditionalGeneration, MBart50Tokenizer
|
| 175 |
-
|
| 176 |
-
# Load model and tokenizer
|
| 177 |
-
model = MBartForConditionalGeneration.from_pretrained("RohanMuralidharan/transync")
|
| 178 |
-
tokenizer = MBart50Tokenizer.from_pretrained("RohanMuralidharan/transync")
|
| 179 |
-
|
| 180 |
-
# Set source and target languages
|
| 181 |
-
tokenizer.src_lang = "en_XX"
|
| 182 |
-
target_lang = "hi_IN"
|
| 183 |
-
|
| 184 |
-
# Encode input text
|
| 185 |
-
input_ids = tokenizer("Hello, how are you?", return_tensors="pt").input_ids
|
| 186 |
-
|
| 187 |
-
# Generate translation
|
| 188 |
-
with torch.no_grad():
|
| 189 |
-
outputs = model.generate(
|
| 190 |
-
input_ids,
|
| 191 |
-
forced_bos_token_id=tokenizer.lang_code_to_id[target_lang]
|
| 192 |
-
)
|
| 193 |
-
|
| 194 |
-
# Decode translation
|
| 195 |
-
translated = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 196 |
-
print(translated)
|
| 197 |
-
```
|
| 198 |
-
|
| 199 |
## CLI Example
|
| 200 |
|
| 201 |
```bash
|
|
@@ -230,154 +106,12 @@ This model is built on the MBart (Multilingual BART) architecture, which is a se
|
|
| 230 |
|
| 231 |
The model uses SentencePiece tokenizer for subword tokenization. The tokenizer is compatible with the MBart50 tokenizer format and supports 50+ languages.
|
| 232 |
|
| 233 |
-
## Intended Uses
|
| 234 |
-
|
| 235 |
-
- Offline multilingual translation
|
| 236 |
-
- Research and educational purposes
|
| 237 |
-
- Integration into translation applications
|
| 238 |
-
- Batch processing of text translations
|
| 239 |
-
|
| 240 |
-
## Out-of-Scope Uses
|
| 241 |
-
|
| 242 |
-
- Training new models from scratch (this is a pre-trained model)
|
| 243 |
-
- Commercial use without proper licensing (please check license terms)
|
| 244 |
-
- Use in production systems without proper testing and validation
|
| 245 |
-
|
| 246 |
## Limitations
|
| 247 |
|
| 248 |
-
- Translation quality
|
| 249 |
-
-
|
| 250 |
-
- Performance
|
| 251 |
-
- Requires sufficient computational resources for optimal performance
|
| 252 |
-
|
| 253 |
-
## Ethical Considerations
|
| 254 |
-
|
| 255 |
-
This model is intended for educational and research purposes. Users should be aware of the following considerations:
|
| 256 |
-
|
| 257 |
-
- Translation accuracy may vary depending on language pair and domain
|
| 258 |
-
- The model should not be used to generate misleading or harmful content
|
| 259 |
-
- Users should respect copyright and intellectual property rights when using translations
|
| 260 |
-
- The model's training data sources and limitations should be understood
|
| 261 |
-
|
| 262 |
-
## Hardware Requirements
|
| 263 |
-
|
| 264 |
-
- CPU: Minimum 4GB RAM, Recommended 8GB+
|
| 265 |
-
- GPU: NVIDIA GPU with CUDA support (recommended for faster inference)
|
| 266 |
-
- Storage: At least 2.4GB of storage space for model weights
|
| 267 |
-
|
| 268 |
-
## Performance Notes
|
| 269 |
-
|
| 270 |
-
- CPU inference is suitable for small-scale tasks
|
| 271 |
-
- GPU acceleration significantly improves translation speed
|
| 272 |
-
- Batch processing is more efficient than individual translations
|
| 273 |
-
- Translation quality may vary between language pairs
|
| 274 |
|
| 275 |
## License
|
| 276 |
|
| 277 |
-
|
| 278 |
-
|
| 279 |
-
This model is based on the MBart architecture and uses pre-trained weights from the Hugging Face ecosystem. The model weights are not included in this repository and must be downloaded separately from the Hugging Face Hub.
|
| 280 |
-
**Option 1: Direct Download**
|
| 281 |
-
1. Go to: https://huggingface.co/RohanMuralidharan/Transync
|
| 282 |
-
2. Download `pytorch_model.bin` (2.44 GB)
|
| 283 |
-
3. Place it in the project root directory
|
| 284 |
-
|
| 285 |
-
**Option 2: Using Python**
|
| 286 |
-
```python
|
| 287 |
-
from huggingface_hub import hf_hub_download
|
| 288 |
-
hf_hub_download(
|
| 289 |
-
repo_id='RohanMuralidharan/Transync',
|
| 290 |
-
filename='pytorch_model.bin',
|
| 291 |
-
local_dir='.'
|
| 292 |
-
)
|
| 293 |
-
```
|
| 294 |
-
|
| 295 |
-
**Option 3: Using huggingface-cli**
|
| 296 |
-
```bash
|
| 297 |
-
huggingface-cli download RohanMuralidharan/Transync pytorch_model.bin
|
| 298 |
-
```
|
| 299 |
-
|
| 300 |
-
---
|
| 301 |
-
|
| 302 |
-
### Command Line Usage
|
| 303 |
-
|
| 304 |
-
```bash
|
| 305 |
-
python transync_inference.py eng hin "Hello, how are you?"
|
| 306 |
-
```
|
| 307 |
-
|
| 308 |
-
---
|
| 309 |
-
|
| 310 |
-
## Supported Languages
|
| 311 |
-
|
| 312 |
-
| Short Code | Language | Script | MBart Code |
|
| 313 |
-
|---|---|---|---|
|
| 314 |
-
| `eng` | English | Latin | `en_XX` |
|
| 315 |
-
| `hin` | Hindi | Devanagari | `hi_IN` |
|
| 316 |
-
| `tel` | Telugu | Telugu | `te_IN` |
|
| 317 |
-
| `tam` | Tamil | Tamil | `ta_IN` |
|
| 318 |
-
| `mal` | Malayalam | Malayalam | `ml_IN` |
|
| 319 |
-
| `kan` | Kannada | Kannada | `kn_IN` |
|
| 320 |
-
| `ben` | Bengali | Bengali | `bn_IN` |
|
| 321 |
-
| `guj` | Gujarati | Gujarati | `gu_IN` |
|
| 322 |
-
| `mar` | Marathi | Devanagari | `mr_IN` |
|
| 323 |
-
| `pan` | Punjabi | Gurmukhi | `pa_IN` |
|
| 324 |
-
| `urd` | Urdu | Arabic | `ur_PK` |
|
| 325 |
-
| `asm` | Assamese | Bengali | `as_IN` |
|
| 326 |
-
| `npi` | Nepali | Devanagari | `ne_NP` |
|
| 327 |
-
| `ory` | Odia | Odia | `or_IN` |
|
| 328 |
-
| `san` | Sanskrit | Devanagari | `sa_IN` |
|
| 329 |
-
| `mai` | Maithili | Devanagari | `mai_IN` |
|
| 330 |
-
| `brx` | Bodo | Devanagari | `brx_IN` |
|
| 331 |
-
| `doi` | Dogri | Devanagari | `doi_IN` |
|
| 332 |
-
| `gom` | Konkani | Devanagari | `gom_IN` |
|
| 333 |
-
| `mni` | Meitei | Bengali | `mni_IN` |
|
| 334 |
-
| `sat` | Santali | Ol Chiki | `sat_IN` |
|
| 335 |
-
| `kas` | Kashmiri | Arabic | `ks_IN` |
|
| 336 |
-
| `snd` | Sindhi | Arabic | `sd_IN` |
|
| 337 |
-
|
| 338 |
-
---
|
| 339 |
-
|
| 340 |
-
## How It Works
|
| 341 |
-
|
| 342 |
-
Transync uses standard MBart tokenization with SentencePiece:
|
| 343 |
-
|
| 344 |
-
```
|
| 345 |
-
source text
|
| 346 |
-
→ Add language tag: [en_XX] Hello, how are you?
|
| 347 |
-
→ SentencePiece encoding → subword pieces
|
| 348 |
-
→ MBart encoder
|
| 349 |
-
```
|
| 350 |
-
|
| 351 |
-
The model uses the standard MBart50 tokenizer with language codes for high-quality multilingual translation.
|
| 352 |
-
|
| 353 |
-
---
|
| 354 |
-
|
| 355 |
-
## Repository Files
|
| 356 |
-
|
| 357 |
-
| File | Description |
|
| 358 |
-
|---|---|
|
| 359 |
-
| `pytorch_model.bin` | Model weights (~2.4 GB) |
|
| 360 |
-
| `config.json` | Model architecture config |
|
| 361 |
-
| `generation_config.json` | Generation parameters |
|
| 362 |
-
| `sentencepiece.bpe.model` | SentencePiece tokenizer |
|
| 363 |
-
| `tokenizer_config.json` | Tokenizer config |
|
| 364 |
-
| `special_tokens_map.json` | Special tokens mapping |
|
| 365 |
-
| `transync_inference.py` | Main inference script |
|
| 366 |
-
|
| 367 |
-
---
|
| 368 |
-
|
| 369 |
-
## Verification
|
| 370 |
-
|
| 371 |
-
Test the model with:
|
| 372 |
-
```bash
|
| 373 |
-
python transync_inference.py eng hin "Hello, how are you?"
|
| 374 |
-
```
|
| 375 |
-
|
| 376 |
-
Expected output: `नमस्ते, आप कैसे हैं?`
|
| 377 |
-
|
| 378 |
-
---
|
| 379 |
-
|
| 380 |
-
## License
|
| 381 |
-
|
| 382 |
-
MIT
|
| 383 |
-
|
|
|
|
| 1 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
license: mit
|
| 3 |
+
pipeline_tag: translation
|
| 4 |
library_name: transformers
|
|
|
|
| 5 |
tags:
|
| 6 |
+
- translation
|
| 7 |
+
- multilingual
|
| 8 |
+
- indic
|
| 9 |
+
- mbart
|
| 10 |
+
- model
|
| 11 |
+
- pytorch
|
| 12 |
+
- transformers
|
| 13 |
---
|
| 14 |
|
| 15 |
# Transync
|
|
|
|
| 36 |
|
| 37 |
The model supports 50+ languages including:
|
| 38 |
|
| 39 |
+
## Supported Languages
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
+
| Short Code | Language | Script | MBart Code |
|
| 42 |
+
|---|---|---|---|
|
| 43 |
+
| `eng` | English | Latin | `en_XX` |
|
| 44 |
+
| `hin` | Hindi | Devanagari | `hi_IN` |
|
| 45 |
+
| `tel` | Telugu | Telugu | `te_IN` |
|
| 46 |
+
| `tam` | Tamil | Tamil | `ta_IN` |
|
| 47 |
+
| `mal` | Malayalam | Malayalam | `ml_IN` |
|
| 48 |
+
| `kan` | Kannada | Kannada | `kn_IN` |
|
| 49 |
+
| `ben` | Bengali | Bengali | `bn_IN` |
|
| 50 |
+
| `guj` | Gujarati | Gujarati | `gu_IN` |
|
| 51 |
+
| `mar` | Marathi | Devanagari | `mr_IN` |
|
| 52 |
+
| `pan` | Punjabi | Gurmukhi | `pa_IN` |
|
| 53 |
+
| `urd` | Urdu | Arabic | `ur_PK` |
|
| 54 |
+
| `asm` | Assamese | Bengali | `as_IN` |
|
| 55 |
+
| `npi` | Nepali | Devanagari | `ne_NP` |
|
| 56 |
+
| `ory` | Odia | Odia | `or_IN` |
|
| 57 |
+
| `san` | Sanskrit | Devanagari | `sa_IN` |
|
| 58 |
+
| `mai` | Maithili | Devanagari | `mai_IN` |
|
| 59 |
+
| `brx` | Bodo | Devanagari | `brx_IN` |
|
| 60 |
+
| `doi` | Dogri | Devanagari | `doi_IN` |
|
| 61 |
+
| `gom` | Konkani | Devanagari | `gom_IN` |
|
| 62 |
+
| `mni` | Meitei | Bengali | `mni_IN` |
|
| 63 |
+
| `sat` | Santali | Ol Chiki | `sat_IN` |
|
| 64 |
+
| `kas` | Kashmiri | Arabic | `ks_IN` |
|
| 65 |
+
| `snd` | Sindhi | Arabic | `sd_IN` |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
|
| 67 |
## Installation
|
| 68 |
|
|
|
|
| 72 |
pip install -r requirements.txt
|
| 73 |
```
|
| 74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
## CLI Example
|
| 76 |
|
| 77 |
```bash
|
|
|
|
| 106 |
|
| 107 |
The model uses SentencePiece tokenizer for subword tokenization. The tokenizer is compatible with the MBart50 tokenizer format and supports 50+ languages.
|
| 108 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
## Limitations
|
| 110 |
|
| 111 |
+
- Translation quality varies across language pairs.
|
| 112 |
+
- The model should be evaluated before production use.
|
| 113 |
+
- Performance depends on hardware and input length.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
|
| 115 |
## License
|
| 116 |
|
| 117 |
+
MIT
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|