Code for the paper "Do text-free diffusion models learn discriminative visual representations?".
(This work supersedes "Diffusion Models Beat GANs on Image Classification".)
Unconditional Diffusion Models as Self-Supervised Representation Learners.
- Clone this repository and navigate to it in your terminal.
- install python==3.9
pip install -e .
This should install theguided_diffusion
python package that the scripts depend on.pip install -r requirements.txt
-
Download this checkpoint from the original guided-diffusion repo and place it in
checkpoints/256x256_diffusion_uncond.pt
. -
The scripts for different modes are located in the
scripts
directory. The scripts can be run using the following commands. Make sure to specifyTRAIN_DATA
andVAL_DATA
in the scripts before running.- GD(L):
bash scripts/linear.sh
- Attention head:
bash scripts/attention.sh
- DifFormer:
bash scripts/fusion.sh
- DifFeed:
bash scripts/feedback.sh
- GD(L):
For more information on the arguments, refer to the finetune.py:create_argparser()
.