# yongchoooon/stellar architecture

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

- Interactive diagram: https://gitdiagram.com/yongchoooon/stellar
- Repository: https://github.com/yongchoooon/stellar

## Overview

STELLAR edits scene text for low-resource languages: users prepare source/target text-image data, train glyph and style encoders, train a diffusion generator, then run configured inference and evaluate image quality, style preservation, and recognition accuracy. The repository also includes synthetic-data generation and a substantial Diffusers runtime. Connections for the STELLAR stages follow README descriptions; sampled source references establish only the additional implementation links shown. Unsampled application internals are represented by their exact directories.

Main entry points: [`src/trainer/CtrlBase.py`](https://github.com/yongchoooon/stellar/blob/main/src/trainer/CtrlBase.py) (Diffusion training), [`diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint.py`](https://github.com/yongchoooon/stellar/blob/main/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint.py) (Diffusion pipelines), [`diffusers/pipeline_flax_utils.py`](https://github.com/yongchoooon/stellar/blob/main/diffusers/pipeline_flax_utils.py) (Flax pipeline), [`datagen/Synthtext/gen.py`](https://github.com/yongchoooon/stellar/blob/main/datagen/Synthtext/gen.py) (Synthetic text generator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_synthetic["Synthetic text generator<br/>[gen.py]"]
  node_stage1data["Stage 1 data<br/>[datagen.py]"]
  node_stiplar[("STIPLAR data")]
end

subgraph group_encoders["Encoder pretraining"]
  node_glyph["Glyph encoder<br/>[modules.py]"]
  node_style["Style encoder<br/>[model.py]"]
end

subgraph group_generation["Diffusion generation"]
  node_train["Diffusion training<br/>[CtrlBase.py]"]
  node_textdata["Text dataset<br/>[textdata.py]"]
  node_textencoder["Text encoder<br/>[modules.py]"]
end

subgraph group_product["Inference and evaluation"]
  node_inferenceconfig["Inference config"]
  node_stellar["Text editor<br/>[stellar.py]"]
  node_stellarapp["Editing application<br/>[stellar_app.py]"]
  node_evaluation["Image/style evaluation<br/>[evaluation.py]"]
  node_ocr["OCR evaluation<br/>[evaluation_ocr.py]"]
  node_ocrar["Arabic OCR evaluation"]
end

subgraph group_runtime["Diffusion runtime"]
  node_diffpipeline["Diffusion pipelines"]
  node_pipelinebase["Pipeline loading<br/>[pipeline_utils.py]"]
  node_flaxpipeline["Flax pipeline"]
  node_models["Denoising models"]
  node_flaxmodels["Flax model"]
  node_schedulers["Schedulers<br/>[scheduling_pndm.py]"]
  node_flaxscheduler["Flax schedulers"]
  node_config["Model configuration"]
  node_hub["Hub utilities<br/>[hub_utils.py]"]
  node_safety["Safety checker<br/>[safety_checker.py]"]
end

node_researcher(("Researcher"))

node_researcher -->|"generates data"| node_synthetic
node_synthetic -->|"produces"| node_stage1data
node_researcher -->|"obtains dataset"| node_stiplar
node_researcher -->|"pretrains"| node_glyph
node_researcher -->|"pretrains"| node_style
node_researcher -->|"trains stages"| node_train
node_stage1data -->|"feeds stage one"| node_train
node_stiplar -->|"feeds stage two"| node_train
node_glyph -->|"provides pretrained weights"| node_train
node_style -->|"provides pretrained weights"| node_train
node_researcher -->|"runs configured"| node_inferenceconfig
node_inferenceconfig -->|"dispatches"| node_stellar
node_inferenceconfig -->|"dispatches"| node_stellarapp
node_researcher -->|"evaluates results"| node_evaluation
node_researcher -->|"measures recognition"| node_ocr
node_researcher -->|"measures Arabic recognition"| node_ocrar
node_synthetic -->|"renders masks and text"| node_stage1data
node_diffpipeline -->|"inherits loading"| node_pipelinebase
node_diffpipeline -->|"uses denoiser"| node_models
node_diffpipeline -->|"steps scheduler"| node_schedulers
node_diffpipeline -->|"checks output"| node_safety
node_pipelinebase -->|"loads configuration"| node_config
node_pipelinebase -->|"downloads weights"| node_hub
node_flaxpipeline -->|"uses configuration"| node_config
node_flaxpipeline -->|"loads scheduler"| node_flaxscheduler
node_flaxpipeline -.->|"loads model"| node_flaxmodels

click node_synthetic "https://github.com/yongchoooon/stellar/blob/main/datagen/Synthtext/gen.py"
click node_stage1data "https://github.com/yongchoooon/stellar/blob/main/datagen/datagen.py"
click node_glyph "https://github.com/yongchoooon/stellar/blob/main/preglyph/modules.py"
click node_style "https://github.com/yongchoooon/stellar/blob/main/prestyle/model.py"
click node_train "https://github.com/yongchoooon/stellar/blob/main/src/trainer/CtrlBase.py"
click node_textdata "https://github.com/yongchoooon/stellar/blob/main/src/dataset/textdata.py"
click node_textencoder "https://github.com/yongchoooon/stellar/blob/main/src/module/textencoder/modules.py"
click node_inferenceconfig "https://github.com/yongchoooon/stellar/blob/main/inference_by_config.py"
click node_stellar "https://github.com/yongchoooon/stellar/blob/main/src/stellar/stellar.py"
click node_stellarapp "https://github.com/yongchoooon/stellar/blob/main/src/stellar/stellar_app.py"
click node_evaluation "https://github.com/yongchoooon/stellar/blob/main/evaluation/evaluation.py"
click node_ocr "https://github.com/yongchoooon/stellar/blob/main/evaluation/evaluation_ocr.py"
click node_ocrar "https://github.com/yongchoooon/stellar/blob/main/evaluation/evaluation_ocr_ar.py"
click node_diffpipeline "https://github.com/yongchoooon/stellar/blob/main/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint.py"
click node_pipelinebase "https://github.com/yongchoooon/stellar/blob/main/diffusers/pipeline_utils.py"
click node_flaxpipeline "https://github.com/yongchoooon/stellar/blob/main/diffusers/pipeline_flax_utils.py"
click node_models "https://github.com/yongchoooon/stellar/blob/main/diffusers/models/unet_2d_condition.py"
click node_flaxmodels "https://github.com/yongchoooon/stellar/blob/main/diffusers/models/unet_2d_condition_flax.py"
click node_schedulers "https://github.com/yongchoooon/stellar/blob/main/diffusers/schedulers/scheduling_pndm.py"
click node_flaxscheduler "https://github.com/yongchoooon/stellar/blob/main/diffusers/schedulers/scheduling_pndm_flax.py"
click node_config "https://github.com/yongchoooon/stellar/blob/main/diffusers/configuration_utils.py"
click node_hub "https://github.com/yongchoooon/stellar/blob/main/diffusers/hub_utils.py"
click node_safety "https://github.com/yongchoooon/stellar/blob/main/diffusers/pipelines/stable_diffusion/safety_checker.py"

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_synthetic,node_stage1data,node_stiplar toneBlue
class node_glyph,node_style toneAmber
class node_train,node_textdata,node_textencoder toneMint
class node_inferenceconfig,node_stellar,node_stellarapp,node_evaluation,node_ocr,node_ocrar toneRose
class node_diffpipeline,node_pipelinebase,node_flaxpipeline,node_models,node_flaxmodels,node_schedulers,node_flaxscheduler,node_config,node_hub,node_safety,node_researcher toneIndigo
```

## Components

### Data preparation

- [Synthetic text generator](https://github.com/yongchoooon/stellar/blob/main/datagen/Synthtext/gen.py): `datagen/Synthtext/gen.py`
- [Stage 1 data](https://github.com/yongchoooon/stellar/blob/main/datagen/datagen.py): `datagen/datagen.py`
- **STIPLAR data**

### Encoder pretraining

- [Glyph encoder](https://github.com/yongchoooon/stellar/blob/main/preglyph/modules.py): `preglyph/modules.py`
- [Style encoder](https://github.com/yongchoooon/stellar/blob/main/prestyle/model.py): `prestyle/model.py`

### Diffusion generation

- [Diffusion training](https://github.com/yongchoooon/stellar/blob/main/src/trainer/CtrlBase.py): `src/trainer/CtrlBase.py`
- [Text dataset](https://github.com/yongchoooon/stellar/blob/main/src/dataset/textdata.py): `src/dataset/textdata.py`
- [Text encoder](https://github.com/yongchoooon/stellar/blob/main/src/module/textencoder/modules.py): `src/module/textencoder/modules.py`

### Inference and evaluation

- [Inference config](https://github.com/yongchoooon/stellar/blob/main/inference_by_config.py): `inference_by_config.py`
- [Text editor](https://github.com/yongchoooon/stellar/blob/main/src/stellar/stellar.py): `src/stellar/stellar.py`
- [Editing application](https://github.com/yongchoooon/stellar/blob/main/src/stellar/stellar_app.py): `src/stellar/stellar_app.py`
- [Image/style evaluation](https://github.com/yongchoooon/stellar/blob/main/evaluation/evaluation.py): `evaluation/evaluation.py`
- [OCR evaluation](https://github.com/yongchoooon/stellar/blob/main/evaluation/evaluation_ocr.py): `evaluation/evaluation_ocr.py`
- [Arabic OCR evaluation](https://github.com/yongchoooon/stellar/blob/main/evaluation/evaluation_ocr_ar.py): `evaluation/evaluation_ocr_ar.py`

### Diffusion runtime

- [Diffusion pipelines](https://github.com/yongchoooon/stellar/blob/main/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint.py): `diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint.py`
- [Pipeline loading](https://github.com/yongchoooon/stellar/blob/main/diffusers/pipeline_utils.py): `diffusers/pipeline_utils.py`
- [Flax pipeline](https://github.com/yongchoooon/stellar/blob/main/diffusers/pipeline_flax_utils.py): `diffusers/pipeline_flax_utils.py`
- [Denoising models](https://github.com/yongchoooon/stellar/blob/main/diffusers/models/unet_2d_condition.py): `diffusers/models/unet_2d_condition.py`
- [Flax model](https://github.com/yongchoooon/stellar/blob/main/diffusers/models/unet_2d_condition_flax.py): `diffusers/models/unet_2d_condition_flax.py`
- [Schedulers](https://github.com/yongchoooon/stellar/blob/main/diffusers/schedulers/scheduling_pndm.py): `diffusers/schedulers/scheduling_pndm.py`
- [Flax schedulers](https://github.com/yongchoooon/stellar/blob/main/diffusers/schedulers/scheduling_pndm_flax.py): `diffusers/schedulers/scheduling_pndm_flax.py`
- [Model configuration](https://github.com/yongchoooon/stellar/blob/main/diffusers/configuration_utils.py): `diffusers/configuration_utils.py`
- [Hub utilities](https://github.com/yongchoooon/stellar/blob/main/diffusers/hub_utils.py): `diffusers/hub_utils.py`
- [Safety checker](https://github.com/yongchoooon/stellar/blob/main/diffusers/pipelines/stable_diffusion/safety_checker.py): `diffusers/pipelines/stable_diffusion/safety_checker.py`

### Other components

- **Researcher**

## Connections

- Researcher → Synthetic text generator: generates data (evidence: `README.md`)
- Synthetic text generator → Stage 1 data: produces (evidence: `README.md`)
- Researcher → STIPLAR data: obtains dataset (evidence: `README.md`)
- Researcher → Glyph encoder: pretrains (evidence: `README.md`)
- Researcher → Style encoder: pretrains (evidence: `README.md`)
- Researcher → Diffusion training: trains stages (evidence: `README.md`)
- Stage 1 data → Diffusion training: feeds stage one (evidence: `README.md`)
- STIPLAR data → Diffusion training: feeds stage two (evidence: `README.md`)
- Glyph encoder → Diffusion training: provides pretrained weights (evidence: `README.md`)
- Style encoder → Diffusion training: provides pretrained weights (evidence: `README.md`)
- Researcher → Inference config: runs configured (evidence: `README.md`)
- Inference config → Text editor: dispatches (evidence: `inference_by_config.py`)
- Inference config → Editing application: dispatches (evidence: `inference_by_config.py`)
- Researcher → Image/style evaluation: evaluates results (evidence: `README.md`)
- Researcher → OCR evaluation: measures recognition (evidence: `README.md`)
- Researcher → Arabic OCR evaluation: measures Arabic recognition (evidence: `README.md`)
- Synthetic text generator → Stage 1 data: renders masks and text (evidence: `datagen/Synthtext/gen.py`)
- Diffusion pipelines → Pipeline loading: inherits loading (evidence: `diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint.py`)
- Diffusion pipelines → Denoising models: uses denoiser (evidence: `diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint.py`)
- Diffusion pipelines → Schedulers: steps scheduler (evidence: `diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint.py`)
- Diffusion pipelines → Safety checker: checks output (evidence: `diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint.py`)
- Pipeline loading → Model configuration: loads configuration (evidence: `diffusers/pipeline_utils.py`)
- Pipeline loading → Hub utilities: downloads weights (evidence: `diffusers/pipeline_utils.py`)
- Flax pipeline → Model configuration: uses configuration (evidence: `diffusers/pipeline_flax_utils.py`)
- Flax pipeline → Flax schedulers: loads scheduler (evidence: `diffusers/pipeline_flax_utils.py`)
- Flax pipeline → Flax model: loads model
