Views
No views yet
No perceptual backbone, no discriminator, no auxiliary networks, and no additional ground-truth images.
1conda create -n dpdmd python=3.10.16
2conda activate dpdmd
3
4pip install -e .dpdmd environment above.[new env name: test_div]: DINOv3 requires transformers >= 4.57.0, which is incompatible with the ImageReward metric. Therefore, it is recommended to use DINOv2 during training. If you need to evaluate with DINOv3 after training, please create a separate conda environment and upgrade the transformers version accordingly.[new env name: vq]: For visual quality evaluation, please follow VisualQuality-R1. After setup, install timm via pip install timm to enable the MANIQA metric. Creating a new environment for this step is very simple and recommended.1import torch
2from diffusers import StableDiffusion3Pipeline
3
4base_sd35_weight_path = "stable-diffusion-3.5-medium" # SD3.5-Medium weight path
5transformer_weight_path = "DPDMD-SD35M-4NFE-natural.pt" # SD3.5-Medium Transformer weight path
6
7pipe = StableDiffusion3Pipeline.from_pretrained(base_sd35_weight_path, torch_dtype=torch.bfloat16)
8state_dict = torch.load(f"{transformer_weight_path}", map_location="cpu")
9missing, unexpected = pipe.transformer.load_state_dict(state_dict, strict=True)
10pipe = pipe.to("cuda:0")
11
12g_init = torch.Generator(device="cuda:0").manual_seed(5)
13image = pipe(
14 "a dog",
15 num_inference_steps=4,
16 guidance_scale=1.0,
17 height=1024,
18 width=1024,
19 generator=g_init
20).images[0]
21
22save_path = "./demo.png"
23image.save(save_path)
24data/ folder (one text prompt per line). All prompts are stored in .txt format.scripts/run_train_sd35.sh.1--teacher_id weights/stabilityai/stable-diffusion-3.5-medium \
2--student_id weights/stabilityai/stable-diffusion-3.5-medium \
3--fake_id weights/stabilityai/stable-diffusion-3.5-medium \
4--pick_processor_path weights/CLIP-ViT-H-14-laion2B-s32B-b79K \
5--pick_model_path weights/PickScore_v1 \
6--ir_model_path weights/ImageReward/ImageReward.pt \
7--ir_med_config weights/ImageReward/med_config.json \
8--dino_path weights/dinov2-base \
9--clip_path weights/clip-vit-large-patch14 \sd35_dpdmd/sd35m_t30_1024_lr1e5_4nfe_anchor5 (example) consistent across the following arguments to ensure that all generated files are stored under the same root folder.1--log_path outputs/sd35_dpdmd/sd35m_t30_1024_lr1e5_4nfe_anchor5/log \
2--ckpt_dir outputs/sd35_dpdmd/sd35m_t30_1024_lr1e5_4nfe_anchor5/ckpts \
3--eval_dir outputs/sd35_dpdmd/sd35m_t30_1024_lr1e5_4nfe_anchor5/eval_images \
4--process_folder_name outputs/sd35_dpdmd/sd35m_t30_1024_lr1e5_4nfe_anchor5/process_vis \
5--diversity_folder_name outputs/sd35_dpdmd/sd35m_t30_1024_lr1e5_4nfe_anchor5/div_vis \log_path: stores training log information.ckpt_dir: stores checkpoint weights.eval_dir: stores generated images used for human preference evaluation during training (overwritten at each evaluation step).process_folder_name: stores student model output images during training (overwritten at each iteration).diversity_folder_name: stores images used for diversity evaluation during training (overwritten at each evaluation step).bash scripts/run_train_sd35.shtest_diversity.py), human preference evaluation (test_preference.py), and visual quality evaluation (test_quality.py). Please ensure that the required environments for each evaluation are installed beforehand.accelerate launch --main_process_port 29512 test_preference.pypython test_quality.py
CUDA_VISIBLE_DEVICES=0 accelerate launch --main_process_port 29519 --num_processes 1 test_diversity.pytianhewu-c@my.cityu.edu.hk.@article{wu2026diversity,
title={Diversity-Preserved Distribution Matching Distillation for Fast Visual Synthesis},
author={Wu, Tianhe and Li, Ruibin and Zhang, Lei and Ma, Kede},
journal={arXiv preprint arXiv:2602.03139},
year={2026}
}