MCPcopy Index your code
hub / github.com/VisionXLab/OF-Diff / get_model_output

Method get_model_output

ldm/models/diffusion/plms.py:184–198  ·  view source on GitHub ↗
(x, t)

Source from the content-addressed store, hash-verified

182 b, *_, device = *x.shape, x.device
183
184 def get_model_output(x, t):
185 if unconditional_conditioning is None or unconditional_guidance_scale == 1.:
186 e_t = self.model.apply_model(x, t, c)
187 else:
188 x_in = torch.cat([x] * 2)
189 t_in = torch.cat([t] * 2)
190 c_in = torch.cat([unconditional_conditioning, c])
191 e_t_uncond, e_t = self.model.apply_model(x_in, t_in, c_in).chunk(2)
192 e_t = e_t_uncond + unconditional_guidance_scale * (e_t - e_t_uncond)
193
194 if score_corrector is not None:
195 assert self.model.parameterization == "eps"
196 e_t = score_corrector.modify_score(self.model, e_t, x, t, c, **corrector_kwargs)
197
198 return e_t
199
200 alphas = self.model.alphas_cumprod if use_original_steps else self.ddim_alphas
201 alphas_prev = self.model.alphas_cumprod_prev if use_original_steps else self.ddim_alphas_prev

Callers

nothing calls this directly

Calls 1

apply_modelMethod · 0.45

Tested by

no test coverage detected