Anima-Lab / MaskDiT

Code for Fast Training of Diffusion Models with Masked Transformers
MIT License
377 stars 14 forks source link

How to generate samples? #9

Open ALEX13679173326 opened 8 months ago

ALEX13679173326 commented 8 months ago

Nice work! I have trained a model on imagenet dataset and how to generate samples using pretrained models?

devzhk commented 8 months ago

Hi, thanks for your interest! As described in the README, you can use generate.py to generate samples with pretrained models.

python3 generate.py --config configs/test/maskdit-512.yaml --ckpt_path [path to checkpoints] --class_idx [class index from 0-999] --cfg_scale [guidance scale]
ALEX13679173326 commented 7 months ago

Thanks for answering! But the speed of generation is too slow, (2K samples for 46min, 5K samples for 1hour). Is there any faster method to generate samples for computing FID scores?

devzhk commented 7 months ago

Hi,

If you want the FID score, you may run the following script with multiple GPUs to speed up the evaluation process

accelerate launch --multi_gpu eval_latent.py --config configs/test/maskdit-512.yaml --ckpt [path to the pretrained model] --cfg_scale [guidance scale]

which takes 1 hour and 45 mins to generate 50k-FID on 8 A100 GPUs.