MCPcopy Create free account
hub / github.com/evilsocket/cake / first_order_update

Method first_order_update

cake-core/src/models/vibevoice/ddpm.rs:100–118  ·  view source on GitHub ↗

First-order DPM-Solver++ update (from timestep s to t, s > t). x_t = (sigma_t/sigma_s) * x - alpha_t * expm1(-h) * x0

(
        &self,
        x0_pred: &Tensor,
        s: usize,
        t: usize,
        sample: &Tensor,
    )

Source from the content-addressed store, hash-verified

98 ///
99 /// x_t = (sigma_t/sigma_s) * x - alpha_t * expm1(-h) * x0
100 pub fn first_order_update(
101 &self,
102 x0_pred: &Tensor,
103 s: usize,
104 t: usize,
105 sample: &Tensor,
106 ) -> Result<Tensor> {
107 let lambda_s = self.lambda_t[s];
108 let lambda_t = self.lambda_t[t];
109 let alpha_t = self.alpha_t[t];
110 let sigma_t = self.sigma_t[t];
111 let sigma_s = self.sigma_t[s];
112
113 let h = lambda_t - lambda_s; // positive (lambda increases as noise decreases)
114 let ratio = sigma_t / sigma_s;
115 let coeff = alpha_t * (-h).exp_m1(); // alpha_t * (exp(-h) - 1), negative for h > 0
116
117 (sample * ratio)? - (x0_pred * coeff)?
118 }
119
120 /// Second-order DPM-Solver++ midpoint update.
121 ///

Callers 2

stepMethod · 0.80

Calls

no outgoing calls

Tested by 1