Files
DiffSynth-Studio/docs/en/Pipeline_Usage/Environment_Variables.md
Hong Zhang b3b63fef3e Add readthedocs for diffsynth-studio
* add conf docs

* add conf docs

* add index

* add index

* update ref

* test root

* add en

* test relative

* redirect relative

* add document

* test_document

* test_document
2026-02-10 19:51:04 +08:00

39 lines
1.7 KiB
Markdown

# Environment Variables
`DiffSynth-Studio` can control some settings through environment variables.
In `Python` code, you can set environment variables using `os.environ`. Please note that environment variables must be set before `import diffsynth`.
```python
import os
os.environ["DIFFSYNTH_MODEL_BASE_PATH"] = "./path_to_my_models"
import diffsynth
```
On Linux operating systems, you can also temporarily set environment variables from the command line:
```shell
DIFFSYNTH_MODEL_BASE_PATH="./path_to_my_models" python xxx.py
```
Below are the environment variables supported by `DiffSynth-Studio`.
## `DIFFSYNTH_SKIP_DOWNLOAD`
Whether to skip model downloads. Can be set to `True`, `true`, `False`, `false`. If `skip_download` is not set in `ModelConfig`, this environment variable will determine whether to skip model downloads.
## `DIFFSYNTH_MODEL_BASE_PATH`
Model download root directory. Can be set to any local path. If `local_model_path` is not set in `ModelConfig`, model files will be downloaded to the path pointed to by this environment variable. If neither is set, model files will be downloaded to `./models`.
## `DIFFSYNTH_ATTENTION_IMPLEMENTATION`
Attention mechanism implementation method. Can be set to `flash_attention_3`, `flash_attention_2`, `sage_attention`, `xformers`, or `torch`. See [`./core/attention.md`](../API_Reference/core/attention.md) for details.
## `DIFFSYNTH_DISK_MAP_BUFFER_SIZE`
Buffer size in disk mapping. Default is 1B (1000000000). Larger values occupy more memory but result in faster speeds.
## `DIFFSYNTH_DOWNLOAD_SOURCE`
Remote model download source. Can be set to `modelscope` or `huggingface` to control the source of model downloads. Default value is `modelscope`.