Batter way to write binarize() function. - #6394
Merged
Merged
Conversation
…standing other developers what are doing and where it's using.
This changes suggest by maintener. Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>
Add suggested text Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>
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.
sayakpaul
reviewed
Dec 30, 2023
| List[np.ndarray], | ||
| List[torch.FloatTensor], | ||
| ] | ||
| PipelineDepthInput = PipelineImageInput |
| image = image.convert("RGB") | ||
|
|
||
| return image | ||
| return image.convert("RGB") |
Contributor
There was a problem hiding this comment.
This makes the code harder to debug with pdb or ipdb - do we really need this change?
Contributor
Author
There was a problem hiding this comment.
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.
yiyixuxu
reviewed
Jan 2, 2024
yiyixuxu
left a comment
Collaborator
There was a problem hiding this comment.
can we revert all the changes except https://github.com/huggingface/diffusers/pull/6394/files#r1439464834
thanks!
Contributor
Author
|
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. |
yiyixuxu
approved these changes
Jan 3, 2024
sayakpaul
approved these changes
Jan 4, 2024
AmericanPresidentJimmyCarter
pushed a commit
to AmericanPresidentJimmyCarter/diffusers
that referenced
this pull request
Apr 26, 2024
* 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 <spsayakpaul@gmail.com> * Update src/diffusers/models/unet_2d_blocks.py Add suggested text Co-authored-by: Sayak 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: Sayak Paul <spsayakpaul@gmail.com> Co-authored-by: YiYi Xu <yixu310@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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