Spaces:
Running
on
Zero
Running
on
Zero
wangshuai6
commited on
Commit
·
7979f94
1
Parent(s):
9772775
init
Browse files
app.py
CHANGED
@@ -82,7 +82,7 @@ class Pipeline:
|
|
82 |
@spaces.GPU
|
83 |
@torch.no_grad()
|
84 |
@torch.autocast(device_type="cuda", dtype=torch.bfloat16)
|
85 |
-
def __call__(self, y,
|
86 |
diffusion_sampler = AdamLMSampler(
|
87 |
order=order,
|
88 |
scheduler=LinearScheduler(),
|
@@ -96,10 +96,10 @@ class Pipeline:
|
|
96 |
image_width = image_width // 32 * 32
|
97 |
self.denoiser.decoder_patch_scaling_h = image_height / 512
|
98 |
self.denoiser.decoder_patch_scaling_w = image_width / 512
|
99 |
-
xT = torch.randn((
|
100 |
generator=generator).cuda()
|
101 |
with torch.no_grad():
|
102 |
-
condition, uncondition = conditioner([y,]*
|
103 |
|
104 |
|
105 |
# Sample images:
|
@@ -182,7 +182,6 @@ if __name__ == "__main__":
|
|
182 |
guidance = gr.Slider(minimum=0.1, maximum=10.0, step=0.1, label="CFG", value=4.0)
|
183 |
image_height = gr.Slider(minimum=128, maximum=1024, step=32, label="image height", value=512)
|
184 |
image_width = gr.Slider(minimum=128, maximum=1024, step=32, label="image width", value=512)
|
185 |
-
num_images = gr.Slider(minimum=1, maximum=4, step=1, label="num images", value=4)
|
186 |
label = gr.Textbox(label="positive prompt", value="a photo of a cat")
|
187 |
seed = gr.Slider(minimum=0, maximum=1000000, step=1, label="seed", value=0)
|
188 |
timeshift = gr.Slider(minimum=0.1, maximum=5.0, step=0.1, label="timeshift", value=3.0)
|
@@ -196,7 +195,6 @@ if __name__ == "__main__":
|
|
196 |
btn.click(fn=pipeline,
|
197 |
inputs=[
|
198 |
label,
|
199 |
-
num_images,
|
200 |
seed,
|
201 |
image_height,
|
202 |
image_width,
|
|
|
82 |
@spaces.GPU
|
83 |
@torch.no_grad()
|
84 |
@torch.autocast(device_type="cuda", dtype=torch.bfloat16)
|
85 |
+
def __call__(self, y, seed, image_height, image_width, num_steps, guidance, timeshift, order):
|
86 |
diffusion_sampler = AdamLMSampler(
|
87 |
order=order,
|
88 |
scheduler=LinearScheduler(),
|
|
|
96 |
image_width = image_width // 32 * 32
|
97 |
self.denoiser.decoder_patch_scaling_h = image_height / 512
|
98 |
self.denoiser.decoder_patch_scaling_w = image_width / 512
|
99 |
+
xT = torch.randn((1, 3, image_height, image_width), device="cpu", dtype=torch.float32,
|
100 |
generator=generator).cuda()
|
101 |
with torch.no_grad():
|
102 |
+
condition, uncondition = conditioner([y,]*1)
|
103 |
|
104 |
|
105 |
# Sample images:
|
|
|
182 |
guidance = gr.Slider(minimum=0.1, maximum=10.0, step=0.1, label="CFG", value=4.0)
|
183 |
image_height = gr.Slider(minimum=128, maximum=1024, step=32, label="image height", value=512)
|
184 |
image_width = gr.Slider(minimum=128, maximum=1024, step=32, label="image width", value=512)
|
|
|
185 |
label = gr.Textbox(label="positive prompt", value="a photo of a cat")
|
186 |
seed = gr.Slider(minimum=0, maximum=1000000, step=1, label="seed", value=0)
|
187 |
timeshift = gr.Slider(minimum=0.1, maximum=5.0, step=0.1, label="timeshift", value=3.0)
|
|
|
195 |
btn.click(fn=pipeline,
|
196 |
inputs=[
|
197 |
label,
|
|
|
198 |
seed,
|
199 |
image_height,
|
200 |
image_width,
|