Spaces:
Runtime error
Runtime error
Iwaku-Real
commited on
Commit
•
f881e40
1
Parent(s):
d46664c
Update app.py
Browse files
app.py
CHANGED
@@ -36,7 +36,7 @@ if not path.exists(cache_path):
|
|
36 |
|
37 |
pipe = StableDiffusionXLPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.bfloat16)
|
38 |
pipe.to(device="cpu", dtype=torch.bfloat16)
|
39 |
-
unet_state = load_file(hf_hub_download("ByteDance/Hyper-SD", "Hyper-SDXL-1step-Unet.safetensors"), device="
|
40 |
pipe.unet.load_state_dict(unet_state)
|
41 |
pipe.scheduler = LCMScheduler.from_config(pipe.scheduler.config, timestep_spacing ="trailing")
|
42 |
|
@@ -59,7 +59,7 @@ with gr.Blocks() as demo:
|
|
59 |
@spaces.GPU
|
60 |
def process_image(num_images, height, width, steps, guidance, prompt, seed):
|
61 |
global pipe
|
62 |
-
with torch.inference_mode(), torch.autocast("
|
63 |
return pipe(
|
64 |
prompt=[prompt]*num_images,
|
65 |
generator=torch.Generator().manual_seed(int(seed)),
|
|
|
36 |
|
37 |
pipe = StableDiffusionXLPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.bfloat16)
|
38 |
pipe.to(device="cpu", dtype=torch.bfloat16)
|
39 |
+
unet_state = load_file(hf_hub_download("ByteDance/Hyper-SD", "Hyper-SDXL-1step-Unet.safetensors"), device="cpu")
|
40 |
pipe.unet.load_state_dict(unet_state)
|
41 |
pipe.scheduler = LCMScheduler.from_config(pipe.scheduler.config, timestep_spacing ="trailing")
|
42 |
|
|
|
59 |
@spaces.GPU
|
60 |
def process_image(num_images, height, width, steps, guidance, prompt, seed):
|
61 |
global pipe
|
62 |
+
with torch.inference_mode(), torch.autocast("cpu", dtype=torch.bfloat16), timer("inference"):
|
63 |
return pipe(
|
64 |
prompt=[prompt]*num_images,
|
65 |
generator=torch.Generator().manual_seed(int(seed)),
|