You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -12,183 +12,156 @@ specific language governing permissions and limitations under the License.
12
12
13
13
# Installation
14
14
15
-
🤗 Diffusers is tested on Python 3.8+, PyTorch 1.7.0+, and Flax. Follow the installation instructions below for the deep learning library you are using:
15
+
Diffusers is tested on Python 3.8+, PyTorch 1.4+, and Flax 0.4.1+. Follow the installation instructions for the deep learning library you're using, [PyTorch](https://pytorch.org/get-started/locally/) or [Flax](https://flax.readthedocs.io/en/latest/).
You should install 🤗 Diffusers in a [virtual environment](https://docs.python.org/3/library/venv.html).
23
-
If you're unfamiliar with Python virtual environments, take a look at this [guide](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/).
24
-
A virtual environment makes it easier to manage different projects and avoid compatibility issues between dependencies.
25
-
26
-
Create a virtual environment with Python or [uv](https://docs.astral.sh/uv/) (refer to [Installation](https://docs.astral.sh/uv/getting-started/installation/) for installation instructions), a fast Rust-based Python package and project manager.
27
-
28
-
<hfoptionsid="install">
29
-
<hfoptionid="uv">
17
+
Create a [virtual environment](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/) for easier management of separate projects and to avoid compatibility issues between dependencies. Use [uv](https://docs.astral.sh/uv/), a Rust-based Python package and project manager, to create a virtual environment and install Diffusers.
30
18
31
19
```bash
32
20
uv venv my-env
33
21
source my-env/bin/activate
34
22
```
35
23
36
-
</hfoption>
37
-
<hfoptionid="Python">
38
-
39
-
```bash
40
-
python -m venv my-env
41
-
source my-env/bin/activate
42
-
```
43
-
44
-
</hfoption>
45
-
</hfoptions>
46
-
47
-
You should also install 🤗 Transformers because 🤗 Diffusers relies on its models.
48
-
24
+
Install Diffusers with one of the following methods.
49
25
50
-
<frameworkcontent>
51
-
<pt>
52
-
53
-
PyTorch only supports Python 3.8 - 3.11 on Windows. Install Diffusers with uv.
54
-
55
-
```bash
56
-
uv install diffusers["torch"] transformers
57
-
```
26
+
<hfoptionsid="install">
27
+
<hfoptionid="pip">
58
28
59
-
You can also install Diffusers with pip.
29
+
PyTorch only supports Python 3.8 - 3.11 on Windows.
60
30
61
31
```bash
62
-
pip install diffusers["torch"] transformers
32
+
uv pip install diffusers["torch"] transformers
63
33
```
64
34
65
-
</pt>
66
-
<jax>
67
-
68
-
Install Diffusers with uv.
35
+
Use the command below for Flax.
69
36
70
37
```bash
71
38
uv pip install diffusers["flax"] transformers
72
39
```
73
40
74
-
You can also install Diffusers with pip.
75
-
76
-
```bash
77
-
pip install diffusers["flax"] transformers
78
-
```
79
-
80
-
</jax>
81
-
</frameworkcontent>
82
-
83
-
## Install with conda
84
-
85
-
After activating your virtual environment, with `conda` (maintained by the community):
41
+
</hfoption>
42
+
<hfoptionid="conda">
86
43
87
44
```bash
88
45
conda install -c conda-forge diffusers
89
46
```
90
47
91
-
## Install from source
48
+
</hfoption>
49
+
<hfoptionid="source">
92
50
93
-
Before installing 🤗 Diffusers from source, make sure you have PyTorch and 🤗 Accelerate installed.
51
+
A source install installs the `main` version instead of the latest `stable` version. The `main` version is useful for staying updated with the latest changes but it may not always be stable. If you run into a problem, open an [Issue](https://github.com/huggingface/diffusers/issues/new/choose)and we will try to resolve it as soon as possible.
94
52
95
-
To install 🤗 Accelerate:
53
+
Make sure [Accelerate](https://huggingface.co/docs/accelerate/index) is installed.
96
54
97
55
```bash
98
-
pip install accelerate
56
+
uv pip install accelerate
99
57
```
100
58
101
-
Then install 🤗 Diffusers from source:
59
+
Install Diffusers from source with the command below.
This command installs the bleeding edge `main` version rather than the latest `stable` version.
108
-
The `main` version is useful for staying up-to-date with the latest developments.
109
-
For instance, if a bug has been fixed since the last official release but a new release hasn't been rolled out yet.
110
-
However, this means the `main` version may not always be stable.
111
-
We strive to keep the `main` version operational, and most issues are usually resolved within a few hours or a day.
112
-
If you run into a problem, please open an [Issue](https://github.com/huggingface/diffusers/issues/new/choose) so we can fix it even sooner!
65
+
</hfoption>
66
+
</hfoptions>
113
67
114
68
## Editable install
115
69
116
-
You will need an editable install if you'd like to:
70
+
An editable install is recommended for development workflows or if you're using the `main` version of the source code. A special link is created between the cloned repository and the Python library paths. This avoids reinstalling a package after every change.
117
71
118
-
* Use the `main` version of the source code.
119
-
* Contribute to 🤗 Diffusers and need to test changes in the code.
72
+
Clone the repository and install Diffusers with the following commands.
120
73
121
-
Clone the repository and install 🤗 Diffusers with the following commands:
These commands will link the folder you cloned the repository to and your Python library paths.
142
-
Python will now look inside the folder you cloned to in addition to the normal library paths.
143
-
For example, if your Python packages are typically installed in `~/anaconda3/envs/main/lib/python3.10/site-packages/`, Python will also search the `~/diffusers/` folder you cloned to.
144
91
145
-
<Tipwarning={true}>
146
-
147
-
You must keep the `diffusers` folder if you want to keep using the library.
92
+
</hfoption>
93
+
</hfoptions>
148
94
149
-
</Tip>
95
+
> [!WARNING]
96
+
> You must keep the `diffusers` folder if you want to keep using the library with the editable install.
150
97
151
-
Now you can easily update your clone to the latest version of 🤗 Diffusers with the following command:
98
+
Update your cloned repository to the latest version of Diffusers with the command below.
152
99
153
100
```bash
154
101
cd~/diffusers/
155
102
git pull
156
103
```
157
104
158
-
Your Python environment will find the `main` version of 🤗 Diffusers on the next run.
159
-
160
105
## Cache
161
106
162
-
Model weights and files are downloaded from the Hub to a cache which is usually your home directory. You can change the cache location by specifying the `HF_HOME` or `HUGGINFACE_HUB_CACHE` environment variables or configuring the `cache_dir` parameter in methods like [`~DiffusionPipeline.from_pretrained`].
107
+
Model weights and files are downloaded from the Hub to a cache, which is usually your home directory. Change the cache location with the [HF_HOME](https://huggingface.co/docs/huggingface_hub/package_reference/environment_variables#hfhome) or [HF_HUB_CACHE](https://huggingface.co/docs/huggingface_hub/package_reference/environment_variables#hfhubcache) environment variables or configuring the `cache_dir` parameter in methods like [`~DiffusionPipeline.from_pretrained`].
163
108
164
-
Cached files allow you to run 🤗 Diffusers offline. To prevent 🤗 Diffusers from connecting to the internet, set the `HF_HUB_OFFLINE` environment variable to `1` and 🤗 Diffusers will only load previously downloaded files in the cache.
109
+
<hfoptionsid="cache">
110
+
<hfoptionid="env variable">
111
+
112
+
```bash
113
+
export HF_HOME="/path/to/your/cache"
114
+
export HF_HUB_CACHE="/path/to/your/hub/cache"
115
+
```
116
+
117
+
</hfoption>
118
+
<hfoptionid="from_pretrained">
119
+
120
+
```py
121
+
from diffusers import DiffusionPipeline
122
+
123
+
pipeline = DiffusionPipeline.from_pretrained(
124
+
"black-forest-labs/FLUX.1-dev",
125
+
cache_dir="/path/to/your/cache"
126
+
)
127
+
```
128
+
129
+
</hfoption>
130
+
</hfoptions>
131
+
132
+
Cached files allow you to use Diffusers offline. Set the [HF_HUB_OFFLINE](https://huggingface.co/docs/huggingface_hub/package_reference/environment_variables#hfhuboffline) environment variable to `1` to prevent Diffusers from connecting to the internet.
165
133
166
134
```shell
167
135
export HF_HUB_OFFLINE=1
168
136
```
169
137
170
-
For more details about managing and cleaning the cache, take a look at the [caching](https://huggingface.co/docs/huggingface_hub/guides/manage-cache) guide.
138
+
For more details about managing and cleaning the cache, take a look at the [Understand caching](https://huggingface.co/docs/huggingface_hub/guides/manage-cache) guide.
171
139
172
140
## Telemetry logging
173
141
174
-
Our library gathers telemetry information during [`~DiffusionPipeline.from_pretrained`] requests.
175
-
The data gathered includes the version of 🤗 Diffusers and PyTorch/Flax, the requested model or pipeline class,
176
-
and the path to a pretrained checkpoint if it is hosted on the Hugging Face Hub.
142
+
Diffusers gathers telemetry information during [`~DiffusionPipeline.from_pretrained`] requests.
143
+
The data gathered includes the Diffusers and PyTorch/Flax version, the requested model or pipeline class,
144
+
and the path to a pretrained checkpoint if it is hosted on the Hub.
145
+
177
146
This usage data helps us debug issues and prioritize new features.
178
147
Telemetry is only sent when loading models and pipelines from the Hub,
179
148
and it is not collected if you're loading local files.
180
149
181
-
We understand that not everyone wants to share additional information,and we respect your privacy.
182
-
You can disable telemetry collection by setting the `HF_HUB_DISABLE_TELEMETRY` environment variable from your terminal:
150
+
Opt-out and disable telemetry collection with the [HF_HUB_DISABLE_TELEMETRY](https://huggingface.co/docs/huggingface_hub/package_reference/environment_variables#hfhubdisabletelemetry) environment variable.
0 commit comments