How jerryyann/dpi works
Project type and purpose
• This is a research‐style Python codebase implementing a face super‐resolution pipeline based on diffusion models (as presented in the “Diffusion Models Beat GANs on Image Synthesis” paper).
• It provides two main workflows:
a. Training a Conditional Residual Transformer (CRT) via “image_train.py.”
b. Generating (sampling) high‐resolution faces via “sr_sample.py.”
File structure
• Top‐level “scripts/” folder holds the two entry‐point scripts:
• image_train.py – launches distributed training
• sr_sample.py – launches distributed sampling
• The “guided_diffusion/” package contains core modules:
• datasets.py, image_datasets.py, test_datasets.py – data loading & preprocessing
• gaussian_diffusion.py, unet.py, losses.py, nn.py – model definitions and loss functions
• train_util.py, script_util.py – training/sampling orchestration
• resample.py, respace.py – timestep scheduling utilities
• dist_util.py, fp16_util.py – distributed & mixed‐precision support
• logger.py – centralized logging
• Top‐level helper scripts: evaluation.py, face_re.py, evaluation utilities in my_utils.py, face_re.py
• setup.py defines packaging/install; weights/ (external) holds pre‐trained checkpoints.
README for additional insights
• Confirms two main operations: downloading a pre‐trained diffusion model checkpoint and running sampling or training via Torch’s distributed launch.
Elements
• CLI Scripts, Orchestration, Data, Model, Utilities, Storage, External Services
• Blue for CLI/orchestration
• Green for Data/Model
• Orange for Utilities
• Gray for Storage/External
High‐detail capture
• Within Data, subdivide into “Image Datasets” vs. “Test Datasets.”
• Within Utilities, show “DistributedUtil,” “FP16Util,” “Resample/Respace,” and “Logger.”
• Dual workflows:
• Training: CLI → Orchestration → Data → Model → Loss → Optimizer → Checkpoint
• Sampling: CLI → Orchestration → Model (reverse diffusion) → Output Images