Code for the paper Bi-level Score Matching for Learning Energy-based Latent Variable Models.
See environment.yml. You can create the environment by running
conda env create -f environment.yml
To compare BiSM with baselines (including CD, PCD, DSM, SSM, NCE, VNCE) on the toy (checkerboard) dataset, run
python checkerboard_exps.py
To see how N and K influence the results, run
python freyface_exps.py
To train an EBLVM on the mnist dataset (1 * 28 * 28) with BiSM, run
python tune_latent_ebm_resnet_mnist_bimdsm.py
To train an EBLVM on the cifar10 dataset (3 * 32 * 32) with BiSM, run
python tune_latent_ebm_resnet_cifar10_bimdsm.py
To train an EBLVM on the celeba dataset (3 * 32 * 32) with BiSM, run
python tune_latent_ebm_resnet_celeba_bimdsm.py
To compare BiSM with baselines (including CD, PCD, DSM, SSM, NCE, VNCE) on the toy (checkerboard) dataset, run
python checkerboard_exps.py
To train an EBM on the mnist dataset (1 * 28 * 28) with MDSM, run
python tune_ebm_resnet_mnist_mdsm.py
To train an EBM on the cifar10 dataset (3 * 32 * 32) with MDSM, run
python tune_ebm_resnet_cifar10_mdsm.py
-
The code will detect free GPUs by command gpustat and run on these GPUs. You can manually assign GPUs by modify the devices argument of function task_assign in the above .py files.
-
The downloaded dataset and running result will be saved to workspace directory by default.