# squeezebits/owlite architecture

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

- Interactive diagram: https://gitdiagram.com/squeezebits/owlite
- Repository: https://github.com/squeezebits/owlite

## Overview

##### Main System Components

a) Frontend Layer:
- Web UI (owlite.ai)
- CLI Interface (src/owlite/core/cli)
- API Interface (src/owlite/api)

b) Core Processing Layer:
- Model Visualization Engine
- Compression Pipeline
- Quantization Engine
- Benchmarking System

c) Backend Layer:
- FX Backend (src/owlite/backend/fx)
- ONNX Backend (src/owlite/backend/onnx)
- Calibration System (src/owlite/calib)

##### Component Relationships

a) User Interaction Flow:
**Web UI/CLI → API Layer → Core Processing → Backend Services**

b) Model Processing Flow:
**Input Model → FX Backend → ONNX Backend → Optimized Model**

##### Detailed Component Breakdown

- Model Visualization Service
- Quantization Service (src/owlite/nn)
- Benchmarking Service
- Device Farm Management

b) Processing Components (Hexagons):
- FX Graph Transformation (src/owlite/backend/fx/passes)
- ONNX Export & Optimization
- Calibration Systems (src/owlite/calib)

c) Support Systems (Rounded rectangles):
- Configuration Management (src/owlite/options)
- Cache System (src/owlite/core/cache)
- Authentication (src/owlite/core/cli/api/login.py)

##### Technical Details

Annotations for:
- Supported Python versions (>=3.10, <3.13)
- PyTorch version requirements (>=2.1.2<2.5)
- External service integrations
- Device farm connection points

##### Latency Benchmarking

This will create a comprehensive yet clear representation of OwLite's architecture that accurately reflects its purpose as a low-code AI model compression toolkit.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef frontend fill:#90EE90,stroke:#333,stroke-width:2px
    classDef core fill:#87CEEB,stroke:#333,stroke-width:2px
    classDef backend fill:#FFA07A,stroke:#333,stroke-width:2px
    classDef support fill:#D3D3D3,stroke:#333,stroke-width:2px

    %% Frontend Layer
    subgraph Frontend
        WebUI["Web UI (owlite.ai)"]:::frontend
        CLI["CLI Interface"]:::frontend
        API["API Interface"]:::frontend
    end

    %% Core Processing Layer
    subgraph CoreProcessing
        VisEngine["Model Visualization Engine"]:::core
        CompPipeline["Compression Pipeline"]:::core
        QuantEngine["Quantization Engine"]:::core
        BenchSystem["Benchmarking System"]:::core
    end

    %% Backend Layer
    subgraph Backend
        FXBackend["FX Backend"]:::backend
        ONNXBackend["ONNX Backend"]:::backend
        CalibSystem["Calibration System"]:::backend
    end

    %% Support Systems
    subgraph Support
        Config["Configuration Management"]:::support
        Cache["Cache System"]:::support
        Auth["Authentication"]:::support
        DeviceMgmt["Device Farm Management"]:::support
    end

    %% Processing Components
    FXGraph["FX Graph Transformation"]:::backend
    ONNXOpt["ONNX Export & Optimization"]:::backend
    QuantModules["Quantization Modules"]:::core

    %% Relationships
    WebUI --> API
    CLI --> API
    API --> CompPipeline
    API --> VisEngine
    API --> BenchSystem
    
    CompPipeline --> FXBackend
    CompPipeline --> QuantEngine
    QuantEngine --> QuantModules
    QuantModules --> CalibSystem
    
    FXBackend --> FXGraph
    FXGraph --> ONNXBackend
    ONNXBackend --> ONNXOpt
    
    BenchSystem --> DeviceMgmt
    
    %% Support System Connections
    API --> Auth
    CompPipeline --> Config
    CompPipeline --> Cache

    %% Click Events
    click CLI "https://github.com/squeezebits/owlite/blob/master/src/owlite/core/cli/owlite_cli.py"
    click API "https://github.com/squeezebits/owlite/tree/master/src/owlite/api/"
    click FXBackend "https://github.com/squeezebits/owlite/tree/master/src/owlite/backend/fx/"
    click ONNXBackend "https://github.com/squeezebits/owlite/tree/master/src/owlite/backend/onnx/"
    click CalibSystem "https://github.com/squeezebits/owlite/tree/master/src/owlite/calib/"
    click QuantEngine "https://github.com/squeezebits/owlite/tree/master/src/owlite/nn/"
    click Cache "https://github.com/squeezebits/owlite/tree/master/src/owlite/core/cache/"
    click Auth "https://github.com/squeezebits/owlite/blob/master/src/owlite/core/cli/api/login.py"
    click Config "https://github.com/squeezebits/owlite/tree/master/src/owlite/options/"
    click CompPipeline "https://github.com/squeezebits/owlite/blob/master/src/owlite/compression.py"
    click FXGraph "https://github.com/squeezebits/owlite/tree/master/src/owlite/backend/fx/passes/"
    click ONNXOpt "https://github.com/squeezebits/owlite/blob/master/src/owlite/backend/onnx/optimize.py"
    click BenchSystem "https://github.com/squeezebits/owlite/blob/master/src/owlite/api/benchmarkable.py"
    click QuantModules "https://github.com/squeezebits/owlite/tree/master/src/owlite/nn/modules/"
    click DeviceMgmt "https://github.com/squeezebits/owlite/blob/master/src/owlite/core/cli/device.py"

    %% Legend
    subgraph Legend
        Frontend_L["Frontend Components"]:::frontend
        Core_L["Core Components"]:::core
        Backend_L["Backend Components"]:::backend
        Support_L["Support Systems"]:::support
    end
```
