From a5d5f30fbd9c6c7c78834072401932c84bddaf14 Mon Sep 17 00:00:00 2001 From: gdamms Date: Thu, 5 Feb 2026 15:33:20 +0100 Subject: trying to improve whole project --- src/config.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/config.py (limited to 'src/config.py') diff --git a/src/config.py b/src/config.py new file mode 100644 index 0000000..4ac56c4 --- /dev/null +++ b/src/config.py @@ -0,0 +1,34 @@ +""" +Configuration file for MNIST Diffusion model. +Contains all hyperparameters and constants. +""" + +import torch + +# Device configuration +DEVICE = torch.device("cuda" if torch.cuda.is_available() else "cpu") + +# Image parameters (MNIST) +IMG_SIZE = 28 +NB_CHANNEL = 1 +NB_LABEL = 10 + +# Diffusion parameters +DIFFU_STEPS = 1000 + +# Noise schedule (linear beta schedule) +BETA = torch.linspace(1e-4, 2e-2, DIFFU_STEPS, device=DEVICE) +BETA = torch.cat((torch.tensor([0.0], device=DEVICE), BETA)) +ALPHA = 1 - BETA +ALPHA_BAR = torch.cumprod(ALPHA, dim=0) + +# Training parameters +EPOCHS = 10 +BATCH_SIZE = 64 +LEARNING_RATE = 2e-4 +NUM_WORKERS = 4 + +# Paths +DATA_DIR = "data" +CHECKPOINT_DIR = "checkpoints" +PLOTS_DIR = "plots" -- cgit v1.3.1