Spaces:
Sleeping
Sleeping
Download diffusion_core/diffusion_models.py from hugging-apps/inverse-and-edit: direct link, hf CLI and curl.
- Browser
- Download file 1.19 kB
-
https://huggingface.co/spaces/hugging-apps/inverse-and-edit/resolve/main/diffusion_core/diffusion_models.py
- Command line
-
hf download hf://spaces/hugging-apps/inverse-and-edit/diffusion_core/diffusion_models.py
-
curl -L -o diffusion_models.py https://huggingface.co/spaces/hugging-apps/inverse-and-edit/resolve/main/diffusion_core/diffusion_models.py
1.19 kB
| import torch | |
| from diffusers.pipelines import StableDiffusionPipeline | |
| from .utils import ClassRegistry | |
| from .load_consistency import load_consistency | |
| diffusion_models_registry = ClassRegistry() | |
| def read_v14(scheduler): | |
| model_id = "CompVis/stable-diffusion-v1-4" | |
| model = StableDiffusionPipeline.from_pretrained( | |
| model_id, torch_dtype=torch.float32, scheduler=scheduler | |
| ) | |
| return model | |
| def read_v15(scheduler): | |
| model_id = "runwayml/stable-diffusion-v1-5" | |
| model = StableDiffusionPipeline.from_pretrained( | |
| model_id, torch_dtype=torch.float32, scheduler=scheduler | |
| ) | |
| return model | |
| def read_v15(device): | |
| solver = load_consistency(device) | |
| return solver | |
| def read_v21(scheduler): | |
| model_id = "stabilityai/stable-diffusion-2-1" | |
| model = StableDiffusionPipeline.from_pretrained( | |
| model_id, torch_dtype=torch.float32, scheduler=scheduler | |
| ) | |
| return model | |