YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

GalaxyDiff Release

Self-contained Measurement Alignment (MA) inference package for conditional galaxy image generation.

Given 8 physical parameters, the package:

  1. Samples a 64Γ—64 image with a conditional diffusion model
  2. Upscales to 224Γ—224 with SwinIR
  3. Measures the image with a frozen regression proxy
  4. Reports consistency metrics (MAE / RMSE / MAE(_z))

All paths resolve under this folder (Paper_code/GalaxyDiff_release/). No external data download is required once weights/ is present (~2.5β€―GB).


Pipeline

8-D conditions c
      β”‚
      β–Ό
 CondNorm (z-score)
      β”‚
      β–Ό
 MA diffusion  ──►  x₆₄  ──►  SwinIR SR  ──►  xβ‚‚β‚‚β‚„
                                              β”‚
                                              β–Ό
                                    frozen Reg proxy R(Β·)
                                              β”‚
                                              β–Ό
                                         Δ‰  vs  c
                                   MAE / RMSE / MAE_z

Layout

GalaxyDiff_release/
β”œβ”€β”€ generate_and_eval.py      # CLI entry
β”œβ”€β”€ run.sh                    # one-command demo
β”œβ”€β”€ demo_generate_and_eval.ipynb
β”œβ”€β”€ README.md
β”œβ”€β”€ ma/                       # release helpers
β”‚   β”œβ”€β”€ pipeline.py           # end-to-end generate β†’ SR β†’ measure
β”‚   β”œβ”€β”€ cond.py               # 8-D parse / CondNorm
β”‚   β”œβ”€β”€ joint_ckpt.py         # load joint diffusion+SwinIR ckpt
β”‚   β”œβ”€β”€ ddim.py               # fast sampling
β”‚   β”œβ”€β”€ sr.py                 # SwinIR wrap
β”‚   └── metrics.py            # MAE / RMSE / MAE_z
β”œβ”€β”€ vendor/                   # model code only (no training)
β”‚   β”œβ”€β”€ Daldiff_cond_norm/
β”‚   β”œβ”€β”€ SwinIR-main/
β”‚   └── Regression/
β”œβ”€β”€ weights/                  # checkpoints (see MANIFEST.json)
β”‚   β”œβ”€β”€ 00003000-joint.pt
β”‚   β”œβ”€β”€ best_regression_head.pt
β”‚   β”œβ”€β”€ cond_norm_stats.json
β”‚   └── backbone/             # DINOv3 + LoRA / LN finetune
β”œβ”€β”€ scripts/
β”‚   └── assemble_bundle.sh    # pull weights/vendor from this repo (once)
└── runs/                     # example outputs

Quick start

cd /home/zhangbi/LJM/diffusion/Paper_code/GalaxyDiff_release

# If weights/ is empty, assemble once from the parent repo:
bash scripts/assemble_bundle.sh

# Demo (GPU 0)
bash run.sh

Or call the CLI directly:

CUDA_VISIBLE_DEVICES=0 python generate_and_eval.py \
  --cond-values "0.0784,144.40,310.56,551.57,-0.3088,0.2504,5.1633,2.2935" \
  --n-samples 4 \
  --outdir runs/demo \
  --sampling-timesteps 50

Interactive walkthrough: open demo_generate_and_eval.ipynb from this directory.


CLI options

Flag Default Meaning
--cond-values (required) 8 comma-separated floats (order below)
--n-samples 4 number of stochastic samples
--outdir runs/demo output directory
--device cuda cuda or cpu
--rank 0 GPU index for DataParallel
--base-seed 42 RNG seed for sampling
--batch-size 4 generation batch size
--sampling-timesteps 50 DDIM steps; 0 or 1000 β†’ full 1000-step DDPM
--mc-samples 10 MC Dropout passes in the proxy
--skip-generate off reuse existing LR images in outdir
--skip-sr off skip SwinIR (LR-only path)

run.sh env overrides: COND_VALUES, N_SAMPLES, OUTDIR, SAMPLING_TIMESTEPS, MC_SAMPLES, CUDA_VISIBLE_DEVICES.


Input conditions (fixed order)

# Name Meaning
1 redshift spectroscopic / photometric redshift
2 flux_g g-band flux
3 flux_r r-band flux
4 flux_z z-band flux
5 shape_e1 ellipticity (e_1)
6 shape_e2 ellipticity (e_2)
7 shape_r effective radius (r_e)
8 sersic SΓ©rsic index

Values are physical units (not z-scored). CondNorm stats live in weights/cond_norm_stats.json.


Outputs (--outdir)

Path Content
lr/output/*.png generated 64Γ—64 images
sr/sr/*.png 224Γ—224 super-resolved images
param_comparison.csv input (c) vs measured (\hat{c})
summary.json / metrics.json MAE, RMSE, MAE(_z) (when (N\ge 2))
input_cond.json echo of the requested conditions

Weights

See weights/MANIFEST.json:

File Role
00003000-joint.pt joint MA checkpoint (diffusion + SwinIR, step 3000)
best_regression_head.pt frozen measurement proxy
cond_norm_stats.json condition z-score mean / std
backbone/dinov3-vitl16-… DINOv3 ViT-L/16
backbone/finetune_2addLN/ LoRA + LN adapters for the proxy

Approximate disk: ~2.5β€―GB under weights/.


Assemble from this repository

Only needed if weights/ or vendor/ are missing (e.g. after a fresh clone without the bundle):

cd /home/zhangbi/LJM/diffusion/Paper_code/GalaxyDiff_release
bash scripts/assemble_bundle.sh

The script copies / hardlinks diffusion, SwinIR, and regression code from diffusion_model/, and checkpoints from related Paper_code/experiment* paths.


Dependencies

torch
torchvision
transformers
timm
Pillow
numpy
pandas
matplotlib
tqdm

CUDA GPU recommended. Full DDPM (--sampling-timesteps 0) is much slower than DDIM 50.


Notes

  • This package is inference-only; training lives in diffusin_model_fits/ and diffusion_model/.
  • Folder was formerly named model_release; paths in older docs may still say that β€” use GalaxyDiff_release instead.
  • Prefer --sampling-timesteps 50 for demos; use 1000 / 0 only when comparing to paper-quality DDPM sampling.
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support