Skip to content

Commit aa3cce6

Browse files
committed
steps_offset causes out-of-bounds timestep indices
Signed-off-by: ytl0623 <[email protected]>
1 parent 3a2ffc5 commit aa3cce6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

monai/networks/schedulers/ddim.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def set_timesteps(self, num_inference_steps: int, device: str | torch.device | N
127127

128128
# creates integer timesteps by multiplying by ratio
129129
# casting to int to avoid issues when num_inference_step is power of 3
130-
timesteps = np.linspace(self.num_train_timesteps - 1, 0, num_inference_steps).round().astype(np.int64)
130+
timesteps = np.linspace(num_train_timesteps - 1 - steps_offset, 0, num_inference_steps).round().astype(np.int64)
131131
self.timesteps = torch.from_numpy(timesteps).to(device)
132132
self.timesteps += self.steps_offset
133133

0 commit comments

Comments
 (0)