text stringlengths 0 5.54k |
|---|
The predicted denoised sample (x_{0}) based on the model output from the current timestep. |
pred_original_sample can be used to preview progress or for guidance. Output class for the scheduler’s step function output. |
Diffusers 🤗 Diffusers is the go-to library for state-of-the-art pretrained diffusion models for generating images, audio, and even 3D structures of molecules. Whether you’re looking for a simple inference solution or want to train your own diffusion model, 🤗 Diffusers is a modular toolbox that supports both. Our libr... |
How to contribute to Diffusers 🧨 We ❤️ 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 b... |
the core library. In 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. Asking and answering questions on the Diffusers discussion forum or on Discord. Opening new issues on the GitHub Issues tab. Answering issues on th... |
In the following, we will explain each contribution a bit more in detail. For all contributions 4 - 9, you will need to open a PR. It is explained in detail how to do so in Opening a pull request. 1. Asking and answering questions on the Diffusers discussion forum or on the Diffusers Discord Any question or comment re... |
share knowledge and might very well help a beginner in the future who has the same question you’re |
having. Please do pose any questions you might have. |
In 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. Please keep in mind that the more effort you put into asking or answering a question, the higher |
the 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. |
In short, a high quality question or answer is precise, concise, relevant, easy-to-understand, accessible, and well-formated/well-posed. For more information, please have a look through the How to write a good issue section. NOTE about channels: |
The forum 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. |
In addition, questions and answers posted in the forum can easily be linked to. |
In contrast, Discord has a chat-like format that invites fast back-and-forth communication. |
While it will most likely take less time for you to get an answer to your question on Discord, your |
question 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... |
the problems they encounter. So thank you for reporting an issue. Remember, GitHub issues are reserved for technical questions directly related to the Diffusers library, bug reports, feature requests, or feedback on the library design. In a nutshell, this means that everything that is not related to the code of the Dif... |
open a new issue nevertheless and link to the related issue. Make sure your issue is written in English. Please use one of the great, free online translation services, such as DeepL to translate from your native language to English if you are not comfortable in English. Check whether your issue might be solved by updat... |
This means in more detail: Narrow the bug down as much as you can, do not just dump your whole code file. Format your code. Do not include any external libraries except for Diffusers depending on them. Always provide all necessary information about your environment; for this, you can run: diffusers-cli env in your shel... |
why. Providing a code snippet that demonstrates the problem is best. Is it related to something you would need for a project? We’d love to hear |
about it! Is it something you worked on and think could benefit the community? |
Awesome! Tell us what problem it solved for you. Write a full paragraph describing the feature; Provide a code snippet that demonstrates its future use; In case this is related to a paper, please attach a link; Attach any additional information (drawings, screenshots, etc.) you think may help. You can open a feature re... |
If a certain design choice is very useful for you, please also leave a note as this is great feedback for future design decisions. You can open an issue about feedback here. 2.4 Technical questions Technical questions are mainly about why certain code of the library was written in a certain way, or what a certain part... |
why this part of the code is difficult to understand. You can open an issue about a technical question here. 2.5 Proposal to add a new model, scheduler, or pipeline If the diffusion model community released a new model, pipeline, or scheduler that you would like to see in the Diffusers library, please provide the foll... |
to tag the original author of the component (model, scheduler, pipeline, etc.) by GitHub handle if you can find it. You can open a request for a model/pipeline/scheduler here. 3. Answering issues on the GitHub issues tab Answering issues on GitHub might require some technical knowledge of Diffusers, but we encourage e... |
Some tips to give a high-quality answer to an issue: Be as concise and minimal as possible. Stay on topic. An answer to the issue should concern the issue and only the issue. Provide links to code, papers, or other sources that prove or encourage your point. Answer in code. If a simple code snippet is the answer to the... |
help to the maintainers if you can answer such issues, encouraging the author of the issue to be |
more precise, provide the link to a duplicated issue or redirect them to the forum or Discord. If you have verified that the issued bug report is correct and requires a correction in the source code, |
please have a look at the next sections. For 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 request section. 4. Fixing a “Good first issue” Good first issues are marked by the Good first issue label. Usually, the issue already |
explains how a potential solution should look so that it is easier to fix. |
If 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: 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. ... |
valuable contribution. Contributing to the library can have many forms: Correcting spelling or grammatical errors. Correct incorrect formatting of the docstring. If you see that the official documentation is weirdly displayed or a link is broken, we would be very happy if you take some time to correct it. Correct the s... |
Pipelines are examples of how to use Diffusers models and schedulers. |
We support two types of pipelines: Official Pipelines Community Pipelines Both official and community pipelines follow the same design and consist of the same type of components. Official pipelines are tested and maintained by the core maintainers of Diffusers. Their code |
resides in src/diffusers/pipelines. |
In contrast, community pipelines are contributed and maintained purely by the community and are not tested. |
They reside in examples/community and while they can be accessed via the PyPI diffusers package, their code is not part of the PyPI distribution. The reason for the distinction is that the core maintainers of the Diffusers library cannot maintain and test all |
possible ways diffusion models can be used for inference, but some of them may be of interest to the community. |
Officially released diffusion pipelines, |
such as Stable Diffusion are added to the core src/diffusers/pipelines package which ensures |
high quality of maintenance, no backward-breaking code changes, and testing. |
More 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. To add a community pipeline, one should add a <name-of-... |
core package. 7. Contribute to training examples Diffusers examples are a collection of training scripts that reside in examples. We support two types of training examples: Official training examples Research training examples Research training examples are located in examples/research_projects whereas official traini... |
The official training examples are maintained by the Diffusers’ core maintainers whereas the research training examples are maintained by the community. |
This is because of the same reasons put forward in 6. 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. |
If 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. Both official training and research examples consist of a directory that cont... |
training examples, it is required to clone the repository: Copied git clone https://github.com/huggingface/diffusers as well as to install all additional dependencies required for training: Copied pip install -r /examples/<your-example-folder>/requirements.txt Therefore when adding an example, the requirements.txt ... |
We strongly advise contributors to make use of the Accelerate library as it’s tightly integrated |
with Diffusers. |
Once 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: An example command on how to run the example script as shown here. A link to some training results (logs, models, etc.) that show what the user can expect as shown here... |
usually more complicated to solve than Good first issues. |
The issue description usually gives less guidance on how to fix the issue and requires |
a decent understanding of the library by the interested contributor. |
If you are interested in tackling a good second 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. |
Good 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. 9. Adding pipelines, models, schedulers Pipel... |
They provide easy access to state-of-the-art diffusion technologies and thus allow the community to |
build powerful generative AI applications. By 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. Diffusers has a couple of open feature requests for all three compone... |
if you don’t know yet what specific component you would like to add: Model or pipeline Scheduler Before adding any of the three components, it is strongly recommended that you give the Philosophy guide a read to better understand the design of any of the three components. Please be aware that we cannot merge model, sch... |
as it will lead to API inconsistencies. If you fundamentally disagree with a design choice, please open a Feedback issue instead so that it can be discussed whether a certain design pattern/design choice shall be changed everywhere in the library and whether we shall update our design philosophy. Consistency across the... |
class AltDiffusionPipelineOutput(BaseOutput): |
""" |
Output class for Alt Diffusion pipelines. |
Args: |
images (`List[PIL.Image.Image]` or `np.ndarray`) |
List of denoised PIL images of length `batch_size` or NumPy array of shape `(batch_size, height, width, |
num_channels)`. |
nsfw_content_detected (`List[bool]`) |
List indicating whether the corresponding generated image contains "not-safe-for-work" (nsfw) content or |
`None` if safety checking could not be performed. |
""" To learn more, read this section of the ~Don’t~ Repeat Yourself* blog post. How to write a good issue The better your issue is written, the higher the chances that it will be quickly resolved. Make sure that you’ve used the correct template for your issue. You can pick between Bug Report, Feature Request, Feed... |
the pull request description to make sure they are linked (and people |
consulting the issue know you are working on it); To indicate a work in progress please prefix the title with [WIP]. These |
are useful to avoid duplicated work, and to differentiate it from PRs ready |
to be merged; Try to formulate and format your text as explained in How to write a good issue. Make sure existing tests pass; Add high-coverage tests. No quality testing = no merge. If you are adding new @slow tests, make sure they pass using |
RUN_SLOW=1 python -m pytest tests/test_my_new_model.py. |
CircleCI does not run the slow tests, but GitHub Actions does every night! All public methods must have informative docstrings that work nicely with markdown. See pipeline_latent_diffusion.py for an example. Due to the rapidly growing repository, it is important to make sure that no files that would significantly weigh... |
hf-internal-testing or huggingface/documentation-images to place these files. |
If an external contribution, feel free to add the images to your PR and ask a Hugging Face member to migrate your images |
to this dataset. How to open a PR Before writing code, we strongly advise you to search through the existing PRs or |
issues to make sure that nobody is already working on the same thing. If you are |
unsure, it is always a good idea to open an issue to get some feedback. You will need basic git proficiency to be able to contribute to |
🧨 Diffusers. git is not the easiest tool to use but it has the greatest |
manual. Type git --help in a shell and enjoy. If you prefer books, Pro |
Git is a very good reference. Follow these steps to start contributing (supported Python versions): Fork the repository by |
clicking on the ‘Fork’ button on the repository’s page. This creates a copy of the code |
under your GitHub user account. Clone your fork to your local disk, and add the base repository as a remote: Copied $ git clone git@github.com:<your GitHub handle>/diffusers.git |
$ cd diffusers |
$ git remote add upstream https://github.com/huggingface/diffusers.git Create a new branch to hold your development changes: Copied $ git checkout -b a-descriptive-name-for-my-changes Do not work on the main branch. Set up a development environment by running the following command in a virtual environment: Copied $... |
library. Develop the features on your branch. As you work on the features, you should make sure that the test suite |
passes. You should run the tests impacted by your changes like this: Copied $ pytest tests/<TEST_TO_RUN>.py Before you run the tests, please make sure you install the dependencies required for testing. You can do so |
with this command: Copied $ pip install -e ".[test]" You can also run the full test suite with the following command, but it takes |
a beefy machine to produce a result in a decent amount of time now that |
Diffusers has grown a lot. Here is the command for it: Copied $ make test 🧨 Diffusers relies on black and isort to format its source code |
consistently. After you make changes, apply automatic style corrections and code verifications |
that can’t be automated in one go with: Copied $ make style 🧨 Diffusers also uses ruff and a few custom scripts to check for coding mistakes. Quality |
control runs in CI, however, you can also run the same checks with: Copied $ make quality Once you’re happy with your changes, add changed files using git add and |
make a commit with git commit to record your changes locally: Copied $ git add modified_file.py |
$ git commit -m "A descriptive message about your changes." It is a good idea to sync your copy of the code with the original |
repository regularly. This way you can quickly account for changes: Copied $ git pull upstream main Push the changes to your account using: Copied $ git push -u origin a-descriptive-name-for-my-changes Once you are satisfied, go to the |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.