You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pad (int, optional): Padding to be added to the crop region. Defaults to 0.
184
185
185
186
Returns:
186
-
tuple: (x1, y1, x2, y2) represent a rectangular region that contains all masked ares in an image and matches the original aspect ratio.
187
+
tuple: (x1, y1, x2, y2) represent a rectangular region that contains all masked ares in an image and
188
+
matches the original aspect ratio.
187
189
"""
188
190
189
191
mask_image=mask_image.convert("L")
@@ -265,7 +267,8 @@ def _resize_and_fill(
265
267
height: int,
266
268
) ->PIL.Image.Image:
267
269
"""
268
-
Resize the image to fit within the specified width and height, maintaining the aspect ratio, and then center the image within the dimensions, filling empty with data from image.
270
+
Resize the image to fit within the specified width and height, maintaining the aspect ratio, and then center
271
+
the image within the dimensions, filling empty with data from image.
269
272
270
273
Args:
271
274
image: The image to resize.
@@ -309,7 +312,8 @@ def _resize_and_crop(
309
312
height: int,
310
313
) ->PIL.Image.Image:
311
314
"""
312
-
Resize the image to fit within the specified width and height, maintaining the aspect ratio, and then center the image within the dimensions, cropping the excess.
315
+
Resize the image to fit within the specified width and height, maintaining the aspect ratio, and then center
316
+
the image within the dimensions, cropping the excess.
313
317
314
318
Args:
315
319
image: The image to resize.
@@ -346,12 +350,12 @@ def resize(
346
350
The width to resize to.
347
351
resize_mode (`str`, *optional*, defaults to `default`):
348
352
The resize mode to use, can be one of `default` or `fill`. If `default`, will resize the image to fit
349
-
within the specified width and height, and it may not maintaining the original aspect ratio.
350
-
If `fill`, will resize the image to fit within the specified width and height, maintaining the aspect ratio, and then center the image
351
-
within the dimensions, filling empty with data from image.
352
-
If `crop`, will resize the image to fit within the specified width and height, maintaining the aspect ratio, and then center the image
353
-
within the dimensions, cropping the excess.
354
-
Note that resize_mode `fill` and `crop` are only supported for PIL image input.
353
+
within the specified width and height, and it may not maintaining the original aspect ratio. If `fill`,
354
+
will resize the image to fit within the specified width and height, maintaining the aspect ratio, and
355
+
then center the image within the dimensions, filling empty with data from image. If `crop`, will resize
356
+
the image to fit within the specified width and height, maintaining the aspect ratio, and then center
357
+
the image within the dimensions, cropping the excess. Note that resize_mode `fill` and `crop` are only
358
+
supported for PIL image input.
355
359
356
360
Returns:
357
361
`PIL.Image.Image`, `np.ndarray` or `torch.Tensor`:
@@ -456,19 +460,21 @@ def preprocess(
456
460
457
461
Args:
458
462
image (`pipeline_image_input`):
459
-
The image input, accepted formats are PIL images, NumPy arrays, PyTorch tensors; Also accept list of supported formats.
463
+
The image input, accepted formats are PIL images, NumPy arrays, PyTorch tensors; Also accept list of
464
+
supported formats.
460
465
height (`int`, *optional*, defaults to `None`):
461
-
The height in preprocessed image. If `None`, will use the `get_default_height_width()` to get default height.
466
+
The height in preprocessed image. If `None`, will use the `get_default_height_width()` to get default
467
+
height.
462
468
width (`int`, *optional*`, defaults to `None`):
463
-
The width in preprocessed. If `None`, will use get_default_height_width()` to get the default width.
469
+
The width in preprocessed. If `None`, will use get_default_height_width()` to get the default width.
464
470
resize_mode (`str`, *optional*, defaults to `default`):
465
-
The resize mode, can be one of `default` or `fill`. If `default`, will resize the image to fit
466
-
within the specified width and height, and it may not maintaining the original aspect ratio.
467
-
If `fill`, will resize the image to fit within the specified width and height, maintaining the aspect ratio, and then center the image
468
-
within the dimensions, filling empty with data from image.
469
-
If `crop`, will resize the image to fit within the specified width and height, maintaining the aspect ratio, and then center the image
470
-
within the dimensions, cropping the excess.
471
-
Note that resize_mode `fill` and `crop` are only supported for PIL image input.
471
+
The resize mode, can be one of `default` or `fill`. If `default`, will resize the image to fit within
472
+
the specified width and height, and it may not maintaining the original aspect ratio. If `fill`, will
473
+
resize the image to fit within the specified width and height, maintaining the aspect ratio, and then
474
+
center the image within the dimensions, filling empty with data from image. If `crop`, will resize the
475
+
image to fit within the specified width and height, maintaining the aspect ratio, and then center the
476
+
image within the dimensions, cropping the excess. Note that resize_mode `fill` and `crop` are only
477
+
supported for PIL image input.
472
478
crops_coords (`List[Tuple[int, int, int, int]]`, *optional*, defaults to `None`):
473
479
The crop coordinates for each image in the batch. If `None`, will not crop the image.
Copy file name to clipboardExpand all lines: src/diffusers/loaders/peft.py
+4-3
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,8 @@
20
20
classPeftAdapterMixin:
21
21
"""
22
22
A class containing all functions for loading and using adapters weights that are supported in PEFT library. For
23
-
more details about adapters and injecting them in a transformer-based model, check out the PEFT [documentation](https://huggingface.co/docs/peft/index).
23
+
more details about adapters and injecting them in a transformer-based model, check out the PEFT
The type of model to load. If not provided, the model type will be inferred from the checkpoint file.
200
200
image_size (`int`, *optional*):
201
-
The size of the image output. It's used to configure the `sample_size` parameter of the UNet and VAE model.
201
+
The size of the image output. It's used to configure the `sample_size` parameter of the UNet and VAE
202
+
model.
202
203
load_safety_checker (`bool`, *optional*, defaults to `False`):
203
-
Whether to load the safety checker model or not. By default, the safety checker is not loaded unless a `safety_checker` component is passed to the `kwargs`.
204
+
Whether to load the safety checker model or not. By default, the safety checker is not loaded unless a
205
+
`safety_checker` component is passed to the `kwargs`.
204
206
num_in_channels (`int`, *optional*):
205
-
Specify the number of input channels for the UNet model. Read more about how to configure UNet model with this parameter
207
+
Specify the number of input channels for the UNet model. Read more about how to configure UNet model
0 commit comments