# rohanmuralidharan/transync architecture

> Architecture diagram of the GitHub repository rohanmuralidharan/transync, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rohanmuralidharan/transync
- Repository: https://github.com/rohanmuralidharan/transync

## Overview

Transync is a local MBart-based multilingual translation tool. Its main workflow accepts text and source/target language codes, validates the codes, tokenizes the input, generates target-language tokens, and decodes translated text. The script also supports batch translation from a text file and listing supported languages. The excerpts show the model-loading and translation behavior, but omit parts of the CLI and batch implementation; the graph includes only relationships visible in excerpts or documented in the README.

Main entry points: [`transync_inference.py`](https://github.com/rohanmuralidharan/transync/blob/main/transync_inference.py) (Single translation), [`config.json`](https://github.com/rohanmuralidharan/transync/blob/main/config.json) (Local model files)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_user(("CLI user"))
node_cli["CLI interface"]
node_single["Single translation"]
node_batch["Batch translation"]
node_loader["Model loader"]
node_tokenizer["MBart tokenizer"]
node_model["MBart model"]
node_weights["Local model files<br/>[config.json]"]
node_output(("Translation output"))

node_user -->|"provides text"| node_cli
node_cli -->|"dispatches to"| node_single
node_cli -->|"dispatches to"| node_batch
node_single -->|"loads lazily"| node_loader
node_batch -->|"loads lazily"| node_loader
node_loader -->|"loads model"| node_model
node_loader -->|"loads tokenizer"| node_tokenizer
node_model -->|"reads local files"| node_weights
node_tokenizer -->|"reads local files"| node_weights
node_single -->|"encodes text"| node_tokenizer
node_single -->|"generates tokens"| node_model
node_single -->|"returns translation"| node_output
node_batch -->|"encodes batches"| node_tokenizer
node_batch -->|"generates batches"| node_model
node_batch -->|"returns translations"| node_output

click node_cli "https://github.com/rohanmuralidharan/transync/blob/main/transync_inference.py"
click node_single "https://github.com/rohanmuralidharan/transync/blob/main/transync_inference.py"
click node_batch "https://github.com/rohanmuralidharan/transync/blob/main/transync_inference.py"
click node_loader "https://github.com/rohanmuralidharan/transync/blob/main/transync_inference.py"
click node_tokenizer "https://github.com/rohanmuralidharan/transync/blob/main/transync_inference.py"
click node_model "https://github.com/rohanmuralidharan/transync/blob/main/transync_inference.py"
click node_weights "https://github.com/rohanmuralidharan/transync/blob/main/config.json"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_user toneBlue
class node_cli,node_single,node_batch,node_tokenizer toneTeal
class node_loader,node_model,node_weights,node_output toneIndigo
```

## Components

### Other components

- **CLI user**
- [CLI interface](https://github.com/rohanmuralidharan/transync/blob/main/transync_inference.py): `transync_inference.py`
- [Single translation](https://github.com/rohanmuralidharan/transync/blob/main/transync_inference.py): `transync_inference.py`
- [Batch translation](https://github.com/rohanmuralidharan/transync/blob/main/transync_inference.py): `transync_inference.py`
- [Model loader](https://github.com/rohanmuralidharan/transync/blob/main/transync_inference.py): `transync_inference.py`
- [MBart tokenizer](https://github.com/rohanmuralidharan/transync/blob/main/transync_inference.py): `transync_inference.py`
- [MBart model](https://github.com/rohanmuralidharan/transync/blob/main/transync_inference.py): `transync_inference.py`
- [Local model files](https://github.com/rohanmuralidharan/transync/blob/main/config.json): `config.json`
- **Translation output**

## Connections

- CLI user → CLI interface: provides text (evidence: `README.md`)
- CLI interface → Single translation: dispatches to (evidence: `transync_inference.py`)
- CLI interface → Batch translation: dispatches to (evidence: `transync_inference.py`)
- Single translation → Model loader: loads lazily (evidence: `transync_inference.py`)
- Batch translation → Model loader: loads lazily (evidence: `transync_inference.py`)
- Model loader → MBart model: loads model (evidence: `transync_inference.py`)
- Model loader → MBart tokenizer: loads tokenizer (evidence: `transync_inference.py`)
- MBart model → Local model files: reads local files (evidence: `transync_inference.py`)
- MBart tokenizer → Local model files: reads local files (evidence: `transync_inference.py`)
- Single translation → MBart tokenizer: encodes text (evidence: `transync_inference.py`)
- Single translation → MBart model: generates tokens (evidence: `transync_inference.py`)
- Single translation → Translation output: returns translation (evidence: `transync_inference.py`)
- Batch translation → MBart tokenizer: encodes batches (evidence: `transync_inference.py`)
- Batch translation → MBart model: generates batches (evidence: `transync_inference.py`)
- Batch translation → Translation output: returns translations (evidence: `transync_inference.py`)
