# salvacarrion/autonmt architecture

> Architecture diagram of the GitHub repository salvacarrion/autonmt, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/salvacarrion/autonmt
- Repository: https://github.com/salvacarrion/autonmt

## Overview

##### Main Components Identification

The system should be divided into these major components:

a) Core Framework Components:
- Preprocessing Pipeline
- Model Management
- Training/Evaluation System
- Toolkit Abstraction Layer
- Reporting & Visualization

b) Supporting Components:
- Dataset Management
- Vocabulary Management
- Search Algorithms
- Metrics Collection

##### Component Relationships

**[Input Data] → [Preprocessing Pipeline] → [Dataset Management]**
- ↓
**[Toolkit Abstraction Layer] ←→ [Model Management] → [Training System]**
- ↓
**[Search Algorithms] ←→ [Inference Pipeline] → [Evaluation System]**
- ↓
**[Metrics Collection] → [Reporting & Visualization]**

##### Detailed Component Breakdown

a) Preprocessing Pipeline (autonmt/preprocessing/):
- Raw Data → Builder → Processors → Tokenizers → Encoded Data
- Bidirectional connection to Dataset Management

b) Model Management (autonmt/modules/):
- Custom Models (RNN, Transformer, Conv)
- External Toolkits (Fairseq)
- Layer Components
- Dataset Handlers

c) Training/Evaluation System:
- Parallel paths for:
- AutoNMT native pipeline
- Fairseq pipeline
- Connections to search algorithms (beam/greedy)

d) Toolkit Abstraction (autonmt/toolkits/):
- Compatibility with different backends

##### Technical Details

- PyTorch Lightning integration points
- Vocabulary management system
- Dataset builder workflow
- Metrics collection pipeline
- Report generation system

##### Implementation Notes

- Clear separation between custom and third-party components
- Component interfaces and API boundaries
- Configuration entry points
- File storage organization

##### Additional Elements

- Dataset Builder workflow
- Training pipeline
- Evaluation pipeline
- Reporting system

Remember to:
- Version information and compatibility notes

This system design should capture both the high-level architecture and the detailed workflows while maintaining clarity and usefulness for development and documentation purposes.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Data_Flow
        Input[Raw Input Data]
        Encoded[Encoded Data]
    end

    subgraph Preprocessing
        PreProc[Preprocessing Pipeline]:::preproc
        RawProc[Raw Data Processing]:::preproc
        Token[Tokenization]:::preproc
        Build[Builder]:::preproc
    end

    subgraph Models
        ModMgmt[Model Management]:::model
        CoreMod[Core Models]:::model
        LayerComp[Layer Components]:::model
        Seq2Seq[Sequence-to-Sequence Base]:::model
    end

    subgraph Datasets
        DataMgmt[Dataset Management]:::data
        CoreDS[Core Dataset]:::data
        DSProc[Dataset Processing]:::data
        Sampler[Samplers]:::data
    end

    subgraph Toolkits
        ToolAbs[Toolkit Abstraction Layer]:::toolkit
        BaseKit[Base Toolkit]:::toolkit
        AutoImpl[AutoNMT Implementation]:::toolkit
        FairInt[Fairseq Integration]:::toolkit
    end

    subgraph Search
        SearchAlg[Search Algorithms]:::search
        BeamS[Beam Search]:::search
        GreedyS[Greedy Search]:::search
    end

    subgraph Vocabulary
        VocabMgmt[Vocabulary Management]:::vocab
        BaseVocab[Base Vocabulary]:::vocab
        WSVocab[Whitespace Vocabulary]:::vocab
    end

    subgraph Reporting
        Report[Reporting & Visualization]:::report
        Metrics[Metrics Collection]:::report
        Plot[Plotting]:::report
        RepGen[Report Generation]:::report
    end

    Input --> PreProc
    PreProc --> RawProc
    RawProc --> Token
    Token --> Build
    Build --> Encoded
    
    PreProc --> DataMgmt
    DataMgmt --> CoreDS
    DataMgmt --> DSProc
    DataMgmt --> Sampler
    
    ModMgmt --> CoreMod
    ModMgmt --> LayerComp
    ModMgmt --> Seq2Seq
    
    ToolAbs --> BaseKit
    ToolAbs --> AutoImpl
    ToolAbs --> FairInt
    
    SearchAlg --> BeamS
    SearchAlg --> GreedyS
    
    VocabMgmt --> BaseVocab
    VocabMgmt --> WSVocab
    
    Report --> Metrics
    Report --> Plot
    Report --> RepGen

    ModMgmt <--> ToolAbs
    DataMgmt --> ModMgmt
    SearchAlg --> ModMgmt
    ModMgmt --> Report

    classDef preproc fill:#90EE90
    classDef model fill:#FFA500
    classDef data fill:#87CEEB
    classDef toolkit fill:#A9A9A9
    classDef search fill:#DDA0DD
    classDef vocab fill:#F0E68C
    classDef report fill:#FFB6C1

    click PreProc "https://github.com/salvacarrion/autonmt/tree/main/autonmt/preprocessing/"
    click RawProc "https://github.com/salvacarrion/autonmt/blob/main/autonmt/preprocessing/processors.py"
    click Token "https://github.com/salvacarrion/autonmt/blob/main/autonmt/preprocessing/tokenizers.py"
    click Build "https://github.com/salvacarrion/autonmt/blob/main/autonmt/preprocessing/builder.py"
    click ModMgmt "https://github.com/salvacarrion/autonmt/tree/main/autonmt/modules/"
    click CoreMod "https://github.com/salvacarrion/autonmt/tree/main/autonmt/modules/models/"
    click LayerComp "https://github.com/salvacarrion/autonmt/tree/main/autonmt/modules/layers/"
    click Seq2Seq "https://github.com/salvacarrion/autonmt/blob/main/autonmt/modules/seq2seq.py"
    click CoreDS "https://github.com/salvacarrion/autonmt/blob/main/autonmt/modules/datasets/seq2seq_dataset.py"
    click DSProc "https://github.com/salvacarrion/autonmt/blob/main/autonmt/preprocessing/dataset.py"
    click Sampler "https://github.com/salvacarrion/autonmt/tree/main/autonmt/modules/samplers/"
    click ToolAbs "https://github.com/salvacarrion/autonmt/tree/main/autonmt/toolkits/"
    click BaseKit "https://github.com/salvacarrion/autonmt/blob/main/autonmt/toolkits/base.py"
    click AutoImpl "https://github.com/salvacarrion/autonmt/blob/main/autonmt/toolkits/autonmt.py"
    click FairInt "https://github.com/salvacarrion/autonmt/blob/main/autonmt/toolkits/fairseq.py"
    click BeamS "https://github.com/salvacarrion/autonmt/blob/main/autonmt/search/beam_search.py"
    click GreedyS "https://github.com/salvacarrion/autonmt/blob/main/autonmt/search/greedy_search.py"
    click VocabMgmt "https://github.com/salvacarrion/autonmt/tree/main/autonmt/vocabularies/"
    click BaseVocab "https://github.com/salvacarrion/autonmt/blob/main/autonmt/vocabularies/base_vocab.py"
    click WSVocab "https://github.com/salvacarrion/autonmt/blob/main/autonmt/vocabularies/whitespace_vocab.py"
    click Report "https://github.com/salvacarrion/autonmt/tree/main/autonmt/bundle/"
    click Metrics "https://github.com/salvacarrion/autonmt/blob/main/autonmt/bundle/metrics.py"
    click Plot "https://github.com/salvacarrion/autonmt/blob/main/autonmt/bundle/plots.py"
    click RepGen "https://github.com/salvacarrion/autonmt/blob/main/autonmt/bundle/report.py"
```
