source
stringclasses
273 values
url
stringlengths
47
172
file_type
stringclasses
1 value
chunk
stringlengths
1
512
chunk_id
stringlengths
5
9
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/contribution.md
https://huggingface.co/docs/diffusers/en/conceptual/contribution/#how-to-write-a-good-issue
.md
4. **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
39_18_4
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/contribution.md
https://huggingface.co/docs/diffusers/en/conceptual/contribution/#how-to-write-a-good-issue
.md
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.
39_18_5
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/contribution.md
https://huggingface.co/docs/diffusers/en/conceptual/contribution/#how-to-write-a-good-issue
.md
5. 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.
39_18_6
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/contribution.md
https://huggingface.co/docs/diffusers/en/conceptual/contribution/#how-to-write-a-good-issue
.md
6. 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.
39_18_7
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/contribution.md
https://huggingface.co/docs/diffusers/en/conceptual/contribution/#how-to-write-a-good-issue
.md
7. 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.
39_18_8
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/contribution.md
https://huggingface.co/docs/diffusers/en/conceptual/contribution/#how-to-write-a-good-pr
.md
1. 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.
39_19_0
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/contribution.md
https://huggingface.co/docs/diffusers/en/conceptual/contribution/#how-to-write-a-good-pr
.md
2. 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. 3. If helpful, try to add a code snippet that displays an example of how your addition can be used. 4. The title of your pull request should be a summary of its contribution.
39_19_1
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/contribution.md
https://huggingface.co/docs/diffusers/en/conceptual/contribution/#how-to-write-a-good-pr
.md
4. The title of your pull request should be a summary of its contribution. 5. If your pull request addresses an issue, please mention the issue number in the pull request description to make sure they are linked (and people consulting the issue know you are working on it); 6. 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;
39_19_2
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/contribution.md
https://huggingface.co/docs/diffusers/en/conceptual/contribution/#how-to-write-a-good-pr
.md
are useful to avoid duplicated work, and to differentiate it from PRs ready to be merged; 7. Try to formulate and format your text as explained in [How to write a good issue](#how-to-write-a-good-issue). 8. Make sure existing tests pass; 9. 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!
39_19_3
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/contribution.md
https://huggingface.co/docs/diffusers/en/conceptual/contribution/#how-to-write-a-good-pr
.md
CircleCI does not run the slow tests, but GitHub Actions does every night! 10. 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.
39_19_4
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/contribution.md
https://huggingface.co/docs/diffusers/en/conceptual/contribution/#how-to-write-a-good-pr
.md
11. 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` like [`hf-internal-testing`](https://huggingface.co/hf-internal-testing) or [huggingface/documentation-images](https://huggingface.co/datasets/huggingface/documentation-images) to place these files.
39_19_5
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/contribution.md
https://huggingface.co/docs/diffusers/en/conceptual/contribution/#how-to-write-a-good-pr
.md
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.
39_19_6
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/contribution.md
https://huggingface.co/docs/diffusers/en/conceptual/contribution/#how-to-open-a-pr
.md
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
39_20_0
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/contribution.md
https://huggingface.co/docs/diffusers/en/conceptual/contribution/#how-to-open-a-pr
.md
manual. Type `git --help` in a shell and enjoy. If you prefer books, [Pro Git](https://git-scm.com/book/en/v2) is a very good reference. Follow these steps to start contributing ([supported Python versions](https://github.com/huggingface/diffusers/blob/83bc6c94eaeb6f7704a2a428931cf2d9ad973ae9/setup.py#L270)): 1. Fork the [repository](https://github.com/huggingface/diffusers) by clicking on the 'Fork' button on the repository's page. This creates a copy of the code under your GitHub user account.
39_20_1
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/contribution.md
https://huggingface.co/docs/diffusers/en/conceptual/contribution/#how-to-open-a-pr
.md
clicking on the 'Fork' button on the repository's page. This creates a copy of the code under your GitHub user account. 2. Clone your fork to your local disk, and add the base repository as a remote: ```bash $ git clone git@github.com:<your GitHub handle>/diffusers.git $ cd diffusers $ git remote add upstream https://github.com/huggingface/diffusers.git ``` 3. Create a new branch to hold your development changes: ```bash $ git checkout -b a-descriptive-name-for-my-changes ```
39_20_2
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/contribution.md
https://huggingface.co/docs/diffusers/en/conceptual/contribution/#how-to-open-a-pr
.md
3. Create a new branch to hold your development changes: ```bash $ git checkout -b a-descriptive-name-for-my-changes ``` **Do not** work on the `main` branch. 4. Set up a development environment by running the following command in a virtual environment: ```bash $ pip install -e ".[dev]" ``` If you have already cloned the repo, you might need to `git pull` to get the most recent changes in the library. 5. Develop the features on your branch.
39_20_3
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/contribution.md
https://huggingface.co/docs/diffusers/en/conceptual/contribution/#how-to-open-a-pr
.md
library. 5. 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: ```bash $ 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: ```bash $ pip install -e ".[test]" ``` You can also run the full test suite with the following command, but it takes
39_20_4
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/contribution.md
https://huggingface.co/docs/diffusers/en/conceptual/contribution/#how-to-open-a-pr
.md
```bash $ 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: ```bash $ 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: ```bash $ make style ```
39_20_5
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/contribution.md
https://huggingface.co/docs/diffusers/en/conceptual/contribution/#how-to-open-a-pr
.md
that can't be automated in one go with: ```bash $ 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: ```bash $ 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: ```bash $ git add modified_file.py $ git commit -m "A descriptive message about your changes." ```
39_20_6
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/contribution.md
https://huggingface.co/docs/diffusers/en/conceptual/contribution/#how-to-open-a-pr
.md
```bash $ 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: ```bash $ git pull upstream main ``` Push the changes to your account using: ```bash $ git push -u origin a-descriptive-name-for-my-changes ``` 6. Once you are satisfied, go to the webpage of your fork on GitHub. Click on 'Pull request' to send your changes
39_20_7
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/contribution.md
https://huggingface.co/docs/diffusers/en/conceptual/contribution/#how-to-open-a-pr
.md
``` 6. Once you are satisfied, go to the webpage of your fork on GitHub. Click on 'Pull request' to send your changes to the project maintainers for review. 7. It's OK if maintainers ask you for changes. It happens to core contributors too! So everyone can see the changes in the Pull request, work in your local branch and push the changes to your fork. They will automatically appear in the pull request.
39_20_8
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/contribution.md
https://huggingface.co/docs/diffusers/en/conceptual/contribution/#tests
.md
An extensive test suite is included to test the library behavior and several examples. Library tests can be found in the [tests folder](https://github.com/huggingface/diffusers/tree/main/tests). We like `pytest` and `pytest-xdist` because it's faster. From the root of the repository, here's how to run tests with `pytest` for the library: ```bash $ python -m pytest -n auto --dist=loadfile -s -v ./tests/ ``` In fact, that's how `make test` is implemented!
39_21_0
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/contribution.md
https://huggingface.co/docs/diffusers/en/conceptual/contribution/#tests
.md
```bash $ python -m pytest -n auto --dist=loadfile -s -v ./tests/ ``` In fact, that's how `make test` is implemented! You can specify a smaller set of tests in order to test only the feature you're working on. By default, slow tests are skipped. Set the `RUN_SLOW` environment variable to `yes` to run them. This will download many gigabytes of models — make sure you have enough disk space and a good Internet connection, or a lot of patience! ```bash
39_21_1
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/contribution.md
https://huggingface.co/docs/diffusers/en/conceptual/contribution/#tests
.md
have enough disk space and a good Internet connection, or a lot of patience! ```bash $ RUN_SLOW=yes python -m pytest -n auto --dist=loadfile -s -v ./tests/ ``` `unittest` is fully supported, here's how to run tests with it: ```bash $ python -m unittest discover -s tests -t . -v $ python -m unittest discover -s examples -t examples -v ```
39_21_2
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/contribution.md
https://huggingface.co/docs/diffusers/en/conceptual/contribution/#syncing-forked-main-with-upstream-huggingface-main
.md
To avoid pinging the upstream repository which adds reference notes to each upstream PR and sends unnecessary notifications to the developers involved in these PRs, when syncing the main branch of a forked repository, please, follow these steps: 1. When possible, avoid syncing with the upstream using a branch and PR on the forked repository. Instead, merge directly into the forked main. 2. If a PR is absolutely necessary, use the following steps after checking out your branch: ```bash
39_22_0
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/contribution.md
https://huggingface.co/docs/diffusers/en/conceptual/contribution/#syncing-forked-main-with-upstream-huggingface-main
.md
2. If a PR is absolutely necessary, use the following steps after checking out your branch: ```bash $ git checkout -b your-branch-for-syncing $ git pull --squash --no-commit upstream main $ git commit -m '<your message without GitHub references>' $ git push --set-upstream origin your-branch-for-syncing ```
39_22_1
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/contribution.md
https://huggingface.co/docs/diffusers/en/conceptual/contribution/#style-guide
.md
For documentation strings, 🧨 Diffusers follows the [Google style](https://google.github.io/styleguide/pyguide.html).
39_23_0
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/ethical_guidelines.md
https://huggingface.co/docs/diffusers/en/conceptual/ethical_guidelines/
.md
<!--Copyright 2024 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
40_0_0
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/ethical_guidelines.md
https://huggingface.co/docs/diffusers/en/conceptual/ethical_guidelines/
.md
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -->
40_0_1
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/ethical_guidelines.md
https://huggingface.co/docs/diffusers/en/conceptual/ethical_guidelines/#preamble
.md
[Diffusers](https://huggingface.co/docs/diffusers/index) provides pre-trained diffusion models and serves as a modular toolbox for inference and training. Given its real case applications in the world and potential negative impacts on society, we think it is important to provide the project with ethical guidelines to guide the development, users’ contributions, and usage of the Diffusers library.
40_1_0
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/ethical_guidelines.md
https://huggingface.co/docs/diffusers/en/conceptual/ethical_guidelines/#preamble
.md
The risks associated with using this technology are still being examined, but to name a few: copyrights issues for artists; deep-fake exploitation; sexual content generation in inappropriate contexts; non-consensual impersonation; harmful social biases perpetuating the oppression of marginalized groups. We will keep tracking risks and adapt the following guidelines based on the community's responsiveness and valuable feedback.
40_1_1
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/ethical_guidelines.md
https://huggingface.co/docs/diffusers/en/conceptual/ethical_guidelines/#scope
.md
The Diffusers community will apply the following ethical guidelines to the project’s development and help coordinate how the community will integrate the contributions, especially concerning sensitive topics related to ethical concerns.
40_2_0
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/ethical_guidelines.md
https://huggingface.co/docs/diffusers/en/conceptual/ethical_guidelines/#ethical-guidelines
.md
The following ethical guidelines apply generally, but we will primarily implement them when dealing with ethically sensitive issues while making a technical choice. Furthermore, we commit to adapting those ethical principles over time following emerging harms related to the state of the art of the technology in question. - **Transparency**: we are committed to being transparent in managing PRs, explaining our choices to users, and making technical decisions.
40_3_0
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/ethical_guidelines.md
https://huggingface.co/docs/diffusers/en/conceptual/ethical_guidelines/#ethical-guidelines
.md
- **Consistency**: we are committed to guaranteeing our users the same level of attention in project management, keeping it technically stable and consistent. - **Simplicity**: with a desire to make it easy to use and exploit the Diffusers library, we are committed to keeping the project’s goals lean and coherent.
40_3_1
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/ethical_guidelines.md
https://huggingface.co/docs/diffusers/en/conceptual/ethical_guidelines/#ethical-guidelines
.md
- **Accessibility**: the Diffusers project helps lower the entry bar for contributors who can help run it even without technical expertise. Doing so makes research artifacts more accessible to the community. - **Reproducibility**: we aim to be transparent about the reproducibility of upstream code, models, and datasets when made available through the Diffusers library.
40_3_2
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/ethical_guidelines.md
https://huggingface.co/docs/diffusers/en/conceptual/ethical_guidelines/#ethical-guidelines
.md
- **Responsibility**: as a community and through teamwork, we hold a collective responsibility to our users by anticipating and mitigating this technology's potential risks and dangers.
40_3_3
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/ethical_guidelines.md
https://huggingface.co/docs/diffusers/en/conceptual/ethical_guidelines/#examples-of-implementations-safety-features-and-mechanisms
.md
The team works daily to make the technical and non-technical tools available to deal with the potential ethical and social risks associated with diffusion technology. Moreover, the community's input is invaluable in ensuring these features' implementation and raising awareness with us. - [**Community tab**](https://huggingface.co/docs/hub/repositories-pull-requests-discussions): it enables the community to discuss and better collaborate on a project.
40_4_0
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/ethical_guidelines.md
https://huggingface.co/docs/diffusers/en/conceptual/ethical_guidelines/#examples-of-implementations-safety-features-and-mechanisms
.md
- **Bias exploration and evaluation**: the Hugging Face team provides a [space](https://huggingface.co/spaces/society-ethics/DiffusionBiasExplorer) to demonstrate the biases in Stable Diffusion interactively. In this sense, we support and encourage bias explorers and evaluations. - **Encouraging safety in deployment**
40_4_1
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/ethical_guidelines.md
https://huggingface.co/docs/diffusers/en/conceptual/ethical_guidelines/#examples-of-implementations-safety-features-and-mechanisms
.md
- **Encouraging safety in deployment** - [**Safe Stable Diffusion**](https://huggingface.co/docs/diffusers/main/en/api/pipelines/stable_diffusion/stable_diffusion_safe): It mitigates the well-known issue that models, like Stable Diffusion, that are trained on unfiltered, web-crawled datasets tend to suffer from inappropriate degeneration. Related paper: [Safe Latent Diffusion: Mitigating Inappropriate Degeneration in Diffusion Models](https://arxiv.org/abs/2211.05105).
40_4_2
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/ethical_guidelines.md
https://huggingface.co/docs/diffusers/en/conceptual/ethical_guidelines/#examples-of-implementations-safety-features-and-mechanisms
.md
- [**Safety Checker**](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion/safety_checker.py): It checks and compares the class probability of a set of hard-coded harmful concepts in the embedding space against an image after it has been generated. The harmful concepts are intentionally hidden to prevent reverse engineering of the checker.
40_4_3
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/ethical_guidelines.md
https://huggingface.co/docs/diffusers/en/conceptual/ethical_guidelines/#examples-of-implementations-safety-features-and-mechanisms
.md
- **Staged released on the Hub**: in particularly sensitive situations, access to some repositories should be restricted. This staged release is an intermediary step that allows the repository’s authors to have more control over its use. - **Licensing**: [OpenRAILs](https://huggingface.co/blog/open_rail), a new type of licensing, allow us to ensure free access while having a set of restrictions that ensure more responsible use.
40_4_4
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/philosophy.md
https://huggingface.co/docs/diffusers/en/conceptual/philosophy/
.md
<!--Copyright 2024 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
41_0_0
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/philosophy.md
https://huggingface.co/docs/diffusers/en/conceptual/philosophy/
.md
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -->
41_0_1
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/philosophy.md
https://huggingface.co/docs/diffusers/en/conceptual/philosophy/#philosophy
.md
🧨 Diffusers provides **state-of-the-art** pretrained diffusion models across multiple modalities. Its purpose is to serve as a **modular toolbox** for both inference and training. We aim at building a library that stands the test of time and therefore take API design very seriously.
41_1_0
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/philosophy.md
https://huggingface.co/docs/diffusers/en/conceptual/philosophy/#philosophy
.md
We aim at building a library that stands the test of time and therefore take API design very seriously. In a nutshell, Diffusers is built to be a natural extension of PyTorch. Therefore, most of our design choices are based on [PyTorch's Design Principles](https://pytorch.org/docs/stable/community/design.html#pytorch-design-philosophy). Let's go over the most important ones:
41_1_1
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/philosophy.md
https://huggingface.co/docs/diffusers/en/conceptual/philosophy/#usability-over-performance
.md
- While Diffusers has many built-in performance-enhancing features (see [Memory and Speed](https://huggingface.co/docs/diffusers/optimization/fp16)), models are always loaded with the highest precision and lowest optimization. Therefore, by default diffusion pipelines are always instantiated on CPU with float32 precision if not otherwise defined by the user. This ensures usability across different platforms and accelerators and means that no complex installations are required to run the library.
41_2_0
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/philosophy.md
https://huggingface.co/docs/diffusers/en/conceptual/philosophy/#usability-over-performance
.md
- Diffusers aims to be a **light-weight** package and therefore has very few required dependencies, but many soft dependencies that can improve performance (such as `accelerate`, `safetensors`, `onnx`, etc...). We strive to keep the library as lightweight as possible so that it can be added without much concern as a dependency on other packages.
41_2_1
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/philosophy.md
https://huggingface.co/docs/diffusers/en/conceptual/philosophy/#usability-over-performance
.md
- Diffusers prefers simple, self-explainable code over condensed, magic code. This means that short-hand code syntaxes such as lambda functions, and advanced PyTorch operators are often not desired.
41_2_2
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/philosophy.md
https://huggingface.co/docs/diffusers/en/conceptual/philosophy/#simple-over-easy
.md
As PyTorch states, **explicit is better than implicit** and **simple is better than complex**. This design philosophy is reflected in multiple parts of the library: - We follow PyTorch's API with methods like [`DiffusionPipeline.to`](https://huggingface.co/docs/diffusers/main/en/api/diffusion_pipeline#diffusers.DiffusionPipeline.to) to let the user handle device management.
41_3_0
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/philosophy.md
https://huggingface.co/docs/diffusers/en/conceptual/philosophy/#simple-over-easy
.md
- Raising concise error messages is preferred to silently correct erroneous input. Diffusers aims at teaching the user, rather than making the library as easy to use as possible.
41_3_1
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/philosophy.md
https://huggingface.co/docs/diffusers/en/conceptual/philosophy/#simple-over-easy
.md
- Complex model vs. scheduler logic is exposed instead of magically handled inside. Schedulers/Samplers are separated from diffusion models with minimal dependencies on each other. This forces the user to write the unrolled denoising loop. However, the separation allows for easier debugging and gives the user more control over adapting the denoising process or switching out diffusion models or schedulers.
41_3_2
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/philosophy.md
https://huggingface.co/docs/diffusers/en/conceptual/philosophy/#simple-over-easy
.md
- Separately trained components of the diffusion pipeline, *e.g.* the text encoder, the unet, and the variational autoencoder, each have their own model class. This forces the user to handle the interaction between the different model components, and the serialization format separates the model components into different files. However, this allows for easier debugging and customization. DreamBooth or Textual Inversion training
41_3_3
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/philosophy.md
https://huggingface.co/docs/diffusers/en/conceptual/philosophy/#simple-over-easy
.md
is very simple thanks to Diffusers' ability to separate single components of the diffusion pipeline.
41_3_4
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/philosophy.md
https://huggingface.co/docs/diffusers/en/conceptual/philosophy/#tweakable-contributor-friendly-over-abstraction
.md
For large parts of the library, Diffusers adopts an important design principle of the [Transformers library](https://github.com/huggingface/transformers), which is to prefer copy-pasted code over hasty abstractions. This design principle is very opinionated and stands in stark contrast to popular design principles such as [Don't repeat yourself (DRY)](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself).
41_4_0
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/philosophy.md
https://huggingface.co/docs/diffusers/en/conceptual/philosophy/#tweakable-contributor-friendly-over-abstraction
.md
In short, just like Transformers does for modeling files, Diffusers prefers to keep an extremely low level of abstraction and very self-contained code for pipelines and schedulers. Functions, long code blocks, and even classes can be copied across multiple files which at first can look like a bad, sloppy design choice that makes the library unmaintainable.
41_4_1
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/philosophy.md
https://huggingface.co/docs/diffusers/en/conceptual/philosophy/#tweakable-contributor-friendly-over-abstraction
.md
**However**, this design has proven to be extremely successful for Transformers and makes a lot of sense for community-driven, open-source machine learning libraries because: - Machine Learning is an extremely fast-moving field in which paradigms, model architectures, and algorithms are changing rapidly, which therefore makes it very difficult to define long-lasting code abstractions.
41_4_2
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/philosophy.md
https://huggingface.co/docs/diffusers/en/conceptual/philosophy/#tweakable-contributor-friendly-over-abstraction
.md
- Machine Learning practitioners like to be able to quickly tweak existing code for ideation and research and therefore prefer self-contained code over one that contains many abstractions.
41_4_3
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/philosophy.md
https://huggingface.co/docs/diffusers/en/conceptual/philosophy/#tweakable-contributor-friendly-over-abstraction
.md
- Open-source libraries rely on community contributions and therefore must build a library that is easy to contribute to. The more abstract the code, the more dependencies, the harder to read, and the harder to contribute to. Contributors simply stop contributing to very abstract libraries out of fear of breaking vital functionality. If contributing to a library cannot break other fundamental code, not only is it more inviting for potential new contributors, but it is also easier to review and contribute
41_4_4
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/philosophy.md
https://huggingface.co/docs/diffusers/en/conceptual/philosophy/#tweakable-contributor-friendly-over-abstraction
.md
fundamental code, not only is it more inviting for potential new contributors, but it is also easier to review and contribute to multiple parts in parallel.
41_4_5
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/philosophy.md
https://huggingface.co/docs/diffusers/en/conceptual/philosophy/#tweakable-contributor-friendly-over-abstraction
.md
At Hugging Face, we call this design the **single-file policy** which means that almost all of the code of a certain class should be written in a single, self-contained file. To read more about the philosophy, you can have a look at [this blog post](https://huggingface.co/blog/transformers-design-philosophy).
41_4_6
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/philosophy.md
https://huggingface.co/docs/diffusers/en/conceptual/philosophy/#tweakable-contributor-friendly-over-abstraction
.md
at [this blog post](https://huggingface.co/blog/transformers-design-philosophy). In Diffusers, we follow this philosophy for both pipelines and schedulers, but only partly for diffusion models. The reason we don't follow this design fully for diffusion models is because almost all diffusion pipelines, such
41_4_7
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/philosophy.md
https://huggingface.co/docs/diffusers/en/conceptual/philosophy/#tweakable-contributor-friendly-over-abstraction
.md
as [DDPM](https://huggingface.co/docs/diffusers/api/pipelines/ddpm), [Stable Diffusion](https://huggingface.co/docs/diffusers/api/pipelines/stable_diffusion/overview#stable-diffusion-pipelines), [unCLIP (DALL·E 2)](https://huggingface.co/docs/diffusers/api/pipelines/unclip) and [Imagen](https://imagen.research.google/) all rely on the same diffusion model, the [UNet](https://huggingface.co/docs/diffusers/api/models/unet2d-cond).
41_4_8
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/philosophy.md
https://huggingface.co/docs/diffusers/en/conceptual/philosophy/#tweakable-contributor-friendly-over-abstraction
.md
Great, now you should have generally understood why 🧨 Diffusers is designed the way it is 🤗. We try to apply these design principles consistently across the library. Nevertheless, there are some minor exceptions to the philosophy or some unlucky design choices. If you have feedback regarding the design, we would ❤️ to hear it [directly on GitHub](https://github.com/huggingface/diffusers/issues/new?assignees=&labels=&template=feedback.md&title=).
41_4_9
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/philosophy.md
https://huggingface.co/docs/diffusers/en/conceptual/philosophy/#design-philosophy-in-details
.md
Now, let's look a bit into the nitty-gritty details of the design philosophy. Diffusers essentially consists of three major classes: [pipelines](https://github.com/huggingface/diffusers/tree/main/src/diffusers/pipelines), [models](https://github.com/huggingface/diffusers/tree/main/src/diffusers/models), and [schedulers](https://github.com/huggingface/diffusers/tree/main/src/diffusers/schedulers). Let's walk through more in-detail design decisions for each class.
41_5_0
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/philosophy.md
https://huggingface.co/docs/diffusers/en/conceptual/philosophy/#pipelines
.md
Pipelines are designed to be easy to use (therefore do not follow [*Simple over easy*](#simple-over-easy) 100%), are not feature complete, and should loosely be seen as examples of how to use [models](#models) and [schedulers](#schedulers) for inference. The following design principles are followed:
41_6_0
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/philosophy.md
https://huggingface.co/docs/diffusers/en/conceptual/philosophy/#pipelines
.md
- Pipelines follow the single-file policy. All pipelines can be found in individual directories under src/diffusers/pipelines. One pipeline folder corresponds to one diffusion paper/project/release. Multiple pipeline files can be gathered in one pipeline folder, as it’s done for [`src/diffusers/pipelines/stable-diffusion`](https://github.com/huggingface/diffusers/tree/main/src/diffusers/pipelines/stable_diffusion). If pipelines share similar functionality, one can make use of the [# Copied from
41_6_1
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/philosophy.md
https://huggingface.co/docs/diffusers/en/conceptual/philosophy/#pipelines
.md
If pipelines share similar functionality, one can make use of the [# Copied from mechanism](https://github.com/huggingface/diffusers/blob/125d783076e5bd9785beb05367a2d2566843a271/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_img2img.py#L251).
41_6_2
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/philosophy.md
https://huggingface.co/docs/diffusers/en/conceptual/philosophy/#pipelines
.md
- Pipelines all inherit from [`DiffusionPipeline`].
41_6_3
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/philosophy.md
https://huggingface.co/docs/diffusers/en/conceptual/philosophy/#pipelines
.md
- Every pipeline consists of different model and scheduler components, that are documented in the [`model_index.json` file](https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5/blob/main/model_index.json), are accessible under the same name as attributes of the pipeline and can be shared between pipelines with [`DiffusionPipeline.components`](https://huggingface.co/docs/diffusers/main/en/api/diffusion_pipeline#diffusers.DiffusionPipeline.components) function.
41_6_4
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/philosophy.md
https://huggingface.co/docs/diffusers/en/conceptual/philosophy/#pipelines
.md
- Every pipeline should be loadable via the [`DiffusionPipeline.from_pretrained`](https://huggingface.co/docs/diffusers/main/en/api/diffusion_pipeline#diffusers.DiffusionPipeline.from_pretrained) function. - Pipelines should be used **only** for inference. - Pipelines should be very readable, self-explanatory, and easy to tweak. - Pipelines should be designed to build on top of each other and be easy to integrate into higher-level APIs.
41_6_5
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/philosophy.md
https://huggingface.co/docs/diffusers/en/conceptual/philosophy/#pipelines
.md
- Pipelines should be designed to build on top of each other and be easy to integrate into higher-level APIs. - Pipelines are **not** intended to be feature-complete user interfaces. For feature-complete user interfaces one should rather have a look at [InvokeAI](https://github.com/invoke-ai/InvokeAI), [Diffuzers](https://github.com/abhishekkrthakur/diffuzers), and [lama-cleaner](https://github.com/Sanster/lama-cleaner).
41_6_6
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/philosophy.md
https://huggingface.co/docs/diffusers/en/conceptual/philosophy/#pipelines
.md
- Every pipeline should have one and only one way to run it via a `__call__` method. The naming of the `__call__` arguments should be shared across all pipelines. - Pipelines should be named after the task they are intended to solve. - In almost all cases, novel diffusion pipelines shall be implemented in a new pipeline folder/file.
41_6_7
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/philosophy.md
https://huggingface.co/docs/diffusers/en/conceptual/philosophy/#models
.md
Models are designed as configurable toolboxes that are natural extensions of [PyTorch's Module class](https://pytorch.org/docs/stable/generated/torch.nn.Module.html). They only partly follow the **single-file policy**. The following design principles are followed: - Models correspond to **a type of model architecture**. *E.g.* the [`UNet2DConditionModel`] class is used for all UNet variations that expect 2D image inputs and are conditioned on some context.
41_7_0
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/philosophy.md
https://huggingface.co/docs/diffusers/en/conceptual/philosophy/#models
.md
- All models can be found in [`src/diffusers/models`](https://github.com/huggingface/diffusers/tree/main/src/diffusers/models) and every model architecture shall be defined in its file, e.g. [`unets/unet_2d_condition.py`](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/unets/unet_2d_condition.py), [`transformers/transformer_2d.py`](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/transformers/transformer_2d.py), etc...
41_7_1
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/philosophy.md
https://huggingface.co/docs/diffusers/en/conceptual/philosophy/#models
.md
- Models **do not** follow the single-file policy and should make use of smaller model building blocks, such as [`attention.py`](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention.py), [`resnet.py`](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/resnet.py), [`embeddings.py`](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/embeddings.py), etc... **Note**: This is in stark contrast to Transformers' modeling files and shows that
41_7_2
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/philosophy.md
https://huggingface.co/docs/diffusers/en/conceptual/philosophy/#models
.md
etc... **Note**: This is in stark contrast to Transformers' modeling files and shows that models do not really follow the single-file policy.
41_7_3
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/philosophy.md
https://huggingface.co/docs/diffusers/en/conceptual/philosophy/#models
.md
- Models intend to expose complexity, just like PyTorch's `Module` class, and give clear error messages. - Models all inherit from `ModelMixin` and `ConfigMixin`. - Models can be optimized for performance when it doesn’t demand major code changes, keeps backward compatibility, and gives significant memory or compute gain. - Models should by default have the highest precision and lowest performance setting.
41_7_4
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/philosophy.md
https://huggingface.co/docs/diffusers/en/conceptual/philosophy/#models
.md
- Models should by default have the highest precision and lowest performance setting. - To integrate new model checkpoints whose general architecture can be classified as an architecture that already exists in Diffusers, the existing model architecture shall be adapted to make it work with the new checkpoint. One should only create a new file if the model architecture is fundamentally different.
41_7_5
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/philosophy.md
https://huggingface.co/docs/diffusers/en/conceptual/philosophy/#models
.md
- Models should be designed to be easily extendable to future changes. This can be achieved by limiting public function arguments, configuration arguments, and "foreseeing" future changes, *e.g.* it is usually better to add `string` "...type" arguments that can easily be extended to new future types instead of boolean `is_..._type` arguments. Only the minimum amount of changes shall be made to existing architectures to make a new model checkpoint work.
41_7_6
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/philosophy.md
https://huggingface.co/docs/diffusers/en/conceptual/philosophy/#models
.md
- The model design is a difficult trade-off between keeping code readable and concise and supporting many model checkpoints. For most parts of the modeling code, classes shall be adapted for new model checkpoints, while there are some exceptions where it is preferred to add new classes to make sure the code is kept concise and
41_7_7
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/philosophy.md
https://huggingface.co/docs/diffusers/en/conceptual/philosophy/#models
.md
readable long-term, such as [UNet blocks](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/unets/unet_2d_blocks.py) and [Attention processors](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py).
41_7_8
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/philosophy.md
https://huggingface.co/docs/diffusers/en/conceptual/philosophy/#schedulers
.md
Schedulers are responsible to guide the denoising process for inference as well as to define a noise schedule for training. They are designed as individual classes with loadable configuration files and strongly follow the **single-file policy**. The following design principles are followed: - All schedulers are found in [`src/diffusers/schedulers`](https://github.com/huggingface/diffusers/tree/main/src/diffusers/schedulers).
41_8_0
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/philosophy.md
https://huggingface.co/docs/diffusers/en/conceptual/philosophy/#schedulers
.md
- Schedulers are **not** allowed to import from large utils files and shall be kept very self-contained. - One scheduler Python file corresponds to one scheduler algorithm (as might be defined in a paper). - If schedulers share similar functionalities, we can make use of the `# Copied from` mechanism. - Schedulers all inherit from `SchedulerMixin` and `ConfigMixin`.
41_8_1
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/philosophy.md
https://huggingface.co/docs/diffusers/en/conceptual/philosophy/#schedulers
.md
- Schedulers all inherit from `SchedulerMixin` and `ConfigMixin`. - Schedulers can be easily swapped out with the [`ConfigMixin.from_config`](https://huggingface.co/docs/diffusers/main/en/api/configuration#diffusers.ConfigMixin.from_config) method as explained in detail [here](../using-diffusers/schedulers). - Every scheduler has to have a `set_num_inference_steps`, and a `step` function. `set_num_inference_steps(...)` has to be called before every denoising process, *i.e.* before `step(...)` is called.
41_8_2
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/philosophy.md
https://huggingface.co/docs/diffusers/en/conceptual/philosophy/#schedulers
.md
- Every scheduler exposes the timesteps to be "looped over" via a `timesteps` attribute, which is an array of timesteps the model will be called upon. - The `step(...)` function takes a predicted model output and the "current" sample (x_t) and returns the "previous", slightly more denoised sample (x_t-1). - Given the complexity of diffusion schedulers, the `step` function does not expose all the complexity and can be a bit of a "black box".
41_8_3
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/philosophy.md
https://huggingface.co/docs/diffusers/en/conceptual/philosophy/#schedulers
.md
- In almost all cases, novel schedulers shall be implemented in a new scheduling file.
41_8_4
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/evaluation.md
https://huggingface.co/docs/diffusers/en/conceptual/evaluation/
.md
<!--Copyright 2024 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
42_0_0
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/evaluation.md
https://huggingface.co/docs/diffusers/en/conceptual/evaluation/
.md
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -->
42_0_1
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/evaluation.md
https://huggingface.co/docs/diffusers/en/conceptual/evaluation/#evaluating-diffusion-models
.md
<a target="_blank" href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers/evaluation.ipynb"> <img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/> </a>
42_1_0
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/evaluation.md
https://huggingface.co/docs/diffusers/en/conceptual/evaluation/#evaluating-diffusion-models
.md
<img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/> </a> Evaluation of generative models like [Stable Diffusion](https://huggingface.co/docs/diffusers/stable_diffusion) is subjective in nature. But as practitioners and researchers, we often have to make careful choices amongst many different possibilities. So, when working with different generative models (like GANs, Diffusion, etc.), how do we choose one over the other?
42_1_1
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/evaluation.md
https://huggingface.co/docs/diffusers/en/conceptual/evaluation/#evaluating-diffusion-models
.md
Qualitative evaluation of such models can be error-prone and might incorrectly influence a decision. However, quantitative metrics don't necessarily correspond to image quality. So, usually, a combination of both qualitative and quantitative evaluations provides a stronger signal when choosing one model over the other.
42_1_2
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/evaluation.md
https://huggingface.co/docs/diffusers/en/conceptual/evaluation/#evaluating-diffusion-models
.md
of both qualitative and quantitative evaluations provides a stronger signal when choosing one model over the other. In this document, we provide a non-exhaustive overview of qualitative and quantitative methods to evaluate Diffusion models. For quantitative methods, we specifically focus on how to implement them alongside `diffusers`.
42_1_3
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/evaluation.md
https://huggingface.co/docs/diffusers/en/conceptual/evaluation/#evaluating-diffusion-models
.md
The methods shown in this document can also be used to evaluate different [noise schedulers](https://huggingface.co/docs/diffusers/main/en/api/schedulers/overview) keeping the underlying generation model fixed.
42_1_4
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/evaluation.md
https://huggingface.co/docs/diffusers/en/conceptual/evaluation/#scenarios
.md
We cover Diffusion models with the following pipelines: - Text-guided image generation (such as the [`StableDiffusionPipeline`](https://huggingface.co/docs/diffusers/main/en/api/pipelines/stable_diffusion/text2img)).
42_2_0
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/evaluation.md
https://huggingface.co/docs/diffusers/en/conceptual/evaluation/#scenarios
.md
- Text-guided image generation, additionally conditioned on an input image (such as the [`StableDiffusionImg2ImgPipeline`](https://huggingface.co/docs/diffusers/main/en/api/pipelines/stable_diffusion/img2img) and [`StableDiffusionInstructPix2PixPipeline`](https://huggingface.co/docs/diffusers/main/en/api/pipelines/pix2pix)). - Class-conditioned image generation models (such as the [`DiTPipeline`](https://huggingface.co/docs/diffusers/main/en/api/pipelines/dit)).
42_2_1
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/evaluation.md
https://huggingface.co/docs/diffusers/en/conceptual/evaluation/#qualitative-evaluation
.md
Qualitative evaluation typically involves human assessment of generated images. Quality is measured across aspects such as compositionality, image-text alignment, and spatial relations. Common prompts provide a degree of uniformity for subjective metrics. DrawBench and PartiPrompts are prompt datasets used for qualitative benchmarking. DrawBench and PartiPrompts were introduced by [Imagen](https://imagen.research.google/) and [Parti](https://parti.research.google/) respectively.
42_3_0
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/evaluation.md
https://huggingface.co/docs/diffusers/en/conceptual/evaluation/#qualitative-evaluation
.md
From the [official Parti website](https://parti.research.google/): > PartiPrompts (P2) is a rich set of over 1600 prompts in English that we release as part of this work. P2 can be used to measure model capabilities across various categories and challenge aspects. ![parti-prompts](https://huggingface.co/datasets/diffusers/docs-images/resolve/main/evaluation_diffusion_models/parti-prompts.png) PartiPrompts has the following columns: - Prompt
42_3_1
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/evaluation.md
https://huggingface.co/docs/diffusers/en/conceptual/evaluation/#qualitative-evaluation
.md
PartiPrompts has the following columns: - Prompt - Category of the prompt (such as “Abstract”, “World Knowledge”, etc.) - Challenge reflecting the difficulty (such as “Basic”, “Complex”, “Writing & Symbols”, etc.) These benchmarks allow for side-by-side human evaluation of different image generation models. For this, the 🧨 Diffusers team has built **Open Parti Prompts**, which is a community-driven qualitative benchmark based on Parti Prompts to compare state-of-the-art open-source diffusion models:
42_3_2
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/evaluation.md
https://huggingface.co/docs/diffusers/en/conceptual/evaluation/#qualitative-evaluation
.md
- [Open Parti Prompts Game](https://huggingface.co/spaces/OpenGenAI/open-parti-prompts): For 10 parti prompts, 4 generated images are shown and the user selects the image that suits the prompt best. - [Open Parti Prompts Leaderboard](https://huggingface.co/spaces/OpenGenAI/parti-prompts-leaderboard): The leaderboard comparing the currently best open-sourced diffusion models to each other. To manually compare images, let’s see how we can use `diffusers` on a couple of PartiPrompts.
42_3_3
/Users/nielsrogge/Documents/python_projecten/diffusers/docs/source/en/conceptual/evaluation.md
https://huggingface.co/docs/diffusers/en/conceptual/evaluation/#qualitative-evaluation
.md
To manually compare images, let’s see how we can use `diffusers` on a couple of PartiPrompts. Below we show some prompts sampled across different challenges: Basic, Complex, Linguistic Structures, Imagination, and Writing & Symbols. Here we are using PartiPrompts as a [dataset](https://huggingface.co/datasets/nateraw/parti-prompts). ```python from datasets import load_dataset
42_3_4