This is the official repository for the paper "Diffusion Models for Graphs Benefit From Discrete State Spaces". Link to the paper: https://arxiv.org/abs/2210.01549
Use package manager Anaconda or Miniconda to generate a environment with the corresponding dependencies. You may use the following command to do so:
conda env create -f environment.yml
conda activate DISCDDPM
You should have activated your conda environment and are ready to run the project.
As evaluated in the paper, there are 3 different implementations of this project. For each implementation there exists a training file and a sampling file. Additionally to recreate the tests presented in the paper, we include the gridsearch files we used to run the different seeds and datasets as slurm jobs.
If you do not want to do any gridsearch but use the model to generate graphs, then you may use the commands generated by the gridsearch scripts directly instead of writing them to a Slurm .sh file. We have provided fully working config files in the /config directory.
All results of the training and the followed sampling (models, configs, output files etc. ) are stored in a newly generated directory "./exp/modelname_dataname_month_time_randomnumber/...".
If you wish to sample a already finished and trained model, you can do so manually with the jupyter notebook sample.ipynb. This also lets you print the sampled results over several noiselevels which helps with some insight into the effect of the amount of samplesteps reasonable.
For the Slurm service to work please configure the file scripts/gridsearch.sh to your slurm specifications.
Depending on which of the three implementations you wish to run, open the according gridsearch_... file and edit your hyperparameters within the first paragraph as described in the comments. Additionally you must change the line market with "ATTENTION" to match your Slurm serive command.
This python script generate needed config files in the directory "./config/gridsearch/consec_modelname_datetime/... ", based on the parameters in the template files (config/edp_final.yaml & config/ppgn_final.yaml) and the specified values in the gridsearch file.
Also, we used wandb for tracking our results. If you want to use this make sure you add your wandb key in the training files in the "train_main" function along with your username or if you do not wish to use wandb simply remove all the mentions of wandb.log() in the training files and comment out the respective lines.