Unverified Commit 2993257f authored by Chi's avatar Chi Committed by GitHub
Browse files

Batter way to write binarize() function. (#6394)



* I added a new doc string to the class. This is more flexible to understanding other developers what are doing and where it's using.

* Update src/diffusers/models/unet_2d_blocks.py

This changes suggest by maintener.
Co-authored-by: default avatarSayak Paul <spsayakpaul@gmail.com>

* Update src/diffusers/models/unet_2d_blocks.py

Add suggested text
Co-authored-by: default avatarSayak Paul <spsayakpaul@gmail.com>

* Update unet_2d_blocks.py

I changed the Parameter to Args text.

* Update unet_2d_blocks.py

proper indentation set in this file.

* Update unet_2d_blocks.py

a little bit of change in the act_fun argument line.

* I run the black command to reformat style in the code

* Update unet_2d_blocks.py

similar doc-string add to have in the original diffusion repository.

* Batter way to write binarize function

* Solve check_code_quality error

* My mistake to run pull request but not reformated file

* Update image_processor.py

* remove extra variable and space

* Update image_processor.py

* Run ruff libarary to reformat my file

---------
Co-authored-by: default avatarSayak Paul <spsayakpaul@gmail.com>
Co-authored-by: default avatarYiYi Xu <yixu310@gmail.com>
parent aad18faa
...@@ -33,14 +33,7 @@ PipelineImageInput = Union[ ...@@ -33,14 +33,7 @@ PipelineImageInput = Union[
List[torch.FloatTensor], List[torch.FloatTensor],
] ]
PipelineDepthInput = Union[ PipelineDepthInput = PipelineImageInput
PIL.Image.Image,
np.ndarray,
torch.FloatTensor,
List[PIL.Image.Image],
List[np.ndarray],
List[torch.FloatTensor],
]
class VaeImageProcessor(ConfigMixin): class VaeImageProcessor(ConfigMixin):
...@@ -169,7 +162,7 @@ class VaeImageProcessor(ConfigMixin): ...@@ -169,7 +162,7 @@ class VaeImageProcessor(ConfigMixin):
@staticmethod @staticmethod
def blur(image: PIL.Image.Image, blur_factor: int = 4) -> PIL.Image.Image: def blur(image: PIL.Image.Image, blur_factor: int = 4) -> PIL.Image.Image:
""" """
Blurs an image. Applies Gaussian blur to an image.
""" """
image = image.filter(ImageFilter.GaussianBlur(blur_factor)) image = image.filter(ImageFilter.GaussianBlur(blur_factor))
...@@ -402,6 +395,7 @@ class VaeImageProcessor(ConfigMixin): ...@@ -402,6 +395,7 @@ class VaeImageProcessor(ConfigMixin):
""" """
image[image < 0.5] = 0 image[image < 0.5] = 0
image[image >= 0.5] = 1 image[image >= 0.5] = 1
return image return image
def get_default_height_width( def get_default_height_width(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment