Skip to content

Commit 5a4d2c7

Browse files
committed
rename enable/disable
1 parent 0d5a788 commit 5a4d2c7

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/diffusers/guiders/guider_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ def __init__(self, start: float = 0.0, stop: float = 1.0):
5757
"`_input_predictions` must be a list of required prediction names for the guidance technique."
5858
)
5959

60-
def _force_disable(self):
60+
def disable(self):
6161
self._enabled = False
6262

63-
def _force_enable(self):
63+
def enable(self):
6464
self._enabled = True
6565

6666
def set_state(self, step: int, num_inference_steps: int, timestep: torch.LongTensor) -> None:

src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_modular.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2231,9 +2231,9 @@ def __call__(self, pipeline, state: PipelineState) -> PipelineState:
22312231
data.num_channels_unet = pipeline.unet.config.in_channels
22322232
data.disable_guidance = True if pipeline.unet.config.time_cond_proj_dim is not None else False
22332233
if data.disable_guidance:
2234-
pipeline.guider._force_disable()
2234+
pipeline.guider.disable()
22352235
else:
2236-
pipeline.guider._force_enable()
2236+
pipeline.guider.enable()
22372237

22382238
# Prepare extra step kwargs. TODO: Logic should ideally just be moved out of the pipeline
22392239
data.extra_step_kwargs = self.prepare_extra_step_kwargs(pipeline, data.generator, data.eta)
@@ -2611,9 +2611,9 @@ def __call__(self, pipeline, state: PipelineState) -> PipelineState:
26112611
# (2) Prepare conditional inputs for unet using the guider
26122612
data.disable_guidance = True if pipeline.unet.config.time_cond_proj_dim is not None else False
26132613
if data.disable_guidance:
2614-
pipeline.guider._force_disable()
2614+
pipeline.guider.disable()
26152615
else:
2616-
pipeline.guider._force_enable()
2616+
pipeline.guider.enable()
26172617

26182618
# (4) Prepare extra step kwargs. TODO: Logic should ideally just be moved out of the pipeline
26192619
data.extra_step_kwargs = self.prepare_extra_step_kwargs(pipeline, data.generator, data.eta)
@@ -3011,9 +3011,9 @@ def __call__(self, pipeline, state: PipelineState) -> PipelineState:
30113011
# adding default guider arguments: disable_guidance, guidance_scale, guidance_rescale
30123012
data.disable_guidance = True if pipeline.unet.config.time_cond_proj_dim is not None else False
30133013
if data.disable_guidance:
3014-
pipeline.guider._force_disable()
3014+
pipeline.guider.disable()
30153015
else:
3016-
pipeline.guider._force_enable()
3016+
pipeline.guider.enable()
30173017

30183018
data.control_type = data.control_type.reshape(1, -1).to(data.device, dtype=data.prompt_embeds.dtype)
30193019
repeat_by = data.batch_size * data.num_images_per_prompt // data.control_type.shape[0]

0 commit comments

Comments
 (0)