# abhinerd/project_phase_2 architecture

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

- Interactive diagram: https://gitdiagram.com/abhinerd/project_phase_2
- Repository: https://github.com/abhinerd/project_phase_2

## Overview

This repository implements a VizWiz-Hindi visual question-answering workflow: prepare split-aware records and images, fine-tune a vision-language model with LoRA/QLoRA, select checkpoints using validation, then generate predictions and report answer and answer-type metrics. It also has a fast smoke-training entry point and a Phase 1 English-to-Hindi question translation utility. The README is empty, so this map reflects the sampled source and file tree; relationships for unsampled notebook and data contents are omitted.

Main entry points: [`scripts/train_verbose.py`](https://github.com/abhinerd/project_phase_2/blob/main/scripts/train_verbose.py) (Validation training), [`scripts/train.py`](https://github.com/abhinerd/project_phase_2/blob/main/scripts/train.py) (Smoke training), [`scripts/evaluate.py`](https://github.com/abhinerd/project_phase_2/blob/main/scripts/evaluate.py) (Final evaluation), [`src/models/qlora_vlm.py`](https://github.com/abhinerd/project_phase_2/blob/main/src/models/qlora_vlm.py) (QLoRA model loader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_records["Prepare records<br/>[vizwiz.py]"]
  node_images["Image dataset<br/>[vizwiz.py]"]
  node_collator["Multimodal collator<br/>[vizwiz.py]"]
end

subgraph group_model["Model adaptation"]
  node_model_loader["QLoRA model loader<br/>[qlora_vlm.py]"]
end

subgraph group_workflow["Training and evaluation"]
  node_verbose_train["Validation training<br/>[train_verbose.py]"]
  node_fast_train["Smoke training<br/>[train.py]"]
  node_generation_eval["Final evaluation<br/>[evaluate.py]"]
  node_metrics["ANS and type metrics<br/>[evaluation.py]"]
end

subgraph group_legacy["Phase 1 translation"]
  node_translate["Hindi translation"]
end

node_researcher(("Researcher"))
node_argos["Argos Translate"]
node_model_hub["Model repository"]

node_researcher -->|"runs"| node_verbose_train
node_researcher -->|"runs"| node_fast_train
node_researcher -->|"runs"| node_generation_eval
node_verbose_train -->|"prepares records"| node_records
node_verbose_train -->|"loads model"| node_model_loader
node_verbose_train -->|"builds dataset"| node_images
node_verbose_train -->|"configures batches"| node_collator
node_verbose_train -.->|"runs validation logic"| node_generation_eval
node_verbose_train -.->|"saves best adapter"| node_model_loader
node_fast_train -->|"prepares records"| node_records
node_fast_train -->|"loads model"| node_model_loader
node_fast_train -->|"builds dataset"| node_images
node_fast_train -->|"configures batches"| node_collator
node_generation_eval -->|"loads split"| node_records
node_generation_eval -->|"loads adapter"| node_model_loader
node_generation_eval -->|"computes metrics"| node_metrics
node_translate -->|"translates questions"| node_argos
node_model_loader -->|"loads pretrained weights"| node_model_hub

click node_records "https://github.com/abhinerd/project_phase_2/blob/main/src/data/vizwiz.py"
click node_images "https://github.com/abhinerd/project_phase_2/blob/main/src/data/vizwiz.py"
click node_collator "https://github.com/abhinerd/project_phase_2/blob/main/src/data/vizwiz.py"
click node_model_loader "https://github.com/abhinerd/project_phase_2/blob/main/src/models/qlora_vlm.py"
click node_verbose_train "https://github.com/abhinerd/project_phase_2/blob/main/scripts/train_verbose.py"
click node_fast_train "https://github.com/abhinerd/project_phase_2/blob/main/scripts/train.py"
click node_generation_eval "https://github.com/abhinerd/project_phase_2/blob/main/scripts/evaluate.py"
click node_metrics "https://github.com/abhinerd/project_phase_2/blob/main/src/evaluation.py"
click node_translate "https://github.com/abhinerd/project_phase_2/blob/main/phase_1/translate_vizwiz.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_records,node_images,node_collator toneBlue
class node_model_loader toneAmber
class node_verbose_train,node_fast_train,node_generation_eval,node_metrics toneMint
class node_translate toneRose
class node_researcher,node_argos,node_model_hub toneIndigo
```

## Components

### Data preparation

- [Prepare records](https://github.com/abhinerd/project_phase_2/blob/main/src/data/vizwiz.py): `src/data/vizwiz.py`
- [Image dataset](https://github.com/abhinerd/project_phase_2/blob/main/src/data/vizwiz.py): `src/data/vizwiz.py`
- [Multimodal collator](https://github.com/abhinerd/project_phase_2/blob/main/src/data/vizwiz.py): `src/data/vizwiz.py`

### Model adaptation

- [QLoRA model loader](https://github.com/abhinerd/project_phase_2/blob/main/src/models/qlora_vlm.py): `src/models/qlora_vlm.py`

### Training and evaluation

- [Validation training](https://github.com/abhinerd/project_phase_2/blob/main/scripts/train_verbose.py): `scripts/train_verbose.py`
- [Smoke training](https://github.com/abhinerd/project_phase_2/blob/main/scripts/train.py): `scripts/train.py`
- [Final evaluation](https://github.com/abhinerd/project_phase_2/blob/main/scripts/evaluate.py): `scripts/evaluate.py`
- [ANS and type metrics](https://github.com/abhinerd/project_phase_2/blob/main/src/evaluation.py): `src/evaluation.py`

### Phase 1 translation

- [Hindi translation](https://github.com/abhinerd/project_phase_2/blob/main/phase_1/translate_vizwiz.py): `phase_1/translate_vizwiz.py`

### Other components

- **Researcher**
- **Argos Translate**
- **Model repository**

## Connections

- Researcher → Validation training: runs (evidence: `scripts/train_verbose.py`)
- Researcher → Smoke training: runs (evidence: `scripts/train.py`)
- Researcher → Final evaluation: runs (evidence: `scripts/evaluate.py`)
- Validation training → Prepare records: prepares records (evidence: `scripts/train_verbose.py`)
- Validation training → QLoRA model loader: loads model (evidence: `scripts/train_verbose.py`)
- Validation training → Image dataset: builds dataset (evidence: `scripts/train_verbose.py`)
- Validation training → Multimodal collator: configures batches (evidence: `scripts/train_verbose.py`)
- Validation training → Final evaluation: runs validation logic
- Validation training → QLoRA model loader: saves best adapter (evidence: `scripts/train_verbose.py`)
- Smoke training → Prepare records: prepares records (evidence: `scripts/train.py`)
- Smoke training → QLoRA model loader: loads model (evidence: `scripts/train.py`)
- Smoke training → Image dataset: builds dataset (evidence: `scripts/train.py`)
- Smoke training → Multimodal collator: configures batches (evidence: `scripts/train.py`)
- Final evaluation → Prepare records: loads split (evidence: `scripts/evaluate.py`)
- Final evaluation → QLoRA model loader: loads adapter (evidence: `scripts/evaluate.py`)
- Final evaluation → ANS and type metrics: computes metrics (evidence: `scripts/evaluate.py`)
- Hindi translation → Argos Translate: translates questions (evidence: `phase_1/translate_vizwiz.py`)
- QLoRA model loader → Model repository: loads pretrained weights (evidence: `src/models/qlora_vlm.py`)
