habulaj commited on
Commit
a74433e
·
verified ·
1 Parent(s): a6d3b68

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -0
app.py CHANGED
@@ -72,6 +72,14 @@ def generate(
72
  pipe.load_lora_weights(lora, adapter_name="1")
73
  pipe.load_lora_weights(lora2, adapter_name="2")
74
  pipe.set_adapters(["1", "2"], adapter_weights=[lora_scale, lora_scale2])
 
 
 
 
 
 
 
 
75
 
76
  generator = torch.Generator().manual_seed(seed)
77
 
 
72
  pipe.load_lora_weights(lora, adapter_name="1")
73
  pipe.load_lora_weights(lora2, adapter_name="2")
74
  pipe.set_adapters(["1", "2"], adapter_weights=[lora_scale, lora_scale2])
75
+
76
+ if ENABLE_CPU_OFFLOAD:
77
+ pipe.enable_model_cpu_offload()
78
+ else:
79
+ pipe.to(device)
80
+
81
+ if USE_TORCH_COMPILE:
82
+ pipe.unet = torch.compile(pipe.unet, mode="reduce-overhead", fullgraph=True)
83
 
84
  generator = torch.Generator().manual_seed(seed)
85