This code accompanies the paper "Object-centric Denoising Diffusion Models for Physical Reasoning".
The required conda environment can be installed by running
conda env create -f environment.yml
This repository then has to be installed as a package (called phyrediff) in your environment. You can do this by running the following command in the root folder of the repository
pip install -e .
Making this project a package was a design choice to avoid relative imports within scripts. Installing it in editable mode (the -e option) means changes in the code immediately take effect and you don't have to constantly reinstall it when changing code.
You can generate a training dataset from PHYRE with the script diffusion4phyre/data/scripts/generate_dataset_latents.py. Adapt the parameters in this file according to your requirements.
Running the generate_data_meta.py in the same folder is not necessary. It produces a metadata file for a given dataset which is required during training, but this metadata file will also be produced automatically when first training a model on a new dataset.
To train a model, run diffusion4phyre/train/train.py.
You can change the training parameters in diffusion4phyre/utils/config.py. These parameters mainly affect functions in the files
diffusion4phyre/utils/training.pydiffusion4phyre/utils/diffusion.pydiffusion4phyre/utils/models.py
The codes assumes that training is logged via neptune, but this can be turned off.
There are different evaluation notebooks in diffusion4phyre/eval/. These offer different ways of analyzing the behaviour of trained models.