GGPENG commited on
Commit
7c1adba
·
verified ·
1 Parent(s): e4c36ac

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -1
app.py CHANGED
@@ -12,14 +12,26 @@ dtype = torch.float16 if device == "cuda" else torch.float32
12
  pipe = DiffusionPipeline.from_pretrained(
13
  "stable-diffusion-v1-5/stable-diffusion-v1-5",
14
  torch_dtype=torch.bfloat16,
 
15
  )
16
 
17
  # device = "cuda" if torch.cuda.is_available() else "cpu"
18
 
19
  pipe.to(device)
20
 
 
 
 
 
 
 
 
 
 
 
21
  pipe.unet.load_attn_procs(
22
- "./pytorch_custom_diffusion_weights.bin"
 
23
  )
24
 
25
  def generate(prompt, steps, guidance):
 
12
  pipe = DiffusionPipeline.from_pretrained(
13
  "stable-diffusion-v1-5/stable-diffusion-v1-5",
14
  torch_dtype=torch.bfloat16,
15
+ cache_dir="/tmp/huggingface"
16
  )
17
 
18
  # device = "cuda" if torch.cuda.is_available() else "cpu"
19
 
20
  pipe.to(device)
21
 
22
+ # pipe.unet.load_attn_procs(
23
+ # "./pytorch_custom_diffusion_weights.bin"
24
+ # )
25
+
26
+ # attn_path = "./pytorch_custom_diffusion_weights.bin"
27
+ # state_dict = torch.load(attn_path, map_location="cpu")
28
+ # pipe.unet.load_attn_procs(
29
+ # state_dict
30
+ # )
31
+
32
  pipe.unet.load_attn_procs(
33
+ ".",
34
+ weight_name="pytorch_custom_diffusion_weights.bin"
35
  )
36
 
37
  def generate(prompt, steps, guidance):