@@ -5,46 +5,49 @@ source /functions.sh
55export PATH=" /home/abc/miniconda3/bin:$PATH "
66export SD02_DIR=${BASE_DIR} /02-sd-webui
77
8- # disable the use of a python venv
8+ # Disable the webui's built-in Python venv creation
99export venv_dir=" -"
1010
11- # Install or update Stable-Diffusion-WebUI
11+ # Create the main directory for this UI
1212mkdir -p ${SD02_DIR}
13-
14- if [ ! -d ${SD02_DIR} /forge ]; then
15- git clone https://github.com/lllyasviel/stable-diffusion-webui-forge.git ${SD02_DIR} /forge
13+ mkdir -p " ${SD02_DIR} /forge"
14+
15+ # Install or update the Stable-Diffusion-WebUI-Forge repository
16+ if [ ! -d " ${SD02_DIR} /forge/.git" ]; then
17+ echo " Cloning Stable-Diffusion-WebUI-Forge repository..."
18+ git clone https://github.com/lllyasviel/stable-diffusion-webui-forge.git " ${SD02_DIR} /forge"
19+ cd " ${SD02_DIR} /forge"
20+ else
21+ echo " Existing Stable-Diffusion-WebUI-Forge repository found. Synchronizing..."
22+ cd " ${SD02_DIR} /forge"
23+ check_remote " GIT_REF"
1624fi
1725
18- # check if remote is ahead of local
19- cd ${SD02_DIR} /forge
20- check_remote
21-
22- # clean conda env
26+ # Clean the Conda environment if required
2327clean_env ${SD02_DIR} /conda-env
2428
25- # Create Conda virtual env
29+ # Create the Conda environment if it doesn't exist
2630if [ ! -d ${SD02_DIR} /conda-env ]; then
2731 conda create -p ${SD02_DIR} /conda-env -y
2832fi
2933
30- # activate conda env + install base tools
34+ # Activate the environment and install base packages
3135source activate ${SD02_DIR} /conda-env
3236conda install -n base conda-libmamba-solver -y
3337conda install -c conda-forge python=3.11 pip gcc gxx libcurand --solver=libmamba -y
3438
39+ # Copy default launch parameters if they don't exist
3540if [ ! -f " $SD02_DIR /parameters.forge.txt" ]; then
3641 cp -v " /opt/sd-install/parameters/02.forge.txt" " $SD02_DIR /parameters.forge.txt"
3742fi
3843
39- # install custom requirements
44+ # Install custom user requirements if specified
4045pip install --upgrade pip
41-
4246if [ -f ${SD02_DIR} /requirements.txt ]; then
4347 pip install -r ${SD02_DIR} /requirements_versions.txt
4448fi
4549
46- # Merge Models, vae, lora, and hypernetworks, and outputs
47- # Ignore move errors if they occur
50+ # Symlink shared models folders into the Forge directory
4851sl_folder ${SD02_DIR} /forge/models Stable-diffusion ${BASE_DIR} /models stable-diffusion
4952sl_folder ${SD02_DIR} /forge/models hypernetworks ${BASE_DIR} /models hypernetwork
5053sl_folder ${SD02_DIR} /forge/models Lora ${BASE_DIR} /models lora
@@ -57,12 +60,13 @@ sl_folder ${SD02_DIR}/forge/models GFPGAN ${BASE_DIR}/models gfpgan
5760sl_folder ${SD02_DIR} /forge/models LDSR ${BASE_DIR} /models ldsr
5861sl_folder ${SD02_DIR} /forge/models ControlNet ${BASE_DIR} /models controlnet
5962
63+ # Symlink the output folder
6064sl_folder ${SD02_DIR} /forge outputs ${BASE_DIR} /outputs 02-sd-webui
6165
62- # Force using correct version of Python
66+ # Force the use of the Conda environment's Python executable
6367export python_cmd=" $( which python) "
6468
65- # Run webUI
69+ # Launch Stable-Diffusion-WebUI-Forge
6670echo " Run Stable-Diffusion-WebUI-forge"
6771cd ${SD02_DIR} /forge
6872CMD=" bash webui.sh"
0 commit comments