vilarin commited on
Commit
5c6a083
1 Parent(s): eb3258d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -1,4 +1,4 @@
1
- from diffusers import StableDiffusionXLPipeline, UNet2DConditionModel, LCMScheduler
2
  from huggingface_hub import hf_hub_download
3
  from safetensors.torch import load_file
4
  import spaces
@@ -37,8 +37,8 @@ def generate_image(prompt, ckpt):
37
  num_inference_steps = checkpoints[ckpt][1]
38
 
39
  if loaded != num_inference_steps:
40
- unet.load_state_dict(torch.load(hf_hub_download(repo, checkpoint), map_location="cuda"))
41
- pipe.scheduler = LCMScheduler.from_config(pipe.scheduler.config)
42
  loaded = num_inference_steps
43
 
44
  results = pipe(prompt, num_inference_steps=num_inference_steps, guidance_scale=0)
 
1
+ from diffusers import StableDiffusionXLPipeline, UNet2DConditionModel, EulerDiscreteScheduler
2
  from huggingface_hub import hf_hub_download
3
  from safetensors.torch import load_file
4
  import spaces
 
37
  num_inference_steps = checkpoints[ckpt][1]
38
 
39
  if loaded != num_inference_steps:
40
+ pipe.unet.load_state_dict(torch.load(hf_hub_download(repo, checkpoint), map_location="cuda"))
41
+ pipe.scheduler = EulerDiscreteScheduler.from_config(pipe.scheduler.config, timestep_spacing="trailing", prediction_type="sample" if num_inference_steps==1 else "epsilon")
42
  loaded = num_inference_steps
43
 
44
  results = pipe(prompt, num_inference_steps=num_inference_steps, guidance_scale=0)