diffsynth 2.0 prototype

This commit is contained in:
Artiprocher
2025-11-04 10:59:29 +08:00
parent a30ed9093f
commit 288fb7604c
664 changed files with 3581 additions and 2237905 deletions

View File

@@ -0,0 +1,35 @@
# 环境变量
`DiffSynth-Studio` 可通过环境变量控制一些设置。
`Python` 代码中,可以使用 `os.environ` 设置环境变量。请注意,环境变量需在 `import diffsynth` 前设置。
```python
import os
os.environ["DIFFSYNTH_MODEL_BASE_PATH"] = "./path_to_my_models"
import diffsynth
```
在 Linux 操作系统上,也可在命令行临时设置环境变量:
```shell
DIFFSYNTH_MODEL_BASE_PATH="./path_to_my_models" python xxx.py
```
以下是 `DiffSynth-Studio` 所支持的环境变量。
## `DIFFSYNTH_SKIP_DOWNLOAD`
是否跳过模型下载。可设置为 `True``true``False``false`,若 `ModelConfig` 中没有设置 `skip_download`,则会根据这一环境变量决定是否跳过模型下载。
## `DIFFSYNTH_MODEL_BASE_PATH`
模型下载根目录。可设置为任意本地路径,若 `ModelConfig` 中没有设置 `local_model_path`,则会将模型文件下载到这一环境变量指向的路径。若两者都未设置,则会将模型文件下载到 `./models`
## `DIFFSYNTH_ATTENTION_IMPLEMENTATION`
注意力机制实现的方式,可以设置为 `flash_attention_3``flash_attention_2``sage_attention``xformers``torch`。详见 [`./core/attention.md`](./core/attention.md).
## `DIFFSYNTH_DISK_MAP_BUFFER_SIZE`
硬盘直连中的 Buffer 大小,默认是 1B1000000000数值越大占用内存越大速度越快。