(self, scale, exp, num_steps, dyn_thresh_config=None)
| 55 | |
| 56 | class DynamicCFG(VanillaCFG): |
| 57 | def __init__(self, scale, exp, num_steps, dyn_thresh_config=None): |
| 58 | super().__init__(scale, dyn_thresh_config) |
| 59 | scale_schedule = ( |
| 60 | lambda scale, sigma, step_index: 1 + scale * (1 - math.cos(math.pi * (step_index / num_steps) ** exp)) / 2 |
| 61 | ) |
| 62 | self.scale_schedule = partial(scale_schedule, scale) |
| 63 | self.dyn_thresh = instantiate_from_config( |
| 64 | default( |
| 65 | dyn_thresh_config, |
| 66 | {"target": "sgm.modules.diffusionmodules.sampling_utils.NoDynamicThresholding"}, |
| 67 | ) |
| 68 | ) |
| 69 | |
| 70 | def __call__(self, x, sigma, step_index, scale=None): |
| 71 | x_u, x_c = x.chunk(2) |
nothing calls this directly
no test coverage detected