-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Batter way to write binarize() function. #6394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…standing other developers what are doing and where it's using.
This changes suggest by maintener. Co-authored-by: Sayak Paul <[email protected]>
Add suggested text Co-authored-by: Sayak Paul <[email protected]>
I changed the Parameter to Args text.
proper indentation set in this file.
a little bit of change in the act_fun argument line.
Doc string
similar doc-string add to have in the original diffusion repository.
List[np.ndarray], | ||
List[torch.FloatTensor], | ||
] | ||
PipelineDepthInput = PipelineImageInput |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you.
src/diffusers/image_processor.py
Outdated
image = image.convert("RGB") | ||
|
||
return image | ||
return image.convert("RGB") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes the code harder to debug with pdb
or ipdb
- do we really need this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right! Your suggestions were invaluable, and I've gladly returned to the original version. Thank you for guiding me towards the best outcome.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we revert all the changes except https://github.com/huggingface/diffusers/pull/6394/files#r1439464834
thanks!
I recognized the value in those two crucial lines, so I carefully preserved them while reverting to other changes. |
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
* 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: Sayak Paul <[email protected]> * Update src/diffusers/models/unet_2d_blocks.py Add suggested text Co-authored-by: Sayak Paul <[email protected]> * 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: Sayak Paul <[email protected]> Co-authored-by: YiYi Xu <[email protected]>
The elegance of this image binarization code lies in its simplicity. With just a single line, it leverages the PIL.Image.point() method to threshold the image into black and white. Free of complexity and verbose syntax, this solution gets straight to the point - converting pixel values to binary based on a set threshold.
Before submitting
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
@sayakpaul @patrickvonplaten @yiyixuxu