# mayadispeler/morsent-128-mini architecture

> Architecture diagram of the GitHub repository mayadispeler/morsent-128-mini, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mayadispeler/morsent-128-mini
- Repository: https://github.com/mayadispeler/morsent-128-mini

## Overview

##### Project type and purpose
- Morsent-128T is a tiny, fine-tuned GPT-2 language model packaged for inference. It’s not a multi-service web app but an ML artifact intended for text-to-Morse, Morse-to-text, and TARS-style humor within 128 tokens.

##### File structure
- Top-level:
- README.md – project overview and usage
- .gitattributes – VCS settings
- morsent-model/ – the model distribution package
- morsent-model/ contents:
- config.json – model hyperparameters and architecture spec
- generation_config.json – default generation settings (e.g., max_length, temperature)
- merges.txt, vocab.json – tokenizer vocabulary files (BPE merges and vocab)
- tokenizer.json, tokenizer_config.json – tokenizer implementation metadata
- special_tokens_map.json – mapping of special tokens (e.g., [/INST])
- model.safetensors – the fine-tuned model weights

##### README for additional insights
- Purpose: inference only, demo of a mini LLM on Morse translation and humor
- Dependencies: Hugging Face’s transformers library, PyTorch under the hood
- Usage:
- Load model & tokenizer via `from_pretrained`
- Tokenize prompt → run `model.generate` → decode output

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client
    Client["Client Application"]:::external

    %% Pipeline modules
    Tokenizer["Tokenizer / Preprocessing"]:::codeModule
    Model["Model Inference\n(GPT2LMHeadModel\n(context length=128)"]:::codeModule
    Detokenizer["Detokenizer / Postprocessing"]:::codeModule

    %% Output
    Output["Final Text Output"]:::external

    %% Artifact storage
    subgraph "morsent-model/" 
        direction TB
        config["config.json"]:::dataArtifact
        generation_config["generation_config.json"]:::dataArtifact
        merges["merges.txt"]:::dataArtifact
        vocab["vocab.json"]:::dataArtifact
        tokenizer_json["tokenizer.json"]:::dataArtifact
        tokenizer_config["tokenizer_config.json"]:::dataArtifact
        special_tokens_map["special_tokens_map.json"]:::dataArtifact
        model_weights["model.safetensors"]:::dataArtifact
    end

    %% External dependencies
    subgraph "External Dependencies"
        direction TB
        HF["transformers"]:::deps
        Torch["torch"]:::deps
        Safetensors["safetensors"]:::deps
    end

    %% Data flow
    Client -->|"raw text prompt"| Tokenizer
    Tokenizer -->|"token IDs"| Model
    Model -->|"token IDs"| Detokenizer
    Detokenizer -->|"final text"| Client

    %% Configuration loading into modules
    merges -->|load merges| Tokenizer
    vocab -->|load vocab| Tokenizer
    tokenizer_config -->|load tokenizer config| Tokenizer
    tokenizer_json -->|load tokenizer metadata| Detokenizer
    special_tokens_map -->|load special tokens map| Detokenizer

    config -->|load model config| Model
    generation_config -->|load generation settings| Model
    model_weights -->|load weights| Model

    %% Dependencies usage
    HF -.->|imports| Tokenizer
    HF -.->|imports| Model
    Torch -.->|runtime| Model
    Safetensors -.->|weight loader| Model

    %% Click events
    click Client "https://github.com/mayadispeler/morsent-128-mini/blob/main/README.md"
    click merges "https://github.com/mayadispeler/morsent-128-mini/blob/main/morsent-model/merges.txt"
    click vocab "https://github.com/mayadispeler/morsent-128-mini/blob/main/morsent-model/vocab.json"
    click tokenizer_json "https://github.com/mayadispeler/morsent-128-mini/blob/main/morsent-model/tokenizer.json"
    click tokenizer_config "https://github.com/mayadispeler/morsent-128-mini/blob/main/morsent-model/tokenizer_config.json"
    click special_tokens_map "https://github.com/mayadispeler/morsent-128-mini/blob/main/morsent-model/special_tokens_map.json"
    click config "https://github.com/mayadispeler/morsent-128-mini/blob/main/morsent-model/config.json"
    click generation_config "https://github.com/mayadispeler/morsent-128-mini/blob/main/morsent-model/generation_config.json"
    click model_weights "https://github.com/mayadispeler/morsent-128-mini/blob/main/morsent-model/model.safetensors"

    %% Styles
    classDef codeModule fill:#BFDBFE,stroke:#1E40AF
    classDef dataArtifact fill:#BBF7D0,stroke:#166534
    classDef external fill:#FDE68A,stroke:#92400E
    classDef deps fill:#F3F4F6,stroke-dasharray:5 5,stroke:#6B7280
```
