MCPcopy Create free account
hub / github.com/MotrixLab/MotionDiffuse / betas_for_alpha_bar

Function betas_for_alpha_bar

text2motion/models/gaussian_diffusion.py:256–273  ·  view source on GitHub ↗

Create a beta schedule that discretizes the given alpha_t_bar function, which defines the cumulative product of (1-beta) over time from t = [0,1]. :param num_diffusion_timesteps: the number of betas to produce. :param alpha_bar: a lambda that takes an argument t from 0 to 1 and

(num_diffusion_timesteps, alpha_bar, max_beta=0.999)

Source from the content-addressed store, hash-verified

254
255
256def betas_for_alpha_bar(num_diffusion_timesteps, alpha_bar, max_beta=0.999):
257 """
258 Create a beta schedule that discretizes the given alpha_t_bar function,
259 which defines the cumulative product of (1-beta) over time from t = [0,1].
260
261 :param num_diffusion_timesteps: the number of betas to produce.
262 :param alpha_bar: a lambda that takes an argument t from 0 to 1 and
263 produces the cumulative product of (1-beta) up to that
264 part of the diffusion process.
265 :param max_beta: the maximum beta to use; use values lower than 1 to
266 prevent singularities.
267 """
268 betas = []
269 for i in range(num_diffusion_timesteps):
270 t1 = i / num_diffusion_timesteps
271 t2 = (i + 1) / num_diffusion_timesteps
272 betas.append(min(1 - alpha_bar(t2) / alpha_bar(t1), max_beta))
273 return np.array(betas)
274
275
276class ModelMeanType(enum.Enum):

Callers 1

get_named_beta_scheduleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected