The current code consists of two parts: modified DDSM and modified DDPM.
Use base_env_pytorch.def to set up the environment to get a .sif file with the same name.
-
Run
MA_2024_prepsamples.shto get a simulated diffusion path. In this.shfile, thepresample_noise.pywill be called. There are several parameters which can be set up:-n,--num_samples, type=int-c,--num_cat, type=int-t,--num_time_steps, type=int--speed_balance, type=bool, default=false--max_time, type=float--out_path, type=str--boundary_mode, choices=['clamp', 'reflect_boundaries', 'reflection'], default='clamp'
Example:
presample_noise.py -n 50000 -c 9 -t 400 --max_time 1 --out_path sudoku/ --boundary_mode 'reflect_boundaries' -
Run
MA_2024_results_ddsm_channel_std.shto check the quality of path simulation end distribution. -
Run
MA_2024_train.shto train the model. The.pthfiles are saved after each 50 epochs. There are several parameters which can be set up:-t,--num_time_steps, type=int, default=400-spd,--speed_balance, choices=['s1', 'sab'], default='s1'-bm,--boundary_mode, choices=['clamp', 'reflect_boundaries', 'reflection'], default='clamp'
Example:
train_sudoku_allinone.py -t 100 -spd 's1' -bm 'clamp'
-
Run
MA_2024_eval_Epoch.shto evaluate the trained model.
-
Run
SH_sudoku_csv_to_pickle.shto extract Sudoku data from a pre-randomly created Sudoku.csvfile, or create random Sudoku during the training phase. (Preferably, extract data from a.csvfile to save training time.) -
Run
SH_ddpm_train.shto train the model. You can change the UNet size in./ddpm/nets/unet.py. -
Run
SH_ddpm_predict.shto evaluate the trained model.
- Python 3.8+
- CUDA: 11.7.1-cudnn8-devel-ubuntu20.04