multimodalart HF Staff commited on
Commit
606b9af
·
verified ·
1 Parent(s): fbb6f85

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -1
app.py CHANGED
@@ -81,8 +81,23 @@ def infer(prompt, seed=42, randomize_seed=False, width=1024, height=1024,
81
  ).sample + init_latents
82
 
83
  # Generate final image with adapter disabled
84
- # Pass the modulated latents directly to bypass the SCM restriction
85
  pipe.transformer.disable_adapter_layers()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  image = pipe(
87
  latents=modulated_latents,
88
  prompt_embeds=prompt_embeds,
 
81
  ).sample + init_latents
82
 
83
  # Generate final image with adapter disabled
 
84
  pipe.transformer.disable_adapter_layers()
85
+
86
+ # Manually set timesteps to avoid intermediate_timesteps issue
87
+ # SCM scheduler only supports intermediate_timesteps when num_inference_steps=2
88
+ if num_inference_steps == 2:
89
+ pipe.scheduler.set_timesteps(num_inference_steps, device=device)
90
+ else:
91
+ # For num_inference_steps != 2, we need to avoid intermediate_timesteps
92
+ max_timesteps = 1.57080 # Default from SCM paper
93
+ pipe.scheduler.set_timesteps(
94
+ num_inference_steps,
95
+ device=device,
96
+ max_timesteps=max_timesteps,
97
+ intermediate_timesteps=None
98
+ )
99
+
100
+ # Now generate the image with pre-set timesteps
101
  image = pipe(
102
  latents=modulated_latents,
103
  prompt_embeds=prompt_embeds,