Skip to content

Commit b9de16b

Browse files
committed
style
1 parent 02ad165 commit b9de16b

8 files changed

Lines changed: 22 additions & 25 deletions

src/diffusers/guiders/adaptive_projected_guidance.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
import math
16-
from typing import TYPE_CHECKING, Dict, List, Optional, Tuple, Union
16+
from typing import TYPE_CHECKING, Dict, List, Optional, Tuple
1717

1818
import torch
1919

src/diffusers/guiders/adaptive_projected_guidance_mix.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
import math
16-
from typing import TYPE_CHECKING, Dict, List, Optional, Tuple, Union
16+
from typing import TYPE_CHECKING, Dict, List, Optional, Tuple
1717

1818
import torch
1919

@@ -88,9 +88,7 @@ def __init__(
8888
self.use_original_formulation = use_original_formulation
8989
self.momentum_buffer = None
9090

91-
def prepare_inputs(
92-
self, data: Dict[str, Tuple[torch.Tensor, torch.Tensor]]) -> List["BlockState"]:
93-
91+
def prepare_inputs(self, data: Dict[str, Tuple[torch.Tensor, torch.Tensor]]) -> List["BlockState"]:
9492
if self._step == 0:
9593
if self.adaptive_projected_guidance_momentum is not None:
9694
self.momentum_buffer = MomentumBuffer(self.adaptive_projected_guidance_momentum)

src/diffusers/guiders/classifier_free_guidance.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
import math
16-
from typing import TYPE_CHECKING, Dict, List, Optional, Tuple, Union
16+
from typing import TYPE_CHECKING, Dict, List, Optional, Tuple
1717

1818
import torch
1919

@@ -92,7 +92,6 @@ def __init__(
9292
self.use_original_formulation = use_original_formulation
9393

9494
def prepare_inputs(self, data: Dict[str, Tuple[torch.Tensor, torch.Tensor]]) -> List["BlockState"]:
95-
9695
tuple_indices = [0] if self.num_conditions == 1 or not self._is_cfg_enabled() else [0, 1]
9796
data_batches = []
9897
for tuple_idx, input_prediction in zip(tuple_indices, self._input_predictions):

src/diffusers/guiders/classifier_free_zero_star_guidance.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
import math
16-
from typing import TYPE_CHECKING, Dict, List, Optional, Tuple, Union
16+
from typing import TYPE_CHECKING, Dict, List, Optional, Tuple
1717

1818
import torch
1919

src/diffusers/guiders/guider_utils.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,6 @@ def _prepare_batch(
216216
"""
217217
from ..modular_pipelines.modular_pipeline import BlockState
218218

219-
220219
data_batch = {}
221220
for key, value in data.items():
222221
try:

src/diffusers/guiders/tangential_classifier_free_guidance.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
import math
16-
from typing import TYPE_CHECKING, Dict, List, Optional, Tuple, Union
16+
from typing import TYPE_CHECKING, Dict, List, Optional, Tuple
1717

1818
import torch
1919

src/diffusers/pipelines/hunyuan_image/pipeline_hunyuanimage.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -531,8 +531,7 @@ def __call__(
531531
instead.
532532
negative_prompt (`str` or `List[str]`, *optional*):
533533
The prompt or prompts not to guide the image generation. If not defined and negative_prompt_embeds is
534-
not provided, will use an empty negative prompt. Ignored when not using guidance.
535-
).
534+
not provided, will use an empty negative prompt. Ignored when not using guidance. ).
536535
height (`int`, *optional*, defaults to self.unet.config.sample_size * self.vae_scale_factor):
537536
The height in pixels of the generated image. This is set to 1024 by default for the best results.
538537
width (`int`, *optional*, defaults to self.unet.config.sample_size * self.vae_scale_factor):
@@ -548,10 +547,10 @@ def __call__(
548547
A guidance scale value for guidance distilled models. Unlike the traditional classifier-free guidance
549548
where the guidance scale is applied during inference through noise prediction rescaling, guidance
550549
distilled models take the guidance scale directly as an input parameter during forward pass. Guidance
551-
is enabled by setting `distilled_guidance_scale > 1`. Higher guidance scale encourages to generate images that
552-
are closely linked to the text `prompt`, usually at the expense of lower image quality.
553-
For guidance distilled models, this parameter is required.
554-
For non-distilled models, this parameter will be ignored.
550+
is enabled by setting `distilled_guidance_scale > 1`. Higher guidance scale encourages to generate
551+
images that are closely linked to the text `prompt`, usually at the expense of lower image quality. For
552+
guidance distilled models, this parameter is required. For non-distilled models, this parameter will be
553+
ignored.
555554
num_images_per_prompt (`int`, *optional*, defaults to 1):
556555
The number of images to generate per prompt.
557556
generator (`torch.Generator` or `List[torch.Generator]`, *optional*):
@@ -782,7 +781,9 @@ def __call__(
782781
guider.prepare_models(self.transformer)
783782

784783
# Extract conditioning kwargs for this batch (e.g., encoder_hidden_states)
785-
cond_kwargs = {input_name: getattr(guider_state_batch, input_name) for input_name in guider_inputs.keys()}
784+
cond_kwargs = {
785+
input_name: getattr(guider_state_batch, input_name) for input_name in guider_inputs.keys()
786+
}
786787

787788
# e.g. "pred_cond"/"pred_uncond"
788789
context_name = getattr(guider_state_batch, guider._identifier_key)

src/diffusers/pipelines/hunyuan_image/pipeline_hunyuanimage_refiner.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -467,10 +467,10 @@ def __call__(
467467
A guidance scale value for guidance distilled models. Unlike the traditional classifier-free guidance
468468
where the guidance scale is applied during inference through noise prediction rescaling, guidance
469469
distilled models take the guidance scale directly as an input parameter during forward pass. Guidance
470-
is enabled by setting `distilled_guidance_scale > 1`. Higher guidance scale encourages to generate images that
471-
are closely linked to the text `prompt`, usually at the expense of lower image quality.
472-
For guidance distilled models, this parameter is required.
473-
For non-distilled models, this parameter will be ignored.
470+
is enabled by setting `distilled_guidance_scale > 1`. Higher guidance scale encourages to generate
471+
images that are closely linked to the text `prompt`, usually at the expense of lower image quality. For
472+
guidance distilled models, this parameter is required. For non-distilled models, this parameter will be
473+
ignored.
474474
num_images_per_prompt (`int`, *optional*, defaults to 1):
475475
height (`int`, *optional*, defaults to self.unet.config.sample_size * self.vae_scale_factor):
476476
The height in pixels of the generated image. This is set to 1024 by default for the best results.
@@ -621,9 +621,7 @@ def __call__(
621621
if distilled_guidance_scale is None:
622622
raise ValueError("`distilled_guidance_scale` is required for guidance-distilled model.")
623623
guidance = (
624-
torch.tensor(
625-
[distilled_guidance_scale] * latents.shape[0], dtype=self.transformer.dtype, device=device
626-
)
624+
torch.tensor([distilled_guidance_scale] * latents.shape[0], dtype=self.transformer.dtype, device=device)
627625
* 1000.0
628626
)
629627

@@ -670,7 +668,9 @@ def __call__(
670668
guider.prepare_models(self.transformer)
671669

672670
# Extract conditioning kwargs for this batch (e.g., encoder_hidden_states)
673-
cond_kwargs = {input_name: getattr(guider_state_batch, input_name) for input_name in guider_inputs.keys()}
671+
cond_kwargs = {
672+
input_name: getattr(guider_state_batch, input_name) for input_name in guider_inputs.keys()
673+
}
674674

675675
# e.g. "pred_cond"/"pred_uncond"
676676
context_name = getattr(guider_state_batch, guider._identifier_key)

0 commit comments

Comments
 (0)