Installation¶
Diffusers uses the pyproject.toml
file for building and packaging, as introduced in PEP 517. View this configuration file file for more details on the specific build configuration of this project.
Diffusers is tested on Python 3.9+, MindSpore 2.6.0. Follow the installation instructions below for the deep learning library you are using:
- MindSpore installation instructions
Install Diffusers with one of the following methods.
MindSpore only supports Python 3.9 - 3.11 on Ascend.
pip install mindspore==2.7.0 -i https://repo.mindspore.cn/pypi/simple --trusted-host repo.mindspore.cn --extra-index-url https://repo.huaweicloud.com/repository/pypi/simple
Tip
We define both required and optional dependencies in the pyproject.toml
file. If you need to install optional dependencies, you can specify them. For example, if you want to install the 'training' optional dependency, you would run:
pip install mindone[training]
Install Diffusers from source with the command below.
pip install git+https://github.com/mindspore-lab/mindone
Editable install¶
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.
Clone the repository and install Diffusers with the following commands.
git clone https://github.com/mindspore-lab/mindone.git
cd mindone
Warning
⚠️ PEP 660 – Editable installs for pyproject.toml based builds defines how to build projects that only use pyproject.toml
. Build tools must implement PEP 660 for editable installs to work. You need a front-end (such as pip ≥ 21.3) and a backend. The statuses of some popular backends are:
pip install -e .
Warning
You must keep the mindone
folder if you want to keep using the library with the editable install.
Update your cloned repository to the latest version of Diffusers with the command below.
cd ~/mindone/
git pull
Cache¶
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 or HF_HUB_CACHE environment variables or configuring the cache_dir
parameter in methods like from_pretrained
.
export HF_HOME="/path/to/your/cache"
export HF_HUB_CACHE="/path/to/your/hub/cache"
from mindone.diffusers import DiffusionPipeline
pipeline = DiffusionPipeline.from_pretrained(
"black-forest-labs/FLUX.1-dev",
cache_dir="/path/to/your/cache"
)
Cached files allow you to use Diffusers offline. Set the HF_HUB_OFFLINE environment variable to 1
to prevent Diffusers from connecting to the internet.
export HF_HUB_OFFLINE=1
For more details about managing and cleaning the cache, take a look at the Understand caching guide.
Telemetry logging¶
Diffusers gathers telemetry information during from_pretrained
requests.
The data gathered includes the Diffusers and MindSpore version, the requested model or pipeline class,
and the path to a pretrained checkpoint if it is hosted on the Hub.
This usage data helps us debug issues and prioritize new features. Telemetry is only sent when loading models and pipelines from the Hub, and it is not collected if you're loading local files.
Opt-out and disable telemetry collection with the HF_HUB_DISABLE_TELEMETRY environment variable.
export HF_HUB_DISABLE_TELEMETRY=1
set HF_HUB_DISABLE_TELEMETRY=1