Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -14,7 +14,7 @@ ckpt = "sdxl_lightning_4step_unet.safetensors" # Use the correct ckpt for your s
|
|
14 |
# Load model.
|
15 |
pipe_box=[]
|
16 |
@spaces.GPU
|
17 |
-
def
|
18 |
device="cuda"
|
19 |
unet = UNet2DConditionModel.from_config(base, subfolder="unet").to("cuda", torch.float16)
|
20 |
unet.load_state_dict(load_file(hf_hub_download(repo, ckpt), device="cuda"))
|
@@ -22,6 +22,7 @@ def inti():
|
|
22 |
# Ensure sampler uses "trailing" timesteps.
|
23 |
pipe.scheduler = EulerDiscreteScheduler.from_config(pipe.scheduler.config, timestep_spacing="trailing")
|
24 |
pipe_box.append(pipe)
|
|
|
25 |
def run():
|
26 |
pipe=pipe_box[0]
|
27 |
# Ensure using the same inference steps as the loaded model and CFG set to 0.
|
|
|
14 |
# Load model.
|
15 |
pipe_box=[]
|
16 |
@spaces.GPU
|
17 |
+
def init():
|
18 |
device="cuda"
|
19 |
unet = UNet2DConditionModel.from_config(base, subfolder="unet").to("cuda", torch.float16)
|
20 |
unet.load_state_dict(load_file(hf_hub_download(repo, ckpt), device="cuda"))
|
|
|
22 |
# Ensure sampler uses "trailing" timesteps.
|
23 |
pipe.scheduler = EulerDiscreteScheduler.from_config(pipe.scheduler.config, timestep_spacing="trailing")
|
24 |
pipe_box.append(pipe)
|
25 |
+
init()
|
26 |
def run():
|
27 |
pipe=pipe_box[0]
|
28 |
# Ensure using the same inference steps as the loaded model and CFG set to 0.
|