| 22 | |
| 23 | |
| 24 | def prepare_image_encoder(): |
| 25 | print(f"Preparing image encoder weights...") |
| 26 | local_dir = "./pretrained_weights" |
| 27 | os.makedirs(local_dir, exist_ok=True) |
| 28 | for hub_file in ["image_encoder/config.json", "image_encoder/pytorch_model.bin"]: |
| 29 | path = Path(hub_file) |
| 30 | saved_path = local_dir / path |
| 31 | if os.path.exists(saved_path): |
| 32 | continue |
| 33 | hf_hub_download( |
| 34 | repo_id="lambdalabs/sd-image-variations-diffusers", |
| 35 | subfolder=PurePosixPath(path.parent), |
| 36 | filename=PurePosixPath(path.name), |
| 37 | local_dir=local_dir, |
| 38 | ) |
| 39 | |
| 40 | |
| 41 | def prepare_dwpose(): |