Skip to content
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

I Added Doc-String Into The class. #5293

Merged
merged 13 commits into from
Oct 11, 2023

Conversation

hi-sushanta
Copy link
Contributor

@hi-sushanta hi-sushanta commented Oct 5, 2023

What does this PR do?

Fixes #5249, which identified missing documentation strings in multiple classes, I am currently focusing on fixing one class at a time. This approach is more flexible, allowing me to gradually address all of the affected classes. My documentation strings will help other developers to easily understand what each class does and how it is used.

Chaged Code Look Like:
Screenshot from 2023-10-05 06-51-02

Before submitting

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@DN6 DN6 requested a review from sayakpaul October 6, 2023 08:38
Copy link
Member

@sayakpaul sayakpaul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contributions!

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint.

hi-sushanta and others added 4 commits October 7, 2023 05:52
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.
@hi-sushanta
Copy link
Contributor Author

I'm committed to making this project a success.

Comment on lines 469 to 479
"""
Tiny Autoencoder block used in [`AutoencoderTiny`]. It is a mini residual module consisting of plain conv + ReLU blocks.

Args:
in_channels (`int`): The number of input channels.
out_channels (`int`): The number of output channels.
act_fn (`str`):` The activation function to use. Supported values are `relu`, `tanh`, and `sigmoid`.

Output:
A tensor with the same shape as the input tensor, but with the number of channels equal to `out_channels`.
"""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indentation seems to be off. Could we fix that? It should be:

"""
Tiny Autoencoder block used in [`AutoencoderTiny`]. It is a mini residual module consisting of plain conv + ReLU blocks.  

Args:
    in_channels (`int`): The number of input channels.
    out_channels (`int`): The number of output channels.
    act_fn (`str`):` The activation function to use. Supported values are `"swish"`, `"mish"`, `"gelu"`, and `"relu"`.
    
Returns:
    `torch.FloatTensor`: A tensor with the same shape as the input tensor, but with the number of channels equal to `out_channels`.
"""

The structure of the API documentation is referred from https://github.com/huggingface/doc-builder#writing-source-documentation.

The supported activation functions can be noted from:

def get_activation(act_fn):

Let me know if there's anything unclear.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have solved the indentation problem. The get_activation function is defined in a separate file, so I will not explain it here 🤗.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not about explaining that. It's about including the right information. The current statement suggests that we support tanh and sigmoid as the activation values but we clearly not (as evident in the get_activation() function). To make that point clearly, I provided the reference to get_activation().

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm so sorry, that was my mistake.

proper indentation set in this file.
a little bit of change in the act_fun argument line.
@sayakpaul
Copy link
Member

@hi-sushanta can you run make style && make quality so that the code / doc styling issues are fixed?

@hi-sushanta
Copy link
Contributor Author

I'm using the black package to reformat my code.

@patrickvonplaten patrickvonplaten merged commit ea8364e into huggingface:main Oct 11, 2023
10 of 11 checks passed
yoonseokjin pushed a commit to yoonseokjin/diffusers that referenced this pull request Dec 25, 2023
* 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

---------

Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>
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

---------

Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing docs in multiple diffusers/models files
4 participants