# cvlab-columbia/zero123 architecture

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

- Interactive diagram: https://gitdiagram.com/cvlab-columbia/zero123
- Repository: https://github.com/cvlab-columbia/zero123

## Overview

Zero-1-to-3 provides image-conditioned novel-view synthesis, with a separate SJC workflow for optimizing a voxel NeRF from an input image and diffusion guidance. The README also documents diffusion-model training and Objaverse renderings. The graph combines those documented capabilities with relationships visible in sampled source and the SOURCE INDEX; unsampled implementation details are represented only at supported directory level.

Main entry points: [`3drec/run_zero123.py`](https://github.com/cvlab-columbia/zero123/blob/main/3drec/run_zero123.py) (SJC workflow), [`zero123/ldm/models/diffusion/ddpm.py`](https://github.com/cvlab-columbia/zero123/blob/main/zero123/ldm/models/diffusion/ddpm.py) (Latent diffusion), [`zero123/gradio_new.py`](https://github.com/cvlab-columbia/zero123/blob/main/zero123/gradio_new.py) (Gradio demo), [`3drec/voxnerf/pipelines.py`](https://github.com/cvlab-columbia/zero123/blob/main/3drec/voxnerf/pipelines.py) (NeRF optimization)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_synthesis["Novel View Synthesis"]
  node_demo["Gradio demo<br/>[gradio_new.py]"]
  node_image_prep["Image preparation<br/>[util.py]"]
end

subgraph group_diffusion["Diffusion Model"]
  node_sampler["DDIM sampler<br/>[ddim.py]"]
  node_diffusion_model["Latent diffusion<br/>[ddpm.py]"]
  node_autoencoder["Autoencoder<br/>[autoencoder.py]"]
  node_unet["UNet and attention<br/>[openaimodel.py]"]
  node_attention["Attention layers<br/>[attention.py]"]
end

subgraph group_reconstruction["3D Reconstruction"]
  node_recon_entry["SJC workflow<br/>[run_zero123.py]"]
  node_score_adapter["Score adapters<br/>[adapt.py]"]
  node_pose["Camera poses<br/>[pose.py]"]
  node_voxel["Voxel NeRF<br/>[vox.py]"]
  node_ray_render["Ray rendering<br/>[render.py]"]
  node_scene_data["Scene data<br/>[data.py]"]
  node_train_loop["NeRF optimization<br/>[pipelines.py]"]
  node_camera_math["Camera geometry<br/>[my3d.py]"]
end

subgraph group_training["Training Data"]
  node_train_entry["Training entry<br/>[main.py]"]
  node_dataset["Training datasets"]
  node_render_data["Objaverse renderings"]
end

node_user(("Image user"))
node_recon_user(("Reconstruction user"))

node_user -->|"submits image"| node_demo
node_demo -->|"prepares image"| node_image_prep
node_demo -->|"samples views"| node_sampler
node_sampler -->|"uses model"| node_diffusion_model
node_diffusion_model -->|"instantiates stage"| node_autoencoder
node_diffusion_model -->|"dispatches denoising"| node_unet
node_unet -->|"uses layers"| node_attention
node_train_entry -->|"loads data"| node_dataset
node_train_entry -.->|"trains model"| node_diffusion_model
node_render_data -.->|"supplies renderings"| node_dataset
node_recon_user -->|"starts reconstruction"| node_recon_entry
node_recon_entry -->|"configures guidance"| node_score_adapter
node_recon_entry -->|"builds poser"| node_pose
node_recon_entry -->|"creates voxel model"| node_voxel
node_recon_entry -.->|"runs optimization"| node_train_loop
node_recon_entry -->|"loads scene data"| node_scene_data
node_train_loop -->|"renders rays"| node_ray_render
node_train_loop -->|"loads test views"| node_scene_data
node_ray_render -->|"unprojects pixels"| node_camera_math

click node_demo "https://github.com/cvlab-columbia/zero123/blob/main/zero123/gradio_new.py"
click node_image_prep "https://github.com/cvlab-columbia/zero123/blob/main/zero123/ldm/util.py"
click node_sampler "https://github.com/cvlab-columbia/zero123/blob/main/zero123/ldm/models/diffusion/ddim.py"
click node_diffusion_model "https://github.com/cvlab-columbia/zero123/blob/main/zero123/ldm/models/diffusion/ddpm.py"
click node_autoencoder "https://github.com/cvlab-columbia/zero123/blob/main/zero123/ldm/models/autoencoder.py"
click node_unet "https://github.com/cvlab-columbia/zero123/blob/main/zero123/ldm/modules/diffusionmodules/openaimodel.py"
click node_attention "https://github.com/cvlab-columbia/zero123/blob/main/zero123/ldm/modules/attention.py"
click node_train_entry "https://github.com/cvlab-columbia/zero123/blob/main/zero123/main.py"
click node_dataset "https://github.com/cvlab-columbia/zero123/tree/main/zero123/ldm/data"
click node_render_data "https://github.com/cvlab-columbia/zero123/tree/main/objaverse-rendering/scripts"
click node_recon_entry "https://github.com/cvlab-columbia/zero123/blob/main/3drec/run_zero123.py"
click node_score_adapter "https://github.com/cvlab-columbia/zero123/blob/main/3drec/adapt.py"
click node_pose "https://github.com/cvlab-columbia/zero123/blob/main/3drec/pose.py"
click node_voxel "https://github.com/cvlab-columbia/zero123/blob/main/3drec/voxnerf/vox.py"
click node_ray_render "https://github.com/cvlab-columbia/zero123/blob/main/3drec/voxnerf/render.py"
click node_scene_data "https://github.com/cvlab-columbia/zero123/blob/main/3drec/voxnerf/data.py"
click node_train_loop "https://github.com/cvlab-columbia/zero123/blob/main/3drec/voxnerf/pipelines.py"
click node_camera_math "https://github.com/cvlab-columbia/zero123/blob/main/3drec/my3d.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_demo,node_image_prep,node_user,node_recon_user toneBlue
class node_sampler,node_diffusion_model,node_autoencoder,node_unet,node_attention toneAmber
class node_recon_entry,node_score_adapter,node_pose,node_voxel,node_ray_render,node_scene_data,node_train_loop,node_camera_math toneMint
class node_train_entry,node_dataset,node_render_data toneRose
```

## Components

### Novel View Synthesis

- [Gradio demo](https://github.com/cvlab-columbia/zero123/blob/main/zero123/gradio_new.py): `zero123/gradio_new.py`
- [Image preparation](https://github.com/cvlab-columbia/zero123/blob/main/zero123/ldm/util.py): `zero123/ldm/util.py`

### Diffusion Model

- [DDIM sampler](https://github.com/cvlab-columbia/zero123/blob/main/zero123/ldm/models/diffusion/ddim.py): `zero123/ldm/models/diffusion/ddim.py`
- [Latent diffusion](https://github.com/cvlab-columbia/zero123/blob/main/zero123/ldm/models/diffusion/ddpm.py): `zero123/ldm/models/diffusion/ddpm.py`
- [Autoencoder](https://github.com/cvlab-columbia/zero123/blob/main/zero123/ldm/models/autoencoder.py): `zero123/ldm/models/autoencoder.py`
- [UNet and attention](https://github.com/cvlab-columbia/zero123/blob/main/zero123/ldm/modules/diffusionmodules/openaimodel.py): `zero123/ldm/modules/diffusionmodules/openaimodel.py`
- [Attention layers](https://github.com/cvlab-columbia/zero123/blob/main/zero123/ldm/modules/attention.py): `zero123/ldm/modules/attention.py`

### 3D Reconstruction

- [SJC workflow](https://github.com/cvlab-columbia/zero123/blob/main/3drec/run_zero123.py): `3drec/run_zero123.py`
- [Score adapters](https://github.com/cvlab-columbia/zero123/blob/main/3drec/adapt.py): `3drec/adapt.py`
- [Camera poses](https://github.com/cvlab-columbia/zero123/blob/main/3drec/pose.py): `3drec/pose.py`
- [Voxel NeRF](https://github.com/cvlab-columbia/zero123/blob/main/3drec/voxnerf/vox.py): `3drec/voxnerf/vox.py`
- [Ray rendering](https://github.com/cvlab-columbia/zero123/blob/main/3drec/voxnerf/render.py): `3drec/voxnerf/render.py`
- [Scene data](https://github.com/cvlab-columbia/zero123/blob/main/3drec/voxnerf/data.py): `3drec/voxnerf/data.py`
- [NeRF optimization](https://github.com/cvlab-columbia/zero123/blob/main/3drec/voxnerf/pipelines.py): `3drec/voxnerf/pipelines.py`
- [Camera geometry](https://github.com/cvlab-columbia/zero123/blob/main/3drec/my3d.py): `3drec/my3d.py`

### Training Data

- [Training entry](https://github.com/cvlab-columbia/zero123/blob/main/zero123/main.py): `zero123/main.py`
- [Training datasets](https://github.com/cvlab-columbia/zero123/tree/main/zero123/ldm/data): `zero123/ldm/data`
- [Objaverse renderings](https://github.com/cvlab-columbia/zero123/tree/main/objaverse-rendering/scripts): `objaverse-rendering/scripts`

### Other components

- **Image user**
- **Reconstruction user**

## Connections

- Image user → Gradio demo: submits image (evidence: `README.md`)
- Gradio demo → Image preparation: prepares image (evidence: `zero123/gradio_new.py`)
- Gradio demo → DDIM sampler: samples views (evidence: `zero123/gradio_new.py`)
- DDIM sampler → Latent diffusion: uses model (evidence: `zero123/ldm/models/diffusion/ddim.py`)
- Latent diffusion → Autoencoder: instantiates stage (evidence: `zero123/ldm/models/diffusion/ddpm.py`)
- Latent diffusion → UNet and attention: dispatches denoising (evidence: `zero123/ldm/models/diffusion/ddpm.py`)
- UNet and attention → Attention layers: uses layers (evidence: `zero123/ldm/modules/diffusionmodules/openaimodel.py`)
- Training entry → Training datasets: loads data (evidence: `zero123/main.py`)
- Training entry → Latent diffusion: trains model (evidence: `README.md`)
- Objaverse renderings → Training datasets: supplies renderings (evidence: `README.md`)
- Reconstruction user → SJC workflow: starts reconstruction (evidence: `README.md`)
- SJC workflow → Score adapters: configures guidance (evidence: `3drec/run_zero123.py`)
- SJC workflow → Camera poses: builds poser (evidence: `3drec/run_zero123.py`)
- SJC workflow → Voxel NeRF: creates voxel model (evidence: `3drec/run_zero123.py`)
- SJC workflow → NeRF optimization: runs optimization
- SJC workflow → Scene data: loads scene data (evidence: `3drec/run_zero123.py`)
- NeRF optimization → Ray rendering: renders rays (evidence: `3drec/voxnerf/pipelines.py`)
- NeRF optimization → Scene data: loads test views (evidence: `3drec/voxnerf/pipelines.py`)
- Ray rendering → Camera geometry: unprojects pixels (evidence: `3drec/voxnerf/render.py`)
