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.
import os
os.environ["DIFFSYNTH_MODEL_BASE_PATH"] = "./path_to_my_models"
import diffsynthOn Linux operating systems, you can also temporarily set environment variables from the command line:
DIFFSYNTH_MODEL_BASE_PATH="./path_to_my_models" python xxx.pyBelow are the environment variables supported by DiffSynth-Studio.
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.
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.
Attention mechanism implementation method. Can be set to flash_attention_3, flash_attention_2, sage_attention, xformers, or torch. See ./core/attention.md for details.
Buffer size in disk mapping. Default is 1B (1000000000). Larger values occupy more memory but result in faster speeds.
Remote model download source. Can be set to modelscope or huggingface to control the source of model downloads. Default value is modelscope.