-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Conversation
…standing other developers what are doing and where it's using.
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.
Thanks for the contributions!
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. |
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.
I'm committed to making this project a success. |
""" | ||
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`. | ||
""" |
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.
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.
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.
I have solved the indentation problem. The get_activation function is defined in a separate file, so I will not explain it here 🤗.
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.
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()
.
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.
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.
@hi-sushanta can you run |
I'm using the black package to reformat my code. |
* 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>
* 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>
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:
Before submitting
documentation guidelines, and
here are tips on formatting docstrings.
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.