-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug_diffusers.py
More file actions
42 lines (36 loc) · 1.25 KB
/
debug_diffusers.py
File metadata and controls
42 lines (36 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
"""
Debug script to test diffusers loading on macOS
"""
import torch
print("torch version:", torch.__version__)
print("cuda available:", torch.cuda.is_available())
print("mps available:", hasattr(torch.backends, "mps") and torch.backends.mps.is_available())
try:
from diffusers import UNet2DConditionModel, AutoencoderKL, DDPMScheduler
print("✓ imported diffusers ok")
except Exception as e:
print("✗ failed to import diffusers:", e)
exit(1)
model_id = "CompVis/stable-diffusion-v1-4"
try:
print("loading VAE...")
vae = AutoencoderKL.from_pretrained(model_id, subfolder="vae", torch_dtype=torch.float32)
print("✓ VAE loaded")
except Exception as e:
print("✗ VAE loading failed:", e)
exit(1)
try:
print("loading UNet...")
unet = UNet2DConditionModel.from_pretrained(model_id, subfolder="unet", torch_dtype=torch.float32)
print("✓ UNet loaded")
except Exception as e:
print("✗ UNet loading failed:", e)
exit(1)
try:
print("loading scheduler...")
sched = DDPMScheduler.from_pretrained(model_id, subfolder="scheduler")
print("✓ Scheduler loaded")
except Exception as e:
print("✗ Scheduler loading failed:", e)
exit(1)
print("\n✓✓✓ ALL COMPONENTS LOADED SUCCESSFULLY ✓✓✓")