Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -760,8 +760,8 @@ def generate_image(
|
|
760 |
if seed == 0:
|
761 |
seed = int(random.random() * 1000000)
|
762 |
|
763 |
-
|
764 |
-
torch_device = torch.device(
|
765 |
|
766 |
global model, model_zero_init
|
767 |
if not model_zero_init:
|
@@ -792,8 +792,9 @@ def generate_image(
|
|
792 |
timesteps = timesteps[t_idx:]
|
793 |
x = t * x + (1.0 - t) * init_image.to(x.dtype)
|
794 |
|
795 |
-
|
796 |
-
|
|
|
797 |
|
798 |
# with profile(activities=[ProfilerActivity.CPU],record_shapes=True,profile_memory=True) as prof:
|
799 |
# print(prof.key_averages().table(sort_by="cpu_time_total", row_limit=20))
|
|
|
760 |
if seed == 0:
|
761 |
seed = int(random.random() * 1000000)
|
762 |
|
763 |
+
assert torch.cuda.is_available()
|
764 |
+
torch_device = torch.device("cuda")
|
765 |
|
766 |
global model, model_zero_init
|
767 |
if not model_zero_init:
|
|
|
792 |
timesteps = timesteps[t_idx:]
|
793 |
x = t * x + (1.0 - t) * init_image.to(x.dtype)
|
794 |
|
795 |
+
with torch_device:
|
796 |
+
inp = prepare(t5=t5, clip=clip, img=x, prompt=prompt)
|
797 |
+
x = denoise(model, **inp, timesteps=timesteps, guidance=guidance)
|
798 |
|
799 |
# with profile(activities=[ProfilerActivity.CPU],record_shapes=True,profile_memory=True) as prof:
|
800 |
# print(prof.key_averages().table(sort_by="cpu_time_total", row_limit=20))
|