Unverified Commit cef0e367 authored by Linoy Tsaban's avatar Linoy Tsaban Committed by GitHub
Browse files

[RF inversion community pipeline] add eta_decay (#10199)

* add decay

* add decay

* style
parent ec9bfa9e
...@@ -648,6 +648,8 @@ class RFInversionFluxPipeline( ...@@ -648,6 +648,8 @@ class RFInversionFluxPipeline(
height: Optional[int] = None, height: Optional[int] = None,
width: Optional[int] = None, width: Optional[int] = None,
eta: float = 1.0, eta: float = 1.0,
decay_eta: Optional[bool] = False,
eta_decay_power: Optional[float] = 1.0,
strength: float = 1.0, strength: float = 1.0,
start_timestep: float = 0, start_timestep: float = 0,
stop_timestep: float = 0.25, stop_timestep: float = 0.25,
...@@ -880,12 +882,9 @@ class RFInversionFluxPipeline( ...@@ -880,12 +882,9 @@ class RFInversionFluxPipeline(
v_t = -noise_pred v_t = -noise_pred
v_t_cond = (y_0 - latents) / (1 - t_i) v_t_cond = (y_0 - latents) / (1 - t_i)
eta_t = eta if start_timestep <= i < stop_timestep else 0.0 eta_t = eta if start_timestep <= i < stop_timestep else 0.0
if start_timestep <= i < stop_timestep: if decay_eta:
# controlled vector field eta_t = eta_t * (1 - i / num_inference_steps) ** eta_decay_power # Decay eta over the loop
v_hat_t = v_t + eta * (v_t_cond - v_t) v_hat_t = v_t + eta_t * (v_t_cond - v_t)
else:
v_hat_t = v_t
# SDE Eq: 17 from https://arxiv.org/pdf/2410.10792 # SDE Eq: 17 from https://arxiv.org/pdf/2410.10792
latents = latents + v_hat_t * (sigmas[i] - sigmas[i + 1]) latents = latents + v_hat_t * (sigmas[i] - sigmas[i + 1])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment