Skip to content

Commit 522f8aa

Browse files
[Black] Update black library (huggingface#2007)
1 parent 8a3f0c1 commit 522f8aa

File tree

10 files changed

+36
-17
lines changed

10 files changed

+36
-17
lines changed

examples/dreambooth/train_dreambooth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ def __init__(
336336

337337
self.instance_data_root = Path(instance_data_root)
338338
if not self.instance_data_root.exists():
339-
raise ValueError("Instance images root doesn't exists.")
339+
raise ValueError(f"Instance {self.instance_data_root} images root doesn't exists.")
340340

341341
self.instance_images_path = list(Path(instance_data_root).iterdir())
342342
self.num_instance_images = len(self.instance_images_path)

examples/research_projects/intel_opts/textual_inversion/textual_inversion_bf16.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,10 @@ def __getitem__(self, i):
336336

337337
if self.center_crop:
338338
crop = min(img.shape[0], img.shape[1])
339-
(h, w,) = (
339+
(
340+
h,
341+
w,
342+
) = (
340343
img.shape[0],
341344
img.shape[1],
342345
)

examples/textual_inversion/textual_inversion.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,10 @@ def __getitem__(self, i):
381381

382382
if self.center_crop:
383383
crop = min(img.shape[0], img.shape[1])
384-
(h, w,) = (
384+
(
385+
h,
386+
w,
387+
) = (
385388
img.shape[0],
386389
img.shape[1],
387390
)

examples/textual_inversion/textual_inversion_flax.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,10 @@ def __getitem__(self, i):
306306

307307
if self.center_crop:
308308
crop = min(img.shape[0], img.shape[1])
309-
(h, w,) = (
309+
(
310+
h,
311+
w,
312+
) = (
310313
img.shape[0],
311314
img.shape[1],
312315
)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
_deps = [
8181
"Pillow", # keep the PIL.Image.Resampling deprecation away
8282
"accelerate>=0.11.0",
83-
"black==22.8",
83+
"black==22.12",
8484
"datasets",
8585
"filelock",
8686
"flake8>=3.8.3",

src/diffusers/models/attention.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,10 @@ def set_use_memory_efficient_attention_xformers(self, use_memory_efficient_atten
9090
if use_memory_efficient_attention_xformers:
9191
if not is_xformers_available():
9292
raise ModuleNotFoundError(
93-
"Refer to https://github.com/facebookresearch/xformers for more information on how to install"
94-
" xformers",
93+
(
94+
"Refer to https://github.com/facebookresearch/xformers for more information on how to install"
95+
" xformers"
96+
),
9597
name="xformers",
9698
)
9799
elif not torch.cuda.is_available():

src/diffusers/models/cross_attention.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,10 @@ def set_use_memory_efficient_attention_xformers(self, use_memory_efficient_atten
105105
)
106106
elif not is_xformers_available():
107107
raise ModuleNotFoundError(
108-
"Refer to https://github.com/facebookresearch/xformers for more information on how to install"
109-
" xformers",
108+
(
109+
"Refer to https://github.com/facebookresearch/xformers for more information on how to install"
110+
" xformers"
111+
),
110112
name="xformers",
111113
)
112114
elif not torch.cuda.is_available():

src/diffusers/schedulers/scheduling_euler_ancestral_discrete.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,11 @@ def step(
189189
or isinstance(timestep, torch.LongTensor)
190190
):
191191
raise ValueError(
192-
"Passing integer indices (e.g. from `enumerate(timesteps)`) as timesteps to"
193-
" `EulerDiscreteScheduler.step()` is not supported. Make sure to pass"
194-
" one of the `scheduler.timesteps` as a timestep.",
192+
(
193+
"Passing integer indices (e.g. from `enumerate(timesteps)`) as timesteps to"
194+
" `EulerDiscreteScheduler.step()` is not supported. Make sure to pass"
195+
" one of the `scheduler.timesteps` as a timestep."
196+
),
195197
)
196198

197199
if not self.is_scale_input_called:

src/diffusers/schedulers/scheduling_euler_discrete.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,11 @@ def step(
198198
or isinstance(timestep, torch.LongTensor)
199199
):
200200
raise ValueError(
201-
"Passing integer indices (e.g. from `enumerate(timesteps)`) as timesteps to"
202-
" `EulerDiscreteScheduler.step()` is not supported. Make sure to pass"
203-
" one of the `scheduler.timesteps` as a timestep.",
201+
(
202+
"Passing integer indices (e.g. from `enumerate(timesteps)`) as timesteps to"
203+
" `EulerDiscreteScheduler.step()` is not supported. Make sure to pass"
204+
" one of the `scheduler.timesteps` as a timestep."
205+
),
204206
)
205207

206208
if not self.is_scale_input_called:

tests/test_scheduler.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,8 +537,10 @@ def test_scheduler_public_api(self):
537537
)
538538
self.assertTrue(
539539
hasattr(scheduler, "scale_model_input"),
540-
f"{scheduler_class} does not implement a required class method `scale_model_input(sample,"
541-
" timestep)`",
540+
(
541+
f"{scheduler_class} does not implement a required class method `scale_model_input(sample,"
542+
" timestep)`"
543+
),
542544
)
543545
self.assertTrue(
544546
hasattr(scheduler, "step"),

0 commit comments

Comments
 (0)