[Bugfix] Restore GLM-Image unshifted timesteps after set_timesteps (#7953)

Signed-off-by: sinksilk <785976238@qq.com>
This commit is contained in:
Si Chen authored and GitHub committed 2026-09-22 13:45:55 +00:00
1 parent 03ccce9a99
commit f1057b1e0d
2 files changed
+75

No files matched your search

@@ -193,6 +193,10 @@ def retrieve_timesteps(
f" timestep or sigma schedules. Please check whether you are using the correct scheduler."
)
scheduler.set_timesteps(timesteps=timesteps, sigmas=sigmas, device=device, **kwargs)
# GLM-Image conditions the DiT on the *unshifted* timesteps while integrating with the
# resolution-shifted sigmas. FlowMatchEulerDiscreteScheduler.set_timesteps (diffusers >= 0.40)
# overwrites provided timesteps with `sigmas * num_train_timesteps`, so restore them here.
scheduler.timesteps = torch.as_tensor(timesteps, dtype=torch.float32, device=scheduler.timesteps.device)
timesteps = scheduler.timesteps
num_inference_steps = len(timesteps)
elif timesteps is not None: