tsi-org/tango
0
1<!--Copyright 2023 The HuggingFace Team. All rights reserved.2 3Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with4the License. You may obtain a copy of the License at5 6http://www.apache.org/licenses/LICENSE-2.07 8Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on9an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the10specific language governing permissions and limitations under the License.11-->12 13# How to contribute to Diffusers 🧨14 15We ❤️ contributions from the open-source community! Everyone is welcome, and all types of participation –not just code– are valued and appreciated. Answering questions, helping others, reaching out, and improving the documentation are all immensely valuable to the community, so don't be afraid and get involved if you're up for it!16 17Everyone is encouraged to start by saying 👋 in our public Discord channel. We discuss the latest trends in diffusion models, ask questions, show off personal projects, help each other with contributions, or just hang out ☕. <a href="https://Discord.gg/G7tWnz98XR"><img alt="Join us on Discord" src="https://img.shields.io/Discord/823813159592001537?color=5865F2&logo=Discord&logoColor=white"></a>18 19Whichever way you choose to contribute, we strive to be part of an open, welcoming, and kind community. Please, read our [code of conduct](https://github.com/huggingface/diffusers/blob/main/CODE_OF_CONDUCT.md) and be mindful to respect it during your interactions. We also recommend you become familiar with the [ethical guidelines](https://huggingface.co/docs/diffusers/conceptual/ethical_guidelines) that guide our project and ask you to adhere to the same principles of transparency and responsibility.20 21We enormously value feedback from the community, so please do not be afraid to speak up if you believe you have valuable feedback that can help improve the library - every message, comment, issue, and pull request (PR) is read and considered.22 23## Overview24 25You can contribute in many ways ranging from answering questions on issues to adding new diffusion models to26the core library.27 28In the following, we give an overview of different ways to contribute, ranked by difficulty in ascending order. All of them are valuable to the community.29 30* 1. Asking and answering questions on [the Diffusers discussion forum](https://discuss.huggingface.co/c/discussion-related-to-httpsgithubcomhuggingfacediffusers) or on [Discord](https://discord.gg/G7tWnz98XR).31* 2. Opening new issues on [the GitHub Issues tab](https://github.com/huggingface/diffusers/issues/new/choose)32* 3. Answering issues on [the GitHub Issues tab](https://github.com/huggingface/diffusers/issues)33* 4. Fix a simple issue, marked by the "Good first issue" label, see [here](https://github.com/huggingface/diffusers/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22).34* 5. Contribute to the [documentation](https://github.com/huggingface/diffusers/tree/main/docs/source).35* 6. Contribute a [Community Pipeline](https://github.com/huggingface/diffusers/issues?q=is%3Aopen+is%3Aissue+label%3Acommunity-examples)36* 7. Contribute to the [examples](https://github.com/huggingface/diffusers/tree/main/examples).37* 8. Fix a more difficult issue, marked by the "Good second issue" label, see [here](https://github.com/huggingface/diffusers/issues?q=is%3Aopen+is%3Aissue+label%3A%22Good+second+issue%22).38* 9. Add a new pipeline, model, or scheduler, see ["New Pipeline/Model"](https://github.com/huggingface/diffusers/issues?q=is%3Aopen+is%3Aissue+label%3A%22New+pipeline%2Fmodel%22) and ["New scheduler"](https://github.com/huggingface/diffusers/issues?q=is%3Aopen+is%3Aissue+label%3A%22New+scheduler%22) issues. For this contribution, please have a look at [Design Philosophy](https://github.com/huggingface/diffusers/blob/main/PHILOSOPHY.md).39 40As said before, **all contributions are valuable to the community**.41In the following, we will explain each contribution a bit more in detail.42 43For all contributions 4.-9. you will need to open a PR. It is explained in detail how to do so in [Opening a pull requst](#how-to-open-a-pr)44 45### 1. Asking and answering questions on the Diffusers discussion forum or on the Diffusers Discord46 47Any question or comment related to the Diffusers library can be asked on the [discussion forum](https://discuss.huggingface.co/c/discussion-related-to-httpsgithubcomhuggingfacediffusers/) or on [Discord](https://discord.gg/G7tWnz98XR). Such questions and comments include (but are not limited to):48- Reports of training or inference experiments in an attempt to share knowledge49- Presentation of personal projects50- Questions to non-official training examples51- Project proposals52- General feedback53- Paper summaries54- Asking for help on personal projects that build on top of the Diffusers library55- General questions56- Ethical questions regarding diffusion models57- ...58 59Every question that is asked on the forum or on Discord actively encourages the community to publicly60share knowledge and might very well help a beginner in the future that has the same question you're61having. Please do pose any questions you might have.62In the same spirit, you are of immense help to the community by answering such questions because this way you are publicly documenting knowledge for everybody to learn from.63 64**Please** keep in mind that the more effort you put into asking or answering a question, the higher65the quality of the publicly documented knowledge. In the same way, well-posed and well-answered questions create a high-quality knowledge database accessible to everybody, while badly posed questions or answers reduce the overall quality of the public knowledge database.66In short, a high quality question or answer is *precise*, *concise*, *relevant*, *easy-to-understand*, *accesible*, and *well-formated/well-posed*. For more information, please have a look through the [How to write a good issue](#how-to-write-a-good-issue) section.67 68**NOTE about channels**:69[*The forum*](https://discuss.huggingface.co/c/discussion-related-to-httpsgithubcomhuggingfacediffusers/63) is much better indexed by search engines, such as Google. Posts are ranked by popularity rather than chronologically. Hence, it's easier to look up questions and answers that we posted some time ago.70In addition, questions and answers posted in the forum can easily be linked to.71In contrast, *Discord* has a chat-like format that invites fast back-and-forth communication.72While it will most likely take less time for you to get an answer to your question on Discord, your73question won't be visible anymore over time. Also, it's much harder to find information that was posted a while back on Discord. We therefore strongly recommend using the forum for high-quality questions and answers in an attempt to create long-lasting knowledge for the community. If discussions on Discord lead to very interesting answers and conclusions, we recommend posting the results on the forum to make the information more available for future readers.74 75### 2. Opening new issues on the GitHub issues tab76 77The 🧨 Diffusers library is robust and reliable thanks to the users who notify us of78the problems they encounter. So thank you for reporting an issue.79 80Remember, GitHub issues are reserved for technical questions directly related to the Diffusers library, bug reports, feature requests, or feedback on the library design.81 82In a nutshell, this means that everything that is **not** related to the **code of the Diffusers library** (including the documentation) should **not** be asked on GitHub, but rather on either the [forum](https://discuss.huggingface.co/c/discussion-related-to-httpsgithubcomhuggingfacediffusers/63) or [Discord](https://discord.gg/G7tWnz98XR).83 84**Please consider the following guidelines when opening a new issue**:85- Make sure you have searched whether your issue has already been asked before (use the search bar on GitHub under Issues).86- Please never report a new issue on another (related) issue. If another issue is highly related, please87open a new issue nevertheless and link to the related issue.88- Make sure your issue is written in English. Please use one of the great, free online translation services, such as [DeepL](https://www.deepl.com/translator) to translate from your native language to English if you are not comfortable in English.89- Check whether your issue might be solved by updating to the newest Diffusers version. Before posting your issue, please make sure that `python -c "import diffusers; print(diffusers.__version__)"` is higher or matches the latest Diffusers version.90- Remember that the more effort you put into opening a new issue, the higher the quality of your answer will be and the better the overall quality of the Diffusers issues.91 92New issues usually include the following.93 94#### 2.1. Reproducible, minimal bug reports.95 96A bug report should always have a reproducible code snippet and be as minimal and concise as possible.97This means in more detail:98- Narrow the bug down as much as you can, **do not just dump your whole code file**99- Format your code100- Do not include any external libraries except for Diffusers depending on them.101- **Always** provide all necessary information about your environment; for this, you can run: `diffusers-cli env` in your shell and copy-paste the displayed information to the issue.102- Explain the issue. If the reader doesn't know what the issue is and why it is an issue, she cannot solve it.103- **Always** make sure the reader can reproduce your issue with as little effort as possible. If your code snippet cannot be run because of missing libraries or undefined variables, the reader cannot help you. Make sure your reproducible code snippet is as minimal as possible and can be copy-pasted into a simple Python shell.104- If in order to reproduce your issue a model and/or dataset is required, make sure the reader has access to that model or dataset. You can always upload your model or dataset to the [Hub](https://huggingface.co) to make it easily downloadable. Try to keep your model and dataset as small as possible, to make the reproduction of your issue as effortless as possible.105 106For more information, please have a look through the [How to write a good issue](#how-to-write-a-good-issue) section.107 108You can open a bug report [here](https://github.com/huggingface/diffusers/issues/new/choose).109 110#### 2.2. Feature requests.111 112A world-class feature request addresses the following points:113 1141. Motivation first:115* Is it related to a problem/frustration with the library? If so, please explain116why. Providing a code snippet that demonstrates the problem is best.117* Is it related to something you would need for a project? We'd love to hear118about it!119* Is it something you worked on and think could benefit the community?120Awesome! Tell us what problem it solved for you.1212. Write a *full paragraph* describing the feature;1223. Provide a **code snippet** that demonstrates its future use;1234. In case this is related to a paper, please attach a link;1245. Attach any additional information (drawings, screenshots, etc.) you think may help.125 126You can open a feature request [here](https://github.com/huggingface/diffusers/issues/new?assignees=&labels=&template=feature_request.md&title=).127 128#### 2.3 Feedback. 129 130Feedback about the library design and why it is good or not good helps the core maintainers immensely to build a user-friendly library. To understand the philosophy behind the current design philosophy, please have a look [here](https://huggingface.co/docs/diffusers/conceptual/philosophy). If you feel like a certain design choice does not fit with the current design philosophy, please explain why and how it should be changed. If a certain design choice follows the design philosophy too much, hence restricting use cases, explain why and how it should be changed.131If a certain design choice is very useful for you, please also leave a note as this is great feedback for future design decisions.132 133You can open an issue about feedback [here](https://github.com/huggingface/diffusers/issues/new?assignees=&labels=&template=feedback.md&title=).134 135#### 2.4 Technical questions. 136 137Technical questions are mainly about why certain code of the library was written in a certain way, or what a certain part of the code does. Please make sure to link to the code in question and please provide detail on138why this part of the code is difficult to understand.139 140You can open an issue about a technical question [here](https://github.com/huggingface/diffusers/issues/new?assignees=&labels=bug&template=bug-report.yml).141 142#### 2.5 Proposal to add a new model, scheduler, or pipeline.143 144If the diffusion model community released a new model, pipeline, or scheduler that you would like to see in the Diffusers library, please provide the following information:145 146* Short description of the diffusion pipeline, model, or scheduler and link to the paper or public release.147* Link to any of its open-source implementation.148* Link to the model weights if they are available.149 150If you are willing to contribute to the model yourself, let us know so we can best guide you. Also, don't forget151to tag the original author of the component (model, scheduler, pipeline, etc.) by GitHub handle if you can find it.152 153You can open a request for a model/pipeline/scheduler [here](https://github.com/huggingface/diffusers/issues/new?assignees=&labels=New+model%2Fpipeline%2Fscheduler&template=new-model-addition.yml).154 155### 3. Answering issues on the GitHub issues tab156 157Answering issues on GitHub might require some technical knowledge of Diffusers, but we encourage everybody to give it a try even if you are not 100% certain that your answer is correct.158Some tips to give a high-quality answer to an issue:159- Be as concise and minimal as possible160- Stay on topic. An answer to the issue should concern the issue and only the issue.161- Provide links to code, papers, or other sources that prove or encourage your point.162- Answer in code. If a simple code snippet is the answer to the issue or shows how the issue can be solved, please provide a fully reproducible code snippet.163 164Also, many issues tend to be simply off-topic, duplicates of other issues, or irrelevant. It is of great165help to the maintainers if you can answer such issues, encouraging the author of the issue to be166more precise, provide the link to a duplicated issue or redirect them to [the forum](https://discuss.huggingface.co/c/discussion-related-to-httpsgithubcomhuggingfacediffusers/63) or [Discord](https://discord.gg/G7tWnz98XR)167 168If you have verified that the issued bug report is correct and requires a correction in the source code,169please have a look at the next sections.170 171For all of the following contributions, you will need to open a PR. It is explained in detail how to do so in the [Opening a pull requst](#how-to-open-a-pr) section.172 173### 4. Fixing a "Good first issue"174 175*Good first issues* are marked by the [Good first issue](https://github.com/huggingface/diffusers/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22) label. Usually, the issue already176explains how a potential solution should look so that it is easier to fix.177If the issue hasn't been closed and you would like to try to fix this issue, you can just leave a message "I would like to try this issue.". There are usually three scenarios:178- a.) The issue description already proposes a fix. In this case and if the solution makes sense to you, you can open a PR or draft PR to fix it.179- b.) The issue description does not propose a fix. In this case, you can ask what a proposed fix could look like and someone from the Diffusers team should answer shortly. If you have a good idea of how to fix it, feel free to directly open a PR.180- c.) There is already an open PR to fix the issue, but the issue hasn't been closed yet. If the PR has gone stale, you can simply open a new PR and link to the stale PR. PRs often go stale if the original contributor who wanted to fix the issue suddenly cannot find the time anymore to proceed. This often happens in open-source and is very normal. In this case, the community will be very happy if you give it a new try and leverage the knowledge of the existing PR. If there is already a PR and it is active, you can help the author by giving suggestions, reviewing the PR or even asking whether you can contribute to the PR.181 182 183### 5. Contribute to the documentation184 185A good library **always** has good documentation! The official documentation is often one of the first points of contact for new users of the library, and therefore contributing to the documentation is a **highly186valuable contribution**.187 188Contributing to the library can have many forms:189 190- Correcting spelling or grammatical errors.191- Correct incorrect formatting of the docstring. If you see that the official documentation is weirdly displayed or a link is broken, we are very happy if you take some time to correct it.192- Correct the shape or dimensions of a docstring input or output tensor.193- Clarify documentation that is hard to understand or incorrect.194- Update outdated code examples.195- Translating the documentation to another language.196 197Anything displayed on [the official Diffusers doc page](https://huggingface.co/docs/diffusers/index) is part of the official documentation and can be corrected, adjusted in the respective [documentation source](https://github.com/huggingface/diffusers/tree/main/docs/source).198 199Please have a look at [this page](https://github.com/huggingface/diffusers/tree/main/docs) on how to verify changes made to the documentation locally.200 201 202### 6. Contribute a community pipeline203 204[Pipelines](https://huggingface.co/docs/diffusers/api/pipelines/overview) are usually the first point of contact between the Diffusers library and the user.205Pipelines are examples of how to use Diffusers [models](https://huggingface.co/docs/diffusers/api/models) and [schedulers](https://huggingface.co/docs/diffusers/api/schedulers/overview).206We support two types of pipelines:207 208- Official Pipelines209- Community Pipelines210 211Both official and community pipelines follow the same design and consist of the same type of components.212 213Official pipelines are tested and maintained by the core maintainers of Diffusers. Their code214resides in [src/diffusers/pipelines](https://github.com/huggingface/diffusers/tree/main/src/diffusers/pipelines).215In contrast, community pipelines are contributed and maintained purely by the **community** and are **not** tested.216They reside in [examples/community](https://github.com/huggingface/diffusers/tree/main/examples/community) and while they can be accessed via the [PyPI diffusers package](https://pypi.org/project/diffusers/), their code is not part of the PyPI distribution.217 218The reason for the distinction is that the core maintainers of the Diffusers library cannot maintain and test all219possible ways diffusion models can be used for inference, but some of them may be of interest to the community.220Officially released diffusion pipelines,221such as Stable Diffusion are added to the core src/diffusers/pipelines package which ensures222high quality of maintenance, no backward-breaking code changes, and testing.223More bleeding edge pipelines should be added as community pipelines. If usage for a community pipeline is high, the pipeline can be moved to the official pipelines upon request from the community. This is one of the ways we strive to be a community-driven library.224 225To add a community pipeline, one should add a <name-of-the-community>.py file to [examples/community](https://github.com/huggingface/diffusers/tree/main/examples/community) and adapt the [examples/community/README.md](https://github.com/huggingface/diffusers/tree/main/examples/community/README.md) to include an example of the new pipeline.226 227An example can be seen [here](https://github.com/huggingface/diffusers/pull/2400).228 229Community pipeline PRs are only checked at a superficial level and ideally they should be maintained by their original authors.230 231Contributing a community pipeline is a great way to understand how Diffusers models and schedulers work. Having contributed a community pipeline is usually the first stepping stone to contributing an official pipeline to the232core package.233 234### 7. Contribute to training examples235 236Diffusers examples are a collection of training scripts that reside in [examples](https://github.com/huggingface/diffusers/tree/main/examples).237 238We support two types of training examples:239 240- Official training examples241- Research training examples242 243Research training examples are located in [examples/research_projects](https://github.com/huggingface/diffusers/tree/main/examples/research_projects) whereas official training examples include all folders under [examples](https://github.com/huggingface/diffusers/tree/main/examples) except the `research_projects` and `community` folders.244The official training examples are maintained by the Diffusers' core maintainers whereas the research training examples are maintained by the community.245This is because of the same reasons put forward in [6. Contribute a community pipeline](#contribute-a-community-pipeline) for official pipelines vs. community pipelines: It is not feasible for the core maintainers to maintain all possible training methods for diffusion models.246If the Diffusers core maintainers and the community consider a certain training paradigm to be too experimental or not popular enough, the corresponding training code should be put in the `research_projects` folder and maintained by the author.247 248Both official training and research examples consist of a directory that contains one or more training scripts, a requirements.txt file, and a README.md file. In order for the user to make use of the249training examples, it is required to clone the repository:250 251```252git clone https://github.com/huggingface/diffusers253```254 255as well as to install all additional dependencies required for training:256 257```258pip install -r /examples/<your-example-folder>/requirements.txt259```260 261Therefore when adding an example, the `requirements.txt` file shall define all pip dependencies required for your training example so that once all those are installed, the user can run the example's training script. See, for example, the [DreamBooth `requirements.txt` file](https://github.com/huggingface/diffusers/blob/main/examples/dreambooth/requirements.txt).262 263Training examples of the Diffusers library should adhere to the following philosophy:264- All the code necessary to run the examples should be found in a single Python file265- One should be able to run the example from the command line with `python <your-example>.py --args`266- Examples should be kept simple and serve as **an example** on how to use Diffusers for training. The purpose of example scripts is **not** to create state-of-the-art diffusion models, but rather to reproduce known training schemes without adding too much custom logic. As a byproduct of this point, our examples also strive to serve as good educational materials.267 268To contribute an example, it is highly recommended to look at already existing examples such as [dreambooth](https://github.com/huggingface/diffusers/blob/main/examples/dreambooth/train_dreambooth.py) to get an idea of how they should look like.269We strongly advise contributors to make use of the [Accelerate library](https://github.com/huggingface/accelerate) as it's tightly integrated270with Diffusers.271Once an example script works, please make sure to add a comprehensive `README.md` that states how to use the example exactly. This README should include:272- An example command on how to run the example script as shown [here e.g.](https://github.com/huggingface/diffusers/tree/main/examples/dreambooth#running-locally-with-pytorch).273- A link to some training results (logs, models, ...) that show what the user can expect as shown [here e.g.](https://api.wandb.ai/report/patrickvonplaten/xm6cd5q5).274- If you are adding a non-official/research training example, **please don't forget** to add a sentence that you are maintaining this training example which includes your git handle as shown [here](https://github.com/huggingface/diffusers/tree/main/examples/research_projects/intel_opts#diffusers-examples-with-intel-optimizations).275 276If you are contributing to the official training examples, please also make sure to add a test to [examples/test_examples.py](https://github.com/huggingface/diffusers/blob/main/examples/test_examples.py). This is not necessary for non-official training examples.277 278### 8. Fixing a "Good second issue"279 280*Good second issues* are marked by the [Good second issue](https://github.com/huggingface/diffusers/issues?q=is%3Aopen+is%3Aissue+label%3A%22Good+second+issue%22) label. Good second issues are281usually more complicated to solve than [Good first issues](https://github.com/huggingface/diffusers/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22).282The issue description usually gives less guidance on how to fix the issue and requires283a decent understanding of the library by the interested contributor.284If you are interested in tackling a second good issue, feel free to open a PR to fix it and link the PR to the issue. If you see that a PR has already been opened for this issue but did not get merged, have a look to understand why it wasn't merged and try to open an improved PR.285Good second issues are usually more difficult to get merged compared to good first issues, so don't hesitate to ask for help from the core maintainers. If your PR is almost finished the core maintainers can also jump into your PR and commit to it in order to get it merged.286 287### 9. Adding pipelines, models, schedulers288 289Pipelines, models, and schedulers are the most important pieces of the Diffusers library.290They provide easy access to state-of-the-art diffusion technologies and thus allow the community to291build powerful generative AI applications.292 293By adding a new model, pipeline, or scheduler you might enable a new powerful use case for any of the user interfaces relying on Diffusers which can be of immense value for the whole generative AI ecosystem.294 295Diffusers has a couple of open feature requests for all three components - feel free to gloss over them296if you don't know yet what specific component you would like to add:297- [Model or pipeline](https://github.com/huggingface/diffusers/issues?q=is%3Aopen+is%3Aissue+label%3A%22New+pipeline%2Fmodel%22)298- [Scheduler](https://github.com/huggingface/diffusers/issues?q=is%3Aopen+is%3Aissue+label%3A%22New+scheduler%22)299 300Before adding any of the three components, it is strongly recommended that you give the [Philosophy guide](https://github.com/huggingface/diffusers/issues?q=is%3Aopen+is%3Aissue+label%3A%22Good+second+issue%22) a read to better understand the design of any of the three components. Please be aware that301we cannot merge model, scheduler, or pipeline additions that strongly diverge from our design philosophy302as it will lead to API inconsistencies. If you fundamentally disagree with a design choice, please303open a [Feedback issue](https://github.com/huggingface/diffusers/issues/new?assignees=&labels=&template=feedback.md&title=) instead so that it can be discussed whether a certain design304pattern/design choice shall be changed everywhere in the library and whether we shall update our design philosophy. Consistency across the library is very important for us.305 306Please make sure to add links to the original codebase/paper to the PR and ideally also ping the307original author directly on the PR so that they can follow the progress and potentially help with questions.308 309If you are unsure or stuck in the PR, don't hesitate to leave a message to ask for a first review or help.310 311## How to write a good issue312 313**The better your issue is written, the higher the chances that it will be quickly resolved.**314 3151. Make sure that you've used the correct template for your issue. You can pick between *Bug Report*, *Feature Request*, *Feedback about API Design*, *New model/pipeline/scheduler addition*, *Forum*, or a blank issue. Make sure to pick the correct one when opening [a new issue](https://github.com/huggingface/diffusers/issues/new/choose).3162. **Be precise**: Give your issue a fitting title. Try to formulate your issue description as simple as possible. The more precise you are when submitting an issue, the less time it takes to understand the issue and potentially solve it. Make sure to open an issue for one issue only and not for multiple issues. If you found multiple issues, simply open multiple issues. If your issue is a bug, try to be as precise as possible about what bug it is - you should not just write "Error in diffusers".3173. **Reproducibility**: No reproducible code snippet == no solution. If you encounter a bug, maintainers **have to be able to reproduce** it. Make sure that you include a code snippet that can be copy-pasted into a Python interpreter to reproduce the issue. Make sure that your code snippet works, *i.e.* that there are no missing imports or missing links to images, ... Your issue should contain an error message **and** a code snippet that can be copy-pasted without any changes to reproduce the exact same error message. If your issue is using local model weights or local data that cannot be accessed by the reader, the issue cannot be solved. If you cannot share your data or model, try to make a dummy model or dummy data.3184. **Minimalistic**: Try to help the reader as much as you can to understand the issue as quickly as possible by staying as concise as possible. Remove all code / all information that is irrelevant to the issue. If you have found a bug, try to create the easiest code example you can to demonstrate your issue, do not just dump your whole workflow into the issue as soon as you have found a bug. E.g., if you train a model and get an error at some point during the training, you should first try to understand what part of the training code is responsible for the error and try to reproduce it with a couple of lines. Try to use dummy data instead of full datasets.3195. Add links. If you are referring to a certain naming, method, or model make sure to provide a link so that the reader can better understand what you mean. If you are referring to a specific PR or issue, make sure to link it to your issue. Do not assume that the reader knows what you are talking about. The more links you add to your issue the better.3206. Formatting. Make sure to nicely format your issue by formatting code into Python code syntax, and error messages into normal code syntax. See the [official GitHub formatting docs](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax) for more information.3217. Think of your issue not as a ticket to be solved, but rather as a beautiful entry to a well-written encyclopedia. Every added issue is a contribution to publicly available knowledge. By adding a nicely written issue you not only make it easier for maintainers to solve your issue, but you are helping the whole community to better understand a certain aspect of the library.322 323## How to write a good PR324 3251. Be a chameleon. Understand existing design patterns and syntax and make sure your code additions flow seamlessly into the existing code base. Pull requests that significantly diverge from existing design patterns or user interfaces will not be merged.3262. Be laser focused. A pull request should solve one problem and one problem only. Make sure to not fall into the trap of "also fixing another problem while we're adding it". It is much more difficult to review pull requests that solve multiple, unrelated problems at once.3273. If helpful, try to add a code snippet that displays an example of how your addition can be used.3284. The title of your pull request should be a summary of its contribution.3295. If your pull request addresses an issue, please mention the issue number in330the pull request description to make sure they are linked (and people331consulting the issue know you are working on it);3326. To indicate a work in progress please prefix the title with `[WIP]`. These333are useful to avoid duplicated work, and to differentiate it from PRs ready334to be merged;3357. Try to formulate and format your text as explained in [How to write a good issue](#how-to-write-a-good-issue).3368. Make sure existing tests pass;3379. Add high-coverage tests. No quality testing = no merge.338- If you are adding new `@slow` tests, make sure they pass using339`RUN_SLOW=1 python -m pytest tests/test_my_new_model.py`.340CircleCI does not run the slow tests, but GitHub actions does every night!34110. All public methods must have informative docstrings that work nicely with markdown. See `[pipeline_latent_diffusion.py](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/latent_diffusion/pipeline_latent_diffusion.py)` for an example.34211. Due to the rapidly growing repository, it is important to make sure that no files that would significantly weigh down the repository are added. This includes images, videos, and other non-text files. We prefer to leverage a hf.co hosted `dataset` like343[`hf-internal-testing`](https://huggingface.co/hf-internal-testing) or [huggingface/documentation-images](https://huggingface.co/datasets/huggingface/documentation-images) to place these files.344If an external contribution, feel free to add the images to your PR and ask a Hugging Face member to migrate your images345to this dataset.346 347## How to open a PR348 349Before writing code, we strongly advise you to search through the existing PRs or350issues to make sure that nobody is already working on the same thing. If you are351unsure, it is always a good idea to open an issue to get some feedback.352 353You will need basic `git` proficiency to be able to contribute to354🧨 Diffusers. `git` is not the easiest tool to use but it has the greatest355manual. Type `git --help` in a shell and enjoy. If you prefer books, [Pro356Git](https://git-scm.com/book/en/v2) is a very good reference.357 358Follow these steps to start contributing ([supported Python versions](https://github.com/huggingface/diffusers/blob/main/setup.py#L244)):359 3601. Fork the [repository](https://github.com/huggingface/diffusers) by361clicking on the 'Fork' button on the repository's page. This creates a copy of the code362under your GitHub user account.363 3642. Clone your fork to your local disk, and add the base repository as a remote:365 366 ```bash367 $ git clone git@github.com:<your Github handle>/diffusers.git368 $ cd diffusers369 $ git remote add upstream https://github.com/huggingface/diffusers.git370 ```371 3723. Create a new branch to hold your development changes:373 374 ```bash375 $ git checkout -b a-descriptive-name-for-my-changes376 ```377 378**Do not** work on the `main` branch.379 3804. Set up a development environment by running the following command in a virtual environment:381 382 ```bash383 $ pip install -e ".[dev]"384 ```385 386If you have already cloned the repo, you might need to `git pull` to get the most recent changes in the387library.388 3895. Develop the features on your branch.390 391As you work on the features, you should make sure that the test suite392passes. You should run the tests impacted by your changes like this:393 394 ```bash395 $ pytest tests/<TEST_TO_RUN>.py396 ```397 398You can also run the full suite with the following command, but it takes399a beefy machine to produce a result in a decent amount of time now that400Diffusers has grown a lot. Here is the command for it:401 402 ```bash403 $ make test404 ```405 406🧨 Diffusers relies on `black` and `isort` to format its source code407consistently. After you make changes, apply automatic style corrections and code verifications408that can't be automated in one go with:409 410 ```bash411 $ make style412 ```413 414🧨 Diffusers also uses `ruff` and a few custom scripts to check for coding mistakes. Quality415control runs in CI, however, you can also run the same checks with:416 417 ```bash418 $ make quality419 ```420 421Once you're happy with your changes, add changed files using `git add` and422make a commit with `git commit` to record your changes locally:423 424 ```bash425 $ git add modified_file.py426 $ git commit427 ```428 429It is a good idea to sync your copy of the code with the original430repository regularly. This way you can quickly account for changes:431 432 ```bash433 $ git pull upstream main434 ```435 436Push the changes to your account using:437 438 ```bash439 $ git push -u origin a-descriptive-name-for-my-changes440 ```441 4426. Once you are satisfied, go to the443webpage of your fork on GitHub. Click on 'Pull request' to send your changes444to the project maintainers for review.445 4467. It's ok if maintainers ask you for changes. It happens to core contributors447too! So everyone can see the changes in the Pull request, work in your local448branch and push the changes to your fork. They will automatically appear in449the pull request.450 451### Tests452 453An extensive test suite is included to test the library behavior and several examples. Library tests can be found in454the [tests folder](https://github.com/huggingface/diffusers/tree/main/tests).455 456We like `pytest` and `pytest-xdist` because it's faster. From the root of the457repository, here's how to run tests with `pytest` for the library:458 459```bash460$ python -m pytest -n auto --dist=loadfile -s -v ./tests/461```462 463In fact, that's how `make test` is implemented!464 465You can specify a smaller set of tests in order to test only the feature466you're working on.467 468By default, slow tests are skipped. Set the `RUN_SLOW` environment variable to469`yes` to run them. This will download many gigabytes of models — make sure you470have enough disk space and a good Internet connection, or a lot of patience!471 472```bash473$ RUN_SLOW=yes python -m pytest -n auto --dist=loadfile -s -v ./tests/474```475 476`unittest` is fully supported, here's how to run tests with it:477 478```bash479$ python -m unittest discover -s tests -t . -v480$ python -m unittest discover -s examples -t examples -v481```482 483### Syncing forked main with upstream (HuggingFace) main484 485To avoid pinging the upstream repository which adds reference notes to each upstream PR and sends unnecessary notifications to the developers involved in these PRs,486when syncing the main branch of a forked repository, please, follow these steps:4871. When possible, avoid syncing with the upstream using a branch and PR on the forked repository. Instead, merge directly into the forked main.4882. If a PR is absolutely necessary, use the following steps after checking out your branch:489```490$ git checkout -b your-branch-for-syncing491$ git pull --squash --no-commit upstream main492$ git commit -m '<your message without GitHub references>'493$ git push --set-upstream origin your-branch-for-syncing494```495 496### Style guide497 498For documentation strings, 🧨 Diffusers follows the [google style](https://google.github.io/styleguide/pyguide.html).499 