williamberman
commited on
Commit
·
e5080ee
1
Parent(s):
2ec69c0
fix
Browse files
app.py
CHANGED
@@ -51,15 +51,15 @@ def predict(dict, prompt="", negative_prompt="", guidance_scale=7.5, steps=20, s
|
|
51 |
|
52 |
pipe.vae.to('cuda')
|
53 |
pipe.unet.to('cuda')
|
|
|
54 |
output = pipe(prompt = prompt, negative_prompt=negative_prompt, image=init_image, mask_image=mask, guidance_scale=guidance_scale, num_inference_steps=int(steps), strength=strength)
|
|
|
55 |
pipe.vae.to('cpu')
|
56 |
pipe.unet.to('cpu')
|
57 |
-
|
58 |
gc.collect()
|
59 |
torch.cuda.empty_cache()
|
60 |
|
61 |
comparing_unet.to('cuda')
|
62 |
-
comparing_vae.to('cuda')
|
63 |
comparing_controlnet.to('cuda')
|
64 |
|
65 |
image = TF.to_tensor(dict["image"].convert("RGB").resize((1024, 1024)))
|
@@ -77,12 +77,19 @@ def predict(dict, prompt="", negative_prompt="", guidance_scale=7.5, steps=20, s
|
|
77 |
prompts=prompt, negative_prompts=negative_prompt, images=image, guidance_scale=guidance_scale, sigmas=sigmas, timesteps=timesteps,
|
78 |
text_encoder_one=pipe.text_encoder, text_encoder_two=pipe.text_encoder_2, unet=comparing_unet, controlnet=comparing_controlnet
|
79 |
)
|
80 |
-
out = comparing_vae.output_tensor_to_pil(comparing_vae.decode(out))
|
81 |
|
82 |
comparing_unet.to('cpu')
|
83 |
-
comparing_vae.to('cpu')
|
84 |
comparing_controlnet.to('cpu')
|
85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
gc.collect()
|
87 |
torch.cuda.empty_cache()
|
88 |
|
|
|
51 |
|
52 |
pipe.vae.to('cuda')
|
53 |
pipe.unet.to('cuda')
|
54 |
+
|
55 |
output = pipe(prompt = prompt, negative_prompt=negative_prompt, image=init_image, mask_image=mask, guidance_scale=guidance_scale, num_inference_steps=int(steps), strength=strength)
|
56 |
+
|
57 |
pipe.vae.to('cpu')
|
58 |
pipe.unet.to('cpu')
|
|
|
59 |
gc.collect()
|
60 |
torch.cuda.empty_cache()
|
61 |
|
62 |
comparing_unet.to('cuda')
|
|
|
63 |
comparing_controlnet.to('cuda')
|
64 |
|
65 |
image = TF.to_tensor(dict["image"].convert("RGB").resize((1024, 1024)))
|
|
|
77 |
prompts=prompt, negative_prompts=negative_prompt, images=image, guidance_scale=guidance_scale, sigmas=sigmas, timesteps=timesteps,
|
78 |
text_encoder_one=pipe.text_encoder, text_encoder_two=pipe.text_encoder_2, unet=comparing_unet, controlnet=comparing_controlnet
|
79 |
)
|
|
|
80 |
|
81 |
comparing_unet.to('cpu')
|
|
|
82 |
comparing_controlnet.to('cpu')
|
83 |
|
84 |
+
gc.collect()
|
85 |
+
torch.cuda.empty_cache()
|
86 |
+
|
87 |
+
comparing_vae.to('cuda')
|
88 |
+
|
89 |
+
out = comparing_vae.output_tensor_to_pil(comparing_vae.decode(out))
|
90 |
+
|
91 |
+
comparing_vae.to('cpu')
|
92 |
+
|
93 |
gc.collect()
|
94 |
torch.cuda.empty_cache()
|
95 |
|