Update missing setup files
This commit is contained in:
parent
7e9459bae7
commit
7150179155
179
README.md
179
README.md
@ -6,21 +6,30 @@ If you run on Linux and would like to use the GUI, there is now a port of it as
|
||||
|
||||
### Table of Contents
|
||||
|
||||
- [Tutorials](https://github.com/bmaltais/kohya_ss#tutorials)
|
||||
- [Required Dependencies](https://github.com/bmaltais/kohya_ss#required-dependencies)
|
||||
- [Installation](https://github.com/bmaltais/kohya_ss#installation)
|
||||
- [CUDNN 8.6](https://github.com/bmaltais/kohya_ss#optional-cudnn-86)
|
||||
- [Upgrading](https://github.com/bmaltais/kohya_ss#upgrading)
|
||||
- [Launching the GUI](https://github.com/bmaltais/kohya_ss#launching-the-gui)
|
||||
- [Dreambooth](https://github.com/bmaltais/kohya_ss#dreambooth)
|
||||
- [Finetune](https://github.com/bmaltais/kohya_ss#finetune)
|
||||
- [Train Network](https://github.com/bmaltais/kohya_ss#train-network)
|
||||
- [LoRA](https://github.com/bmaltais/kohya_ss#lora)
|
||||
- [Troubleshooting](https://github.com/bmaltais/kohya_ss#troubleshooting)
|
||||
- [Page File Limit](https://github.com/bmaltais/kohya_ss#page-file-limit)
|
||||
- [No module called tkinter](https://github.com/bmaltais/kohya_ss#no-module-called-tkinter)
|
||||
- [FileNotFoundError](https://github.com/bmaltais/kohya_ss#filenotfounderror)
|
||||
- [Change History](https://github.com/bmaltais/kohya_ss#change-history)
|
||||
- [Tutorials](#tutorials)
|
||||
- [Required Dependencies](#required-dependencies)
|
||||
- [Linux/macOS](#linux-and-macos-dependencies)
|
||||
- [Installation](#installation)
|
||||
- [Linux/macOS](#linux-and-macos)
|
||||
- [Default Install Locations](#install-location)
|
||||
- [Windows](#windows)
|
||||
- [CUDNN 8.6](#optional--cudnn-86)
|
||||
- [Upgrading](#upgrading)
|
||||
- [Windows](#windows-upgrade)
|
||||
- [Linux/macOS](#linux-and-macos-upgrade)
|
||||
- [Launching the GUI](#starting-gui-service)
|
||||
- [Windows](#launching-the-gui-on-windows)
|
||||
- [Linux/macOS](#launching-the-gui-on-linux-and-macos)
|
||||
- [Direct Launch via Python Script](#launching-the-gui-directly-using-kohyaguipy)
|
||||
- [Dreambooth](#dreambooth)
|
||||
- [Finetune](#finetune)
|
||||
- [Train Network](#train-network)
|
||||
- [LoRA](#lora)
|
||||
- [Troubleshooting](#troubleshooting)
|
||||
- [Page File Limit](#page-file-limit)
|
||||
- [No module called tkinter](#no-module-called-tkinter)
|
||||
- [FileNotFoundError](#filenotfounderror)
|
||||
- [Change History](#change-history)
|
||||
|
||||
## Tutorials
|
||||
|
||||
@ -39,35 +48,66 @@ If you run on Linux and would like to use the GUI, there is now a port of it as
|
||||
- Install [Git](https://git-scm.com/download/win)
|
||||
- Install [Visual Studio 2015, 2017, 2019, and 2022 redistributable](https://aka.ms/vs/17/release/vc_redist.x64.exe)
|
||||
|
||||
### Linux and macOS dependencies
|
||||
|
||||
These dependencies are taken care of via `setup.sh` in the installation section. No additional steps should be needed unless the scripts inform you otherwise.
|
||||
|
||||
## Installation
|
||||
|
||||
### Runpod
|
||||
Follow the instructions found in this discussion: https://github.com/bmaltais/kohya_ss/discussions/379
|
||||
|
||||
### MacOS
|
||||
### Linux and macOS
|
||||
In the terminal, run
|
||||
|
||||
```
|
||||
git clone https://github.com/bmaltais/kohya_ss.git
|
||||
cd kohya_ss
|
||||
bash macos_setup.sh
|
||||
# May need to chmod +x ./setup.sh if you're on a machine with stricter security.
|
||||
# There are additional options if needed for a runpod environment.
|
||||
# Call 'setup.sh -h' or 'setup.sh --help' for more information.
|
||||
./setup.sh
|
||||
```
|
||||
|
||||
During the accelerate config screen after running the script answer "This machine", "None", "No" for the remaining questions.
|
||||
Setup.sh help included here:
|
||||
|
||||
### Ubuntu
|
||||
In the terminal, run
|
||||
```bash
|
||||
Kohya_SS Installation Script for POSIX operating systems.
|
||||
|
||||
```
|
||||
git clone https://github.com/bmaltais/kohya_ss.git
|
||||
cd kohya_ss
|
||||
bash ubuntu_setup.sh
|
||||
The following options are useful in a runpod environment,
|
||||
but will not affect a local machine install.
|
||||
|
||||
Usage:
|
||||
setup.sh -b dev -d /workspace/kohya_ss -g https://mycustom.repo.tld/custom_fork.git
|
||||
setup.sh --branch=dev --dir=/workspace/kohya_ss --git-repo=https://mycustom.repo.tld/custom_fork.git
|
||||
|
||||
Options:
|
||||
-b BRANCH, --branch=BRANCH Select which branch of kohya to check out on new installs.
|
||||
-d DIR, --dir=DIR The full path you want kohya_ss installed to.
|
||||
-g REPO, --git_repo=REPO You can optionally provide a git repo to check out for runpod installation. Useful for custom forks.
|
||||
-h, --help Show this screen.
|
||||
-i, --interactive Interactively configure accelerate instead of using default config file.
|
||||
-n, --no-update Do not update kohya_ss repo. No git pull or clone operations.
|
||||
-p, --public Expose public URL in runpod mode. Won't have an effect in other modes.
|
||||
-r, --runpod Forces a runpod installation. Useful if detection fails for any reason.
|
||||
-s, --skip-space-check Skip the 10Gb minimum storage space check.
|
||||
-v, --verbose Increase verbosity levels up to 3.
|
||||
```
|
||||
|
||||
then configure accelerate with the same answers as in the MacOS instructions when prompted.
|
||||
#### Install location
|
||||
|
||||
The default install location for Linux is where the script is located if a previous installation is detected that location.
|
||||
Otherwise, it will fall to `/opt/kohya_ss`. If /opt is not writeable, the fallback is `$HOME/kohya_ss`. Lastly, if all else fails it will simply install to the current folder you are in (PWD).
|
||||
|
||||
On macOS and other non-Linux machines, it will first try to detect an install where the script is run from and then run setup there if that's detected.
|
||||
If a previous install isn't found at that location, then it will default install to `$HOME/kohya_ss` followed by where you're currently at if there's no access to $HOME.
|
||||
You can override this behavior by specifying an install directory with the -d option.
|
||||
|
||||
If you are using the interactive mode, our default values for the accelerate config screen after running the script answer "This machine", "None", "No" for the remaining questions.
|
||||
These are the same answers as the Windows install.
|
||||
|
||||
### Windows
|
||||
In the terminal, run
|
||||
In the terminal, run:
|
||||
|
||||
```
|
||||
git clone https://github.com/bmaltais/kohya_ss.git
|
||||
@ -75,7 +115,7 @@ cd kohya_ss
|
||||
setup.bat
|
||||
```
|
||||
|
||||
then configure accelerate with the same answers as in the MacOS instructions when prompted.
|
||||
Then configure accelerate with the same answers as in the MacOS instructions when prompted.
|
||||
|
||||
### Optional: CUDNN 8.6
|
||||
|
||||
@ -93,38 +133,58 @@ Run the following commands to install:
|
||||
python .\tools\cudann_1.8_install.py
|
||||
```
|
||||
|
||||
## Upgrading MacOS
|
||||
|
||||
When a new release comes out, you can upgrade your repo with the following commands in the root directory:
|
||||
|
||||
```bash
|
||||
upgrade_macos.sh
|
||||
```
|
||||
|
||||
Once the commands have completed successfully you should be ready to use the new version. MacOS support is not tested and has been mostly taken from https://gist.github.com/jstayco/9f5733f05b9dc29de95c4056a023d645
|
||||
|
||||
## Upgrading Windows
|
||||
## Upgrading
|
||||
|
||||
The following commands will work from the root directory of the project if you'd prefer to not run scripts.
|
||||
These commands will work on any OS.
|
||||
```bash
|
||||
git pull
|
||||
|
||||
.\venv\Scripts\activate
|
||||
|
||||
pip install --use-pep517 --upgrade -r requirements.txt
|
||||
```
|
||||
|
||||
### Windows Upgrade
|
||||
When a new release comes out, you can upgrade your repo with the following commands in the root directory:
|
||||
|
||||
```powershell
|
||||
upgrade.bat
|
||||
```
|
||||
|
||||
### Linux and macOS Upgrade
|
||||
You can cd into the root directory and simply run
|
||||
|
||||
```bash
|
||||
# Refresh and update everything
|
||||
./setup.sh
|
||||
|
||||
# This will refresh everything, but NOT clone or pull the git repo.
|
||||
./setup.sh --no-git-update
|
||||
```
|
||||
|
||||
Once the commands have completed successfully you should be ready to use the new version.
|
||||
|
||||
## Launching the GUI using gui.bat or gui.ps1
|
||||
|
||||
The script can be run with several optional command line arguments:
|
||||
# Starting GUI Service
|
||||
|
||||
The following command line arguments can be passed to the scripts on any OS to configure the underlying service.
|
||||
```
|
||||
--listen: the IP address to listen on for connections to Gradio.
|
||||
--username: a username for authentication.
|
||||
--password: a password for authentication.
|
||||
--server_port: the port to run the server listener on.
|
||||
--inbrowser: opens the Gradio UI in a web browser.
|
||||
--username: a username for authentication.
|
||||
--password: a password for authentication.
|
||||
--server_port: the port to run the server listener on.
|
||||
--inbrowser: opens the Gradio UI in a web browser.
|
||||
--share: shares the Gradio UI.
|
||||
```
|
||||
|
||||
These command line arguments can be passed to the UI function as keyword arguments. To launch the Gradio UI, run the script in a terminal with the desired command line arguments, for example:
|
||||
### Launching the GUI on Windows
|
||||
|
||||
The two scripts to launch the GUI on Windows are gui.ps1 and gui.bat in the root directory.
|
||||
You can use whichever script you prefer.
|
||||
|
||||
To launch the Gradio UI, run the script in a terminal with the desired command line arguments, for example:
|
||||
|
||||
`gui.ps1 --listen 127.0.0.1 --server_port 7860 --inbrowser --share`
|
||||
|
||||
@ -132,14 +192,19 @@ or
|
||||
|
||||
`gui.bat --listen 127.0.0.1 --server_port 7860 --inbrowser --share`
|
||||
|
||||
## Launching the GUI using kohya_gui.py
|
||||
## Launching the GUI on Linux and macOS
|
||||
|
||||
To run the GUI, simply use this command:
|
||||
Run the launcher script with the desired command line arguments similar to Windows.
|
||||
`gui.sh --listen 127.0.0.1 --server_port 7860 --inbrowser --share`
|
||||
|
||||
## Launching the GUI directly using kohya_gui.py
|
||||
|
||||
To run the GUI directly bypassing the wrapper scripts, simply use this command from the root project directory:
|
||||
|
||||
```
|
||||
.\venv\Scripts\activate
|
||||
|
||||
python.exe .\kohya_gui.py
|
||||
python .\kohya_gui.py
|
||||
```
|
||||
|
||||
## Dreambooth
|
||||
@ -192,20 +257,6 @@ This will store your a backup file with your current locally installed pip packa
|
||||
|
||||
## Change History
|
||||
|
||||
* 2023/04/01 (v21.4.0)
|
||||
- Fix an issue that `merge_lora.py` does not work with the latest version.
|
||||
- Fix an issue that `merge_lora.py` does not merge Conv2d3x3 weights.
|
||||
- Fix an issue that the VRAM usage temporarily increases when loading a model in `train_network.py`.
|
||||
- Fix an issue that an error occurs when loading a `.safetensors` model in `train_network.py`. [#354](https://github.com/kohya-ss/sd-scripts/issues/354)
|
||||
- Support [P+](https://prompt-plus.github.io/) training. Thank you jakaline-dev!
|
||||
- See [#327](https://github.com/kohya-ss/sd-scripts/pull/327) for details.
|
||||
- Use `train_textual_inversion_XTI.py` for training. The usage is almost the same as `train_textual_inversion.py`. However, sample image generation during training is not supported.
|
||||
- Use `gen_img_diffusers.py` for image generation (I think Web UI is not supported). Specify the embedding with `--XTI_embeddings` option.
|
||||
- Reduce RAM usage at startup in `train_network.py`. [#332](https://github.com/kohya-ss/sd-scripts/pull/332) Thank you guaneec!
|
||||
- Support pre-merge for LoRA in `gen_img_diffusers.py`. Specify `--network_merge` option. Note that the `--am` option of the prompt option is no longer available with this option.
|
||||
* 2023/04/01 (v21.3.9)
|
||||
- Update how setup is done on Windows by introducing a setup.bat script. This will make it easier to install/re-install on Windows if needed. Many thanks to @missionfloyd for his PR: https://github.com/bmaltais/kohya_ss/pull/496
|
||||
- Fix issue with WD14 caption script by applying a custom fix to kohya_ss code.
|
||||
* 2023/03/30 (v21.3.8)
|
||||
- Fix issue with LyCORIS version not being found: https://github.com/bmaltais/kohya_ss/issues/481
|
||||
* 2023/03/29 (v21.3.7)
|
||||
@ -219,7 +270,7 @@ This will store your a backup file with your current locally installed pip packa
|
||||
- Fix an issue that images are loaded twice in Windows environment.
|
||||
- Add Min-SNR Weighting strategy. Details are in [#308](https://github.com/kohya-ss/sd-scripts/pull/308). Thank you to AI-Casanova for this great work!
|
||||
- Add `--min_snr_gamma` option to training scripts, 5 is recommended by paper.
|
||||
- The Min SNR gamma fields can be found under the advanced training tab in all trainers.
|
||||
- The Min SNR gamma fiels can be found unser the advanced training tab in all trainers.
|
||||
- Fixed the error while images are ended with capital image extensions. Thanks to @kvzn. https://github.com/bmaltais/kohya_ss/pull/454
|
||||
* 2023/03/26 (v21.3.5)
|
||||
- Fix for https://github.com/bmaltais/kohya_ss/issues/230
|
||||
@ -227,11 +278,11 @@ This will store your a backup file with your current locally installed pip packa
|
||||
* 2023/03/25 (v21.3.4)
|
||||
- Added untested support for MacOS base on this gist: https://gist.github.com/jstayco/9f5733f05b9dc29de95c4056a023d645
|
||||
|
||||
Let me know how this work. From the look of it it appears to be well-thought-out. I modified a few things to make it fit better with the rest of the code in the repo.
|
||||
Let me know how this work. From the look of it it appear to be well tought out. I modified a few things to make it fit better with the rest of the code in the repo.
|
||||
- Fix for issue https://github.com/bmaltais/kohya_ss/issues/433 by implementing default of 0.
|
||||
- Removed non applicable save_model_as choices for LoRA and TI.
|
||||
* 2023/03/24 (v21.3.3)
|
||||
- Add support for custom user gui files. THey will be created at installation time or when upgrading is missing. You will see two files in the root of the folder. One named `gui-user.bat` and the other `gui-user.ps1`. Edit the file based on your preferred terminal. Simply add the parameters you want to pass the gui in there and execute it to start the gui with them. Enjoy!
|
||||
- Add support for custom user gui files. THey will be created at installation time or when upgrading is missing. You will see two files in the root of the folder. One named `gui-user.bat` and the other `gui-user.ps1`. Edit the file based on your prefered terminal. Simply add the parameters you want to pass the gui in there and execute it to start the gui with them. Enjoy!
|
||||
* 2023/03/23 (v21.3.2)
|
||||
- Fix issue reported: https://github.com/bmaltais/kohya_ss/issues/439
|
||||
* 2023/03/23 (v21.3.1)
|
||||
|
22
config_files/accelerate/default_config.yaml
Normal file
22
config_files/accelerate/default_config.yaml
Normal file
@ -0,0 +1,22 @@
|
||||
command_file: null
|
||||
commands: null
|
||||
compute_environment: LOCAL_MACHINE
|
||||
deepspeed_config: {}
|
||||
distributed_type: 'NO'
|
||||
downcast_bf16: 'no'
|
||||
dynamo_backend: 'NO'
|
||||
fsdp_config: {}
|
||||
gpu_ids: all
|
||||
machine_rank: 0
|
||||
main_process_ip: null
|
||||
main_process_port: null
|
||||
main_training_function: main
|
||||
megatron_lm_config: {}
|
||||
mixed_precision: 'no'
|
||||
num_machines: 1
|
||||
num_processes: 1
|
||||
rdzv_backend: static
|
||||
same_network: true
|
||||
tpu_name: null
|
||||
tpu_zone: null
|
||||
use_cpu: false
|
14
gui.sh
14
gui.sh
@ -1,13 +1,9 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Activate the virtual environment
|
||||
source venv/bin/activate
|
||||
source ./venv/bin/activate
|
||||
|
||||
# Validate the requirements and store the exit code
|
||||
python tools/validate_requirements.py
|
||||
exit_code=$?
|
||||
|
||||
# If the exit code is 0, run the kohya_gui.py script with the command-line arguments
|
||||
if [ $exit_code -eq 0 ]; then
|
||||
# If the requirements are validated, run the kohya_gui.py script with the command-line arguments
|
||||
if python tools/validate_requirements.py; then
|
||||
python kohya_gui.py "$@"
|
||||
fi
|
||||
fi
|
13
gui_macos.sh
13
gui_macos.sh
@ -1,13 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Activate the virtual environment
|
||||
source venv/bin/activate
|
||||
|
||||
# Validate the requirements and store the exit code
|
||||
python tools/validate_requirements.py --requirements requirements_macos.txt
|
||||
exit_code=$?
|
||||
|
||||
# If the exit code is 0, run the kohya_gui.py script with the command-line arguments
|
||||
if [ $exit_code -eq 0 ]; then
|
||||
python kohya_gui.py "$@"
|
||||
fi
|
@ -1,38 +0,0 @@
|
||||
#!/bin/bash
|
||||
# The initial setup script to prep the environment on macOS
|
||||
# xformers has been omitted as that is for Nvidia GPUs only
|
||||
|
||||
if ! command -v brew >/dev/null; then
|
||||
echo "Please install homebrew first. This is a requirement for the remaining setup."
|
||||
echo "You can find that here: https://brew.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Install base python packages
|
||||
echo "Installing Python 3.10 if not found."
|
||||
brew ls --versions python@3.10 >/dev/null || brew install python@3.10
|
||||
echo "Installing Python-TK 3.10 if not found."
|
||||
brew ls --versions python-tk@3.10 >/dev/null || brew install python-tk@3.10
|
||||
|
||||
if command -v python3.10 >/dev/null; then
|
||||
python3.10 -m venv venv
|
||||
source venv/bin/activate
|
||||
|
||||
# DEBUG ONLY
|
||||
#pip install pydevd-pycharm~=223.8836.43
|
||||
|
||||
# Tensorflow installation
|
||||
if wget https://github.com/apple/tensorflow_macos/releases/download/v0.1alpha3/tensorflow_macos-0.1a3-cp38-cp38-macosx_11_0_arm64.whl /tmp; then
|
||||
python -m pip install tensorflow==0.1a3 -f https://github.com/apple/tensorflow_macos/releases/download/v0.1alpha3/tensorflow_macos-0.1a3-cp38-cp38-macosx_11_0_arm64.whl
|
||||
rm -f /tmp/tensorflow_macos-0.1a3-cp38-cp38-macosx_11_0_arm64.whl
|
||||
fi
|
||||
|
||||
pip install torch==2.0.0 torchvision==0.15.1 -f https://download.pytorch.org/whl/cpu/torch_stable.html
|
||||
python -m pip install --use-pep517 --upgrade -r requirements_macos.txt
|
||||
accelerate config
|
||||
echo -e "Setup finished! Run ./gui_macos.sh to start."
|
||||
else
|
||||
echo "Python not found. Please ensure you install Python."
|
||||
echo "The brew command for Python 3.10 is: brew install python@3.10"
|
||||
exit 1
|
||||
fi
|
@ -7,12 +7,14 @@ diffusers[torch]==0.10.2
|
||||
easygui==0.98.3
|
||||
einops==0.6.0
|
||||
ftfy==6.1.1
|
||||
gradio==3.19.1
|
||||
gradio==3.19.1; sys_platform != 'darwin'
|
||||
gradio==3.23.0; sys_platform == 'darwin'
|
||||
lion-pytorch==0.0.6
|
||||
opencv-python==4.7.0.68
|
||||
pytorch-lightning==1.9.0
|
||||
safetensors==0.2.6
|
||||
tensorboard==2.10.1
|
||||
tensorboard==2.10.1 ; sys_platform != 'darwin'
|
||||
tensorboard==2.12.1 ; sys_platform == 'darwin'
|
||||
tk==0.1.0
|
||||
toml==0.10.2
|
||||
transformers==4.26.0
|
||||
@ -23,7 +25,8 @@ requests==2.28.2
|
||||
timm==0.6.12
|
||||
# tensorflow<2.11
|
||||
huggingface-hub==0.13.0
|
||||
tensorflow==2.10.1
|
||||
tensorflow==2.10.1; sys_platform != 'darwin'
|
||||
tensorflow-macos==2.12.0; sys_platform == 'darwin'
|
||||
# For locon support
|
||||
lycoris-lora @ git+https://github.com/KohakuBlueleaf/LyCORIS.git@c3d925421209a22a60d863ffa3de0b3e7e89f047
|
||||
# lycoris_lora==0.1.4
|
||||
|
@ -1,32 +0,0 @@
|
||||
accelerate==0.15.0
|
||||
albumentations==1.3.0
|
||||
altair==4.2.2
|
||||
bitsandbytes==0.35.0
|
||||
dadaptation==1.5
|
||||
diffusers[torch]==0.10.2
|
||||
easygui==0.98.3
|
||||
einops==0.6.0
|
||||
ftfy==6.1.1
|
||||
gradio==3.19.1; sys_platform != 'darwin'
|
||||
gradio==3.23.0; sys_platform == 'darwin'
|
||||
lion-pytorch==0.0.6
|
||||
opencv-python==4.7.0.68
|
||||
pytorch-lightning==1.9.0
|
||||
safetensors==0.2.6
|
||||
tensorboard==2.10.1
|
||||
tk==0.1.0
|
||||
toml==0.10.2
|
||||
transformers==4.26.0
|
||||
voluptuous==0.13.1
|
||||
# for BLIP captioning
|
||||
fairscale==0.4.13
|
||||
requests==2.28.2
|
||||
timm==0.6.12
|
||||
# tensorflow<2.11
|
||||
huggingface-hub==0.12.0; sys_platform != 'darwin'
|
||||
huggingface-hub==0.13.0; sys_platform == 'darwin'
|
||||
tensorflow==2.10.1; sys_platform != 'darwin'
|
||||
# For locon support
|
||||
lycoris_lora==0.1.2
|
||||
# for kohya_ss library
|
||||
.
|
75
setup.sh
75
setup.sh
@ -33,10 +33,10 @@ EOF
|
||||
# Checks to see if variable is set and non-empty.
|
||||
# This is defined first, so we can use the function for some default variable values
|
||||
env_var_exists() {
|
||||
if [[ -n "${!1}" ]]; then
|
||||
return 0
|
||||
else
|
||||
if [[ ! -v "$1" ]] || [[ -z "$1" ]]; then
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
@ -84,7 +84,6 @@ INTERACTIVE=false
|
||||
PUBLIC=false
|
||||
SKIP_SPACE_CHECK=false
|
||||
SKIP_GIT_UPDATE=false
|
||||
MANUAL_BRANCH_SWITCH=false
|
||||
|
||||
while getopts ":vb:d:g:inprs-:" opt; do
|
||||
# support long options: https://stackoverflow.com/a/28466267/519360
|
||||
@ -94,7 +93,7 @@ while getopts ":vb:d:g:inprs-:" opt; do
|
||||
OPTARG="${OPTARG#=}" # if long option argument, remove assigning `=`
|
||||
fi
|
||||
case $opt in
|
||||
b | branch) BRANCH="$OPTARG" && MANUAL_BRANCH_SWITCH=true ;;
|
||||
b | branch) BRANCH="$OPTARG" ;;
|
||||
d | dir) DIR="$OPTARG" ;;
|
||||
g | git-repo) GIT_REPO="$OPTARG" ;;
|
||||
i | interactive) INTERACTIVE=true ;;
|
||||
@ -150,17 +149,6 @@ Script directory is ${SCRIPT_DIR}." >&5
|
||||
PARENT_DIR="$(dirname "${DIR}")"
|
||||
VENV_DIR="$DIR/venv"
|
||||
|
||||
if [ -w "$PARENT_DIR" ] && [ ! -d "$DIR" ]; then
|
||||
echo "Creating install folder ${DIR}."
|
||||
mkdir "$DIR"
|
||||
fi
|
||||
|
||||
if [ ! -w "$DIR" ]; then
|
||||
echo "We cannot write to ${DIR}."
|
||||
echo "Please ensure the install directory is accurate and you have the correct permissions."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Shared functions
|
||||
# This checks for free space on the installation drive and returns that in Gb.
|
||||
size_available() {
|
||||
@ -225,7 +213,7 @@ install_python_dependencies() {
|
||||
|
||||
# Updating pip if there is one
|
||||
echo "Checking for pip updates before Python operations."
|
||||
pip install --upgrade pip >&3
|
||||
python3 -m pip install --upgrade pip >&3
|
||||
|
||||
echo "Installing python dependencies. This could take a few minutes as it downloads files."
|
||||
echo "If this operation ever runs too long, you can rerun this script in verbose mode to check."
|
||||
@ -343,28 +331,19 @@ update_kohya_ss() {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Attempting to clone ${GIT_REPO}:${BRANCH}"
|
||||
echo "Attempting to clone $GIT_REPO."
|
||||
if [ ! -d "$DIR/.git" ]; then
|
||||
git -C "$PARENT_DIR" clone -b "$BRANCH" "$GIT_REPO" "$(basename "$DIR")" >&3
|
||||
echo "Cloning and switching to $GIT_REPO:$BRANCH" >*4
|
||||
git -C "$DIR" clone -b "$BRANCH" "$GIT_REPO" "$(basename "$DIR")" >&3
|
||||
git -C "$DIR" switch "$BRANCH" >&4
|
||||
else
|
||||
echo "git repo detected. Attempting to update repository instead."
|
||||
echo "Updating: $GIT_REPO"
|
||||
if [ "$MANUAL_BRANCH_SWITCH" = false ]; then
|
||||
git -C "$DIR" pull "$GIT_REPO" "$(git rev-parse --abbrev-ref HEAD)" >&3
|
||||
else
|
||||
git -C "$DIR" pull "$GIT_REPO" "$BRANCH" >&3
|
||||
git -C "$DIR" pull "$GIT_REPO" "$BRANCH" >&3
|
||||
if ! git -C "$DIR" switch "$BRANCH" >&4; then
|
||||
echo "Branch $BRANCH did not exist. Creating it." >&4
|
||||
git -C "$DIR" switch -c "$BRANCH" >&4
|
||||
fi
|
||||
|
||||
if [ "$MANUAL_BRANCH_SWITCH" = false ]; then
|
||||
git -C "$DIR" switch "$(git rev-parse --abbrev-ref HEAD)" >&3
|
||||
else
|
||||
if ! git -C "$DIR" switch "$BRANCH" >&4; then
|
||||
echo "Branch $BRANCH did not exist. Creating it." >&4
|
||||
git -C "$DIR" switch -c "$BRANCH" >&4
|
||||
fi
|
||||
fi
|
||||
|
||||
fi
|
||||
else
|
||||
echo "You need to install git."
|
||||
@ -437,6 +416,17 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||
}
|
||||
|
||||
check_storage_space
|
||||
|
||||
# This is the pre-install work for a kohya installation on a runpod
|
||||
if [ "$RUNPOD" = true ]; then
|
||||
if [ -d "$VENV_DIR" ]; then
|
||||
echo "Pre-existing installation on a runpod detected."
|
||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"$VENV_DIR"/lib/python3.10/site-packages/tensorrt/
|
||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"$VENV_DIR"/lib/python3.10/site-packages/nvidia/cuda_runtime/lib/
|
||||
cd "$DIR" || exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
update_kohya_ss
|
||||
|
||||
distro=get_distro_name
|
||||
@ -516,17 +506,8 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||
create_symlinks "$libnvinfer_symlink" "$libnvinfer_target"
|
||||
create_symlinks "$libcudart_symlink" "$libcudart_target"
|
||||
|
||||
if [ -d "${VENV_DIR}/lib/python3.10/site-packages/tensorrt/" ]; then
|
||||
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${VENV_DIR}/lib/python3.10/site-packages/tensorrt/"
|
||||
else
|
||||
echo "${VENV_DIR}/lib/python3.10/site-packages/tensorrt/ not found; not linking library."
|
||||
fi
|
||||
|
||||
if [ -d "${VENV_DIR}/lib/python3.10/site-packages/tensorrt/" ]; then
|
||||
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${VENV_DIR}/lib/python3.10/site-packages/nvidia/cuda_runtime/lib/"
|
||||
else
|
||||
echo "${VENV_DIR}/lib/python3.10/site-packages/nvidia/cuda_runtime/lib/ not found; not linking library."
|
||||
fi
|
||||
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$VENV_DIR/lib/python3.10/site-packages/tensorrt/"
|
||||
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$VENV_DIR/lib/python3.10/site-packages/nvidia/cuda_runtime/lib/"
|
||||
|
||||
configure_accelerate
|
||||
|
||||
@ -588,10 +569,10 @@ elif [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
configure_accelerate
|
||||
echo -e "Setup finished! Run ./gui.sh to start."
|
||||
elif [[ "$OSTYPE" == "cygwin" ]]; then
|
||||
# Cygwin is a standalone suite of Linux utilities on Windows
|
||||
# Cygwin is a standalone suite of Linux utilies on Windows
|
||||
echo "This hasn't been validated on cygwin yet."
|
||||
elif [[ "$OSTYPE" == "msys" ]]; then
|
||||
# MinGW has the msys environment which is a standalone suite of Linux utilities on Windows
|
||||
# MinGW has the msys environment which is a standalone suite of Linux utilies on Windows
|
||||
# "git bash" on Windows may also be detected as msys.
|
||||
echo "This hasn't been validated in msys (mingw) on Windows yet."
|
||||
fi
|
||||
fi
|
@ -1,12 +0,0 @@
|
||||
#!/bin/bash
|
||||
echo installing tk
|
||||
sudo apt install python3-tk
|
||||
python3 -m venv venv
|
||||
source venv/bin/activate
|
||||
pip install torch==1.12.1+cu116 torchvision==0.13.1+cu116 --extra-index-url https://download.pytorch.org/whl/cu116
|
||||
pip install --use-pep517 --upgrade -r requirements.txt
|
||||
pip install -U -I --no-deps https://github.com/C43H66N12O12S2/stable-diffusion-webui/releases/download/linux/xformers-0.0.14.dev0-cp310-cp310-linux_x86_64.whl
|
||||
|
||||
accelerate config
|
||||
|
||||
echo -e "setup finished! run \e[0;92m./gui.sh\e[0m to start"
|
16
upgrade.sh
16
upgrade.sh
@ -1,16 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Check if there are any changes that need to be committed
|
||||
if [[ -n $(git status --short) ]]; then
|
||||
echo "There are changes that need to be committed. Please stash or undo your changes before running this script." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Pull the latest changes from the remote repository
|
||||
git pull
|
||||
|
||||
# Activate the virtual environment
|
||||
source venv/bin/activate
|
||||
|
||||
# Upgrade the required packages
|
||||
pip install --upgrade -r requirements.txt
|
@ -1,16 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Check if there are any changes that need to be committed
|
||||
if [[ -n $(git status --short) ]]; then
|
||||
echo "There are changes that need to be committed. Please stash or undo your changes before running this script." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Pull the latest changes from the remote repository
|
||||
git pull
|
||||
|
||||
# Activate the virtual environment
|
||||
source venv/bin/activate
|
||||
|
||||
# Upgrade the required packages
|
||||
pip install --upgrade -r requirements_macos.txt
|
Loading…
Reference in New Issue
Block a user