Views
No views yet
[!WARNING] we do not have a full checkpoint conversion validation, if you encounter pipeline loading failure and unsidered output, please contact me via bili_sakura@zju.edu.cn
unet/config.jsonunet/diffusion_pytorch_model.safetensorsscheduler/scheduler_config.jsoninput_blocks.*, middle_block.*, output_blocks.*).
Use the community BBDM loader from pytorch-image-translation-models.| Model variant | Domain |
|---|---|
edges2handbags-f4 | Edges -> Handbags |
edges2shoes-f4 | Edges -> Shoes |
faces2comics-f4 | Faces -> Comics |
CelebAMaskHQ-f4 | CelebAMaskHQ |
CelebAMaskHQ-f8 | CelebAMaskHQ |
CelebAMaskHQ-f16 | CelebAMaskHQ |
1BBDM-ckpt/
2 edges2shoes-f4/
3 unet/
4 config.json
5 diffusion_pytorch_model.safetensors
6 scheduler/
7 scheduler_config.json
8 conversion_status.json
9 ...1import torch
2from diffusers import VQModel
3from examples.community.bbdm import load_bbdm_community_pipeline
4
5device = "cuda"
6ckpt_root = "/root/worksapce/models/BiliSakura/BBDM-ckpt"
7
8# Example: edges2shoes-f4 <-> vqgan_f4 pairing
9pipe = load_bbdm_community_pipeline(f"{ckpt_root}/edges2shoes-f4", device=device)
10vqvae = VQModel.from_pretrained(f"{ckpt_root}/vqgan_f4/vqvae").to(device).eval()
11
12# Input image should be normalized to [-1, 1], shape [B, 3, 256, 256].
13x = torch.rand(1, 3, 256, 256, device=device) * 2 - 1
14with torch.no_grad():
15 x_latent = vqvae.encode(x).latents # [B, 3, 64, 64]
16 y_latent = pipe(source_image=x_latent, num_inference_steps=200, output_type="pt").images
17 y = vqvae.decode(y_latent).sample # [B, 3, 256, 256]
18
19print(x_latent.shape, y_latent.shape, y.shape)num_inference_steps should be >= 3 for linear skip sampling.in_channels, image_size):| BBDM checkpoint | UNet latent shape | Recommended VQGAN |
|---|---|---|
edges2handbags-f4 | [B, 3, 64, 64] | vqgan_f4/vqvae |
edges2shoes-f4 | [B, 3, 64, 64] | vqgan_f4/vqvae |
faces2comics-f4 | [B, 3, 64, 64] | vqgan_f4/vqvae |
CelebAMaskHQ-f4 | [B, 3, 64, 64] | vqgan_f4/vqvae |
CelebAMaskHQ-f8 | [B, 4, 32, 32] | vqgan_f8/vqvae |
CelebAMaskHQ-f16 | [B, 8, 16, 16] | vqgan_f16/vqvae |
src.BBDMPipeline.from_pretrained(...)
because the native src BBDM wrapper expects diffusers UNet2DModel weight keys.examples.community.bbdm.load_bbdm_community_pipeline(...)1python -m examples.community.bbdm.convert_ckpt_to_unet \
2 --raw-root "/root/worksapce/models/raw/BBDM Checkpoints" \
3 --output-root "/root/worksapce/models/BiliSakura/BBDM-ckpt"1@inproceedings{li2023bbdm,
2 title={BBDM: Image-to-Image Translation with Brownian Bridge Diffusion Models},
3 author={Li, Bo and Xue, Kang and Liu, Bin and Lai, Yu-Kun},
4 booktitle={CVPR},
5 year={2023}
6}