# anminhhung/pytorch_tutorial architecture

> Architecture diagram of the GitHub repository anminhhung/pytorch_tutorial, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/anminhhung/pytorch_tutorial
- Repository: https://github.com/anminhhung/pytorch_tutorial

## Overview

- Basics Module:
- Component Name: “Basic PyTorch”
- Notebooks: Tensor operations, Autograd, Backpropagation, Gradient Descent, custom dataset/dataloader examples.
- ML from Scratch Module:
- Component Name: “ML Algorithms from Scratch”
- Notebooks: Linear Regression, Logistic Regression, and KNN from ML_from_scratch.
- CNN Module:
- Component Name: “Convolutional Neural Networks”
- Notebooks: LeNet, AlexNet, VGG, InceptionResnet, Age/Gender pipeline, ArcFace, and Image Retrieval pipeline.
- Advanced Models Module:
- Component Name: “Advanced Models & Transformers”
- Notebooks: Vision Transformers (ViT, ViT_patch_4x2) and context-cluster examples.
- NLP Module:
- Component Name: “NLP and Text Processing”
- Notebooks: LSTM for text classification, word tokenization (BPE, BPE Dropout), text processing, and word embedding (word2vec).
- PyTorch Lightning Module:
- Component Name: “PyTorch Lightning Extensions”
- Notebooks: Lightning-based LeNet and an Age/Gender pipeline in PyTorch Lightning.

##### Relationships and Interactions
- That “ML from Scratch” provides a foundation in traditional ML algorithms independent of PyTorch’s automatic differentiation, whereas “Basic PyTorch” introduces you to the core library.
- That CNNs, NLP, and Transformer models demonstrate different application areas; they might share some common underlying PyTorch functionalities.
- The “PyTorch Lightning” module can be depicted as an alternate implementation layer that abstracts some of the boilerplate for model training—thus it interacts with the same basic and CNN (or other advanced methods) modules.

##### Architectural Patterns and Design Principles
- The overall design reflects a modular, layered structure where foundational concepts support more advanced topics.
- There is an implicit separation between “from-scratch” implementations and framework-enhanced implementations (e.g., Pytorch Lightning versus native PyTorch).
- That each module is represented by its own directory which logically separates concerns (e.g., CNN, NLP, etc.).

##### Relevant Technologies and External References
- The notebooks rely on PyTorch as the main framework, and some notebooks leverage external libraries (for instance, imgaug for data augmentation).

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Foundational Modules"
        BP["Basic PyTorch"]:::foundational
        ML["ML Algorithms from Scratch"]:::foundational
    end

    subgraph "Specialized Modules"
        CNN["Convolutional Neural Networks"]:::application
        NLP["NLP and Text Processing"]:::application
        AM["Advanced Models & Transformers"]:::advanced
    end

    subgraph "Alternate Implementations"
        PTL["PyTorch Lightning Extensions"]:::alternate
    end

    BP -->|"supports"| CNN
    BP -->|"supports"| NLP
    BP -->|"supports"| AM
    BP -->|"supports"| PTL

    ML -->|"complements"| CNN
    ML -->|"informs"| AM

    CNN -->|"alternate"| PTL

    click BP "https://github.com/anminhhung/pytorch_tutorial/tree/master/basic_pytorch/"
    click ML "https://github.com/anminhhung/pytorch_tutorial/tree/master/ML_from_scratch/"
    click CNN "https://github.com/anminhhung/pytorch_tutorial/tree/master/CNN/"
    click AM "https://github.com/anminhhung/pytorch_tutorial/tree/master/Model/"
    click NLP "https://github.com/anminhhung/pytorch_tutorial/tree/master/NLP/"
    click PTL "https://github.com/anminhhung/pytorch_tutorial/tree/master/pytorch_lightning/"

    classDef foundational fill:#AED6F1,stroke:#2471A3,stroke-width:2px;
    classDef application fill:#A9DFBF,stroke:#27AE60,stroke-width:2px;
    classDef advanced fill:#F5B7B1,stroke:#C0392B,stroke-width:2px;
    classDef alternate fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
```
