make style · anagri/diffusers@3b66cc0 · GitHub
Skip to content

Commit 3b66cc0

Browse files
make style
1 parent 717a956 commit 3b66cc0

6 files changed

Lines changed: 12 additions & 19 deletions

File tree

‎examples/research_projects/onnxruntime/textual_inversion/textual_inversion.py‎

Lines changed: 3 additions & 3 deletions

‎examples/textual_inversion/textual_inversion.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -749,9 +749,9 @@ def main():
749749
# Let's make sure we don't update any embedding weights besides the newly added token
750750
index_no_updates = torch.arange(len(tokenizer)) != placeholder_token_id
751751
with torch.no_grad():
752-
accelerator.unwrap_model(text_encoder).get_input_embeddings().weight[index_no_updates] = (
753-
orig_embeds_params[index_no_updates]
754-
)
752+
accelerator.unwrap_model(text_encoder).get_input_embeddings().weight[
753+
index_no_updates
754+
] = orig_embeds_params[index_no_updates]
755755

756756
# Checks if the accelerator has performed an optimization step behind the scenes
757757
if accelerator.sync_gradients:

‎src/diffusers/pipelines/alt_diffusion/pipeline_alt_diffusion_img2img.py‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -418,9 +418,6 @@ def prepare_extra_step_kwargs(self, generator, eta):
418418
def check_inputs(
419419
self, prompt, strength, callback_steps, negative_prompt=None, prompt_embeds=None, negative_prompt_embeds=None
420420
):
421-
if not isinstance(prompt, str) and not isinstance(prompt, list):
422-
raise ValueError(f"`prompt` has to be of type `str` or `list` but is {type(prompt)}")
423-
424421
if strength < 0 or strength > 1:
425422
raise ValueError(f"The value of strength should in [0.0, 1.0] but is {strength}")
426423

@@ -613,7 +610,12 @@ def __call__(
613610
self.check_inputs(prompt, strength, callback_steps, negative_prompt, prompt_embeds, negative_prompt_embeds)
614611

615612
# 2. Define call parameters
616-
batch_size = 1 if isinstance(prompt, str) else len(prompt)
613+
if prompt is not None and isinstance(prompt, str):
614+
batch_size = 1
615+
elif prompt is not None and isinstance(prompt, list):
616+
batch_size = len(prompt)
617+
else:
618+
batch_size = prompt_embeds.shape[0]
617619
device = self._execution_device
618620
# here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
619621
# of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`

‎src/diffusers/pipelines/stable_diffusion/pipeline_cycle_diffusion.py‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -403,9 +403,6 @@ def _encode_prompt(
403403
def check_inputs(
404404
self, prompt, strength, callback_steps, negative_prompt=None, prompt_embeds=None, negative_prompt_embeds=None
405405
):
406-
if not isinstance(prompt, str) and not isinstance(prompt, list):
407-
raise ValueError(f"`prompt` has to be of type `str` or `list` but is {type(prompt)}")
408-
409406
if strength < 0 or strength > 1:
410407
raise ValueError(f"The value of strength should in [0.0, 1.0] but is {strength}")
411408

‎src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_depth2img.py‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,9 +339,6 @@ def prepare_extra_step_kwargs(self, generator, eta):
339339
def check_inputs(
340340
self, prompt, strength, callback_steps, negative_prompt=None, prompt_embeds=None, negative_prompt_embeds=None
341341
):
342-
if not isinstance(prompt, str) and not isinstance(prompt, list):
343-
raise ValueError(f"`prompt` has to be of type `str` or `list` but is {type(prompt)}")
344-
345342
if strength < 0 or strength > 1:
346343
raise ValueError(f"The value of strength should in [0.0, 1.0] but is {strength}")
347344

‎src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint_legacy.py‎

Lines changed: 0 additions & 3 deletions

0 commit comments

Comments
 (0)