pub struct DdimScheduler { /* private fields */ }Expand description
DDIM scheduler state.
Implementations§
Source§impl DdimScheduler
impl DdimScheduler
Sourcepub fn new(num_train_timesteps: usize, prediction_type: PredictionType) -> Self
pub fn new(num_train_timesteps: usize, prediction_type: PredictionType) -> Self
Create a new DDIM scheduler.
Uses a “scaled linear” beta schedule matching SD 2.1 defaults:
beta_start=0.00085, beta_end=0.012, 1000 training steps.
Sourcepub fn set_timesteps(&mut self, num_inference_steps: usize)
pub fn set_timesteps(&mut self, num_inference_steps: usize)
Configure evenly-spaced timesteps for a given number of inference steps.
Sourcepub fn step(
&self,
model_output: &Tensor,
t: usize,
sample: &Tensor,
) -> Result<Tensor>
pub fn step( &self, model_output: &Tensor, t: usize, sample: &Tensor, ) -> Result<Tensor>
Perform one DDIM step (deterministic, η=0).
model_output: the raw network prediction at timestept.t: current timestep index.sample: the current noisy latent x_t.
Returns the denoised latent x_{t-1}.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DdimScheduler
impl RefUnwindSafe for DdimScheduler
impl Send for DdimScheduler
impl Sync for DdimScheduler
impl Unpin for DdimScheduler
impl UnsafeUnpin for DdimScheduler
impl UnwindSafe for DdimScheduler
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more