Spaces:
Running
on
Zero
Running
on
Zero
Anonymous
commited on
Commit
·
4d8af09
1
Parent(s):
cf7c21e
load in advance
Browse files
app.py
CHANGED
@@ -15,11 +15,12 @@ model_ckpt = "stabilityai/stable-diffusion-xl-base-1.0"
|
|
15 |
model_ckpt_turbo = "stabilityai/sdxl-turbo"
|
16 |
pipe = StableDiffusionXLPipeline.from_pretrained(model_ckpt, torch_dtype=dtype).to(device)
|
17 |
pipe_turbo = StableDiffusionXLPipeline_Turbo.from_pretrained(model_ckpt_turbo, torch_dtype=dtype).to(device)
|
18 |
-
generator = torch.Generator(device=
|
19 |
torch.cuda.empty_cache()
|
20 |
|
21 |
@spaces.GPU(duration=100)
|
22 |
def infer_gpu_part(pipe, seed, prompt, negative_prompt, ddim_steps, guidance_scale, resolutions_list, fast_mode, cosine_scale, disable_freeu, restart_steps):
|
|
|
23 |
generator = generator.manual_seed(seed)
|
24 |
if not disable_freeu:
|
25 |
register_free_upblock2d(pipe, b1=1.1, b2=1.2, s1=0.6, s2=0.4)
|
@@ -33,6 +34,7 @@ def infer_gpu_part(pipe, seed, prompt, negative_prompt, ddim_steps, guidance_sca
|
|
33 |
|
34 |
@spaces.GPU(duration=20)
|
35 |
def infer_gpu_part_turbo(pipe, seed, prompt, negative_prompt, ddim_steps, guidance_scale, resolutions_list, fast_mode, cosine_scale, disable_freeu, restart_steps):
|
|
|
36 |
generator = generator.manual_seed(seed)
|
37 |
if not disable_freeu:
|
38 |
register_free_upblock2d(pipe, b1=1.1, b2=1.2, s1=0.6, s2=0.4)
|
|
|
15 |
model_ckpt_turbo = "stabilityai/sdxl-turbo"
|
16 |
pipe = StableDiffusionXLPipeline.from_pretrained(model_ckpt, torch_dtype=dtype).to(device)
|
17 |
pipe_turbo = StableDiffusionXLPipeline_Turbo.from_pretrained(model_ckpt_turbo, torch_dtype=dtype).to(device)
|
18 |
+
generator = torch.Generator(device='cuda')
|
19 |
torch.cuda.empty_cache()
|
20 |
|
21 |
@spaces.GPU(duration=100)
|
22 |
def infer_gpu_part(pipe, seed, prompt, negative_prompt, ddim_steps, guidance_scale, resolutions_list, fast_mode, cosine_scale, disable_freeu, restart_steps):
|
23 |
+
generator = torch.Generator(device='cuda')
|
24 |
generator = generator.manual_seed(seed)
|
25 |
if not disable_freeu:
|
26 |
register_free_upblock2d(pipe, b1=1.1, b2=1.2, s1=0.6, s2=0.4)
|
|
|
34 |
|
35 |
@spaces.GPU(duration=20)
|
36 |
def infer_gpu_part_turbo(pipe, seed, prompt, negative_prompt, ddim_steps, guidance_scale, resolutions_list, fast_mode, cosine_scale, disable_freeu, restart_steps):
|
37 |
+
generator = torch.Generator(device='cuda')
|
38 |
generator = generator.manual_seed(seed)
|
39 |
if not disable_freeu:
|
40 |
register_free_upblock2d(pipe, b1=1.1, b2=1.2, s1=0.6, s2=0.4)
|