Geek7 commited on
Commit
b7ffca9
1 Parent(s): 3cf84df

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -11,9 +11,9 @@ def generate_image(prompt, num_inference_steps):
11
  ckpt = "sdxl_lightning_2step_unet.safetensors" # Use the correct ckpt for your step setting!
12
 
13
  # Load model.
14
- unet = UNet2DConditionModel.from_config(base, subfolder="unet").to("cuda", torch.float16)
15
- unet.load_state_dict(load_file(hf_hub_download(repo, ckpt), device="cuda"))
16
- pipe = StableDiffusionXLPipeline.from_pretrained(base, unet=unet, torch_dtype=torch.float16, variant="fp16").to("cuda")
17
 
18
  # Ensure sampler uses "trailing" timesteps.
19
  pipe.scheduler = EulerDiscreteScheduler.from_config(pipe.scheduler.config, timestep_spacing="trailing")
 
11
  ckpt = "sdxl_lightning_2step_unet.safetensors" # Use the correct ckpt for your step setting!
12
 
13
  # Load model.
14
+ unet = UNet2DConditionModel.from_config(base, subfolder="unet").to(torch.device("cpu"), torch.float16)
15
+ unet.load_state_dict(load_file(hf_hub_download(repo, ckpt), device=torch.device("cpu")))
16
+ pipe = StableDiffusionXLPipeline.from_pretrained(base, unet=unet, torch_dtype=torch.float16, variant="fp16").to(torch.device("cpu"))
17
 
18
  # Ensure sampler uses "trailing" timesteps.
19
  pipe.scheduler = EulerDiscreteScheduler.from_config(pipe.scheduler.config, timestep_spacing="trailing")