# homebrewltd/ichigo architecture

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

- Interactive diagram: https://gitdiagram.com/homebrewltd/ichigo
- Repository: https://github.com/homebrewltd/ichigo

## Overview

Ichigo is a developer-facing speech inference package. Its implemented workflow accepts audio through Python batch transcription or the FastAPI service, preprocesses and chunks it, encodes speech as representations, quantizes them, and decodes text; API routes also expose speech-to-representation and representation-to-text separately. The graph includes the reusable model layers and README-documented experimental LLM and forthcoming TTS capabilities. LLM/TTS implementation and some transcriber internals were not sampled, so their runtime links are omitted.

Main entry points: [`ichigo/asr/transcriber.py`](https://github.com/homebrewltd/ichigo/blob/main/ichigo/asr/transcriber.py) (Batch transcriber), [`api/asr.py`](https://github.com/homebrewltd/ichigo/blob/main/api/asr.py) (FastAPI service), [`ichigo/asr/arch/quantizer.py`](https://github.com/homebrewltd/ichigo/blob/main/ichigo/asr/arch/quantizer.py) (Speech quantizer), [`ichigo/asr/__init__.py`](https://github.com/homebrewltd/ichigo/blob/main/ichigo/asr/__init__.py) (Python API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_python_api["Python API<br/>[__init__.py]"]
  node_fastapi["FastAPI service<br/>[asr.py]"]
end

subgraph group_asr["ASR workflow"]
  node_batch_transcriber["Batch transcriber<br/>[transcriber.py]"]
  node_audio_prep["Audio preparation<br/>[transcriber.py]"]
  node_transcript["Transcript output"]
  node_stoks["Speech tokens"]
end

subgraph group_models["Model architecture"]
  node_speech_encoder["Speech encoder<br/>[s2r.py]"]
  node_quantizer["Speech quantizer<br/>[quantizer.py]"]
  node_rep_decoder["Text decoder<br/>[r2t.py]"]
  node_model_layers["Attention layers<br/>[layers.py]"]
end

subgraph group_capabilities["Other capabilities"]
  node_llm["Experimental speech LLM"]
  node_tts["Planned TTS"]
end

node_developer(("Developer"))
node_audio_input["Audio input"]

node_developer -->|"calls"| node_python_api
node_developer -->|"uploads audio"| node_fastapi
node_audio_input -->|"processes"| node_batch_transcriber
node_python_api -->|"delegates to"| node_batch_transcriber
node_fastapi -->|"loads model"| node_batch_transcriber
node_batch_transcriber -->|"preprocesses"| node_audio_prep
node_batch_transcriber -->|"uses"| node_speech_encoder
node_batch_transcriber -->|"uses"| node_quantizer
node_batch_transcriber -->|"uses"| node_rep_decoder
node_fastapi -->|"encodes audio"| node_speech_encoder
node_fastapi -->|"quantizes representations"| node_quantizer
node_fastapi -->|"decodes representations"| node_rep_decoder
node_quantizer -->|"uses"| node_model_layers
node_batch_transcriber -->|"writes transcript"| node_transcript
node_fastapi -->|"returns text"| node_transcript
node_fastapi -->|"returns tokens"| node_stoks

click node_python_api "https://github.com/homebrewltd/ichigo/blob/main/ichigo/asr/__init__.py"
click node_batch_transcriber "https://github.com/homebrewltd/ichigo/blob/main/ichigo/asr/transcriber.py"
click node_fastapi "https://github.com/homebrewltd/ichigo/blob/main/api/asr.py"
click node_audio_prep "https://github.com/homebrewltd/ichigo/blob/main/ichigo/asr/transcriber.py"
click node_speech_encoder "https://github.com/homebrewltd/ichigo/blob/main/ichigo/asr/arch/s2r.py"
click node_quantizer "https://github.com/homebrewltd/ichigo/blob/main/ichigo/asr/arch/quantizer.py"
click node_rep_decoder "https://github.com/homebrewltd/ichigo/blob/main/ichigo/asr/arch/r2t.py"
click node_model_layers "https://github.com/homebrewltd/ichigo/blob/main/ichigo/asr/arch/layers.py"
click node_llm "https://github.com/homebrewltd/ichigo/tree/main/ichigo/llm"
click node_tts "https://github.com/homebrewltd/ichigo/tree/main/ichigo/tts"

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_python_api,node_fastapi toneBlue
class node_batch_transcriber,node_audio_prep,node_transcript,node_stoks toneAmber
class node_speech_encoder,node_quantizer,node_rep_decoder,node_model_layers toneMint
class node_llm,node_tts toneRose
class node_developer,node_audio_input toneIndigo
```

## Components

### User interfaces

- [Python API](https://github.com/homebrewltd/ichigo/blob/main/ichigo/asr/__init__.py): `ichigo/asr/__init__.py`
- [FastAPI service](https://github.com/homebrewltd/ichigo/blob/main/api/asr.py): `api/asr.py`

### ASR workflow

- [Batch transcriber](https://github.com/homebrewltd/ichigo/blob/main/ichigo/asr/transcriber.py): `ichigo/asr/transcriber.py`
- [Audio preparation](https://github.com/homebrewltd/ichigo/blob/main/ichigo/asr/transcriber.py): `ichigo/asr/transcriber.py`
- **Transcript output**
- **Speech tokens**

### Model architecture

- [Speech encoder](https://github.com/homebrewltd/ichigo/blob/main/ichigo/asr/arch/s2r.py): `ichigo/asr/arch/s2r.py`
- [Speech quantizer](https://github.com/homebrewltd/ichigo/blob/main/ichigo/asr/arch/quantizer.py): `ichigo/asr/arch/quantizer.py`
- [Text decoder](https://github.com/homebrewltd/ichigo/blob/main/ichigo/asr/arch/r2t.py): `ichigo/asr/arch/r2t.py`
- [Attention layers](https://github.com/homebrewltd/ichigo/blob/main/ichigo/asr/arch/layers.py): `ichigo/asr/arch/layers.py`

### Other capabilities

- [Experimental speech LLM](https://github.com/homebrewltd/ichigo/tree/main/ichigo/llm): `ichigo/llm`
- [Planned TTS](https://github.com/homebrewltd/ichigo/tree/main/ichigo/tts): `ichigo/tts`

### Other components

- **Developer**
- **Audio input**

## Connections

- Developer → Python API: calls (evidence: `README.md`)
- Developer → FastAPI service: uploads audio (evidence: `README.md`)
- Audio input → Batch transcriber: processes (evidence: `README.md`)
- Python API → Batch transcriber: delegates to (evidence: `ichigo/asr/__init__.py`)
- FastAPI service → Batch transcriber: loads model (evidence: `api/asr.py`)
- Batch transcriber → Audio preparation: preprocesses (evidence: `ichigo/asr/transcriber.py`)
- Batch transcriber → Speech encoder: uses (evidence: `ichigo/asr/transcriber.py`)
- Batch transcriber → Speech quantizer: uses (evidence: `ichigo/asr/transcriber.py`)
- Batch transcriber → Text decoder: uses (evidence: `ichigo/asr/transcriber.py`)
- FastAPI service → Speech encoder: encodes audio (evidence: `api/asr.py`)
- FastAPI service → Speech quantizer: quantizes representations (evidence: `api/asr.py`)
- FastAPI service → Text decoder: decodes representations (evidence: `api/asr.py`)
- Speech quantizer → Attention layers: uses (evidence: `ichigo/asr/arch/quantizer.py`)
- Batch transcriber → Transcript output: writes transcript (evidence: `README.md`)
- FastAPI service → Transcript output: returns text (evidence: `api/asr.py`)
- FastAPI service → Speech tokens: returns tokens (evidence: `api/asr.py`)
