Spaces:
Running
on
Zero
Running
on
Zero
drscotthawley
commited on
Commit
•
5e340e8
1
Parent(s):
9411f2b
moving accelerator into process
Browse files
app.py
CHANGED
@@ -27,6 +27,7 @@ import k_diffusion as K
|
|
27 |
|
28 |
# test natten import:
|
29 |
import natten
|
|
|
30 |
|
31 |
zero = torch.Tensor([0]).cuda()
|
32 |
print("Zero Device = ",zero.device," <-- this probably says cpu") # <-- 'cpu' 🤔
|
@@ -98,7 +99,12 @@ def grab_dense_gen(init_img,
|
|
98 |
|
99 |
@spaces.GPU
|
100 |
def process_image(image, repaint, busyness):
|
|
|
101 |
print("Process Image: Zero Device = ",zero.device)
|
|
|
|
|
|
|
|
|
102 |
# get image ready and execute sampler
|
103 |
print("image = ",image)
|
104 |
image = image['composite']
|
@@ -112,7 +118,7 @@ def process_image(image, repaint, busyness):
|
|
112 |
print("Saving masked image file to ", masked_img_file)
|
113 |
image.save(masked_img_file)
|
114 |
num = 64 # number of images to generate; we'll take the one with the most notes in the masked region
|
115 |
-
bs =
|
116 |
repaint = repaint
|
117 |
seed_scale = 1.0
|
118 |
CT_HOME = '.'
|
|
|
27 |
|
28 |
# test natten import:
|
29 |
import natten
|
30 |
+
import accelerate
|
31 |
|
32 |
zero = torch.Tensor([0]).cuda()
|
33 |
print("Zero Device = ",zero.device," <-- this probably says cpu") # <-- 'cpu' 🤔
|
|
|
99 |
|
100 |
@spaces.GPU
|
101 |
def process_image(image, repaint, busyness):
|
102 |
+
|
103 |
print("Process Image: Zero Device = ",zero.device)
|
104 |
+
accelerator = accelerate.Accelerator()
|
105 |
+
device = accelerator.device
|
106 |
+
print('Accelerator device:', device, flush=True)
|
107 |
+
|
108 |
# get image ready and execute sampler
|
109 |
print("image = ",image)
|
110 |
image = image['composite']
|
|
|
118 |
print("Saving masked image file to ", masked_img_file)
|
119 |
image.save(masked_img_file)
|
120 |
num = 64 # number of images to generate; we'll take the one with the most notes in the masked region
|
121 |
+
bs = numx
|
122 |
repaint = repaint
|
123 |
seed_scale = 1.0
|
124 |
CT_HOME = '.'
|