From 0dbbaf5891bd71aca07805661e436a6053011f90 Mon Sep 17 00:00:00 2001 From: JSTayco Date: Sat, 1 Apr 2023 10:15:15 -0700 Subject: [PATCH 1/5] Keep current branch unless specified otherwise --- setup.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/setup.sh b/setup.sh index b07976e..1f564bb 100755 --- a/setup.sh +++ b/setup.sh @@ -84,6 +84,7 @@ 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 @@ -93,7 +94,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" ;; + b | branch) BRANCH="$OPTARG" && MANUAL_BRANCH_SWITCH=true ;; d | dir) DIR="$OPTARG" ;; g | git-repo) GIT_REPO="$OPTARG" ;; i | interactive) INTERACTIVE=true ;; @@ -342,15 +343,19 @@ update_kohya_ss() { exit 1 fi - echo "Attempting to clone $GIT_REPO." + echo "Attempting to clone ${GIT_REPO}:${BRANCH}" if [ ! -d "$DIR/.git" ]; then - echo "Cloning and switching to $GIT_REPO:$BRANCH" >&4 git -C "$PARENT_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" - git -C "$DIR" pull "$GIT_REPO" "$BRANCH" >&3 + 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 + fi + if ! git -C "$DIR" switch "$BRANCH" >&4; then echo "Branch $BRANCH did not exist. Creating it." >&4 git -C "$DIR" switch -c "$BRANCH" >&4 From 69deea0979d804203b7a9ee203782fbb226335a1 Mon Sep 17 00:00:00 2001 From: JSTayco Date: Sat, 1 Apr 2023 10:17:36 -0700 Subject: [PATCH 2/5] Fix auto branch switch --- setup.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/setup.sh b/setup.sh index 1f564bb..7b40b49 100755 --- a/setup.sh +++ b/setup.sh @@ -356,10 +356,15 @@ update_kohya_ss() { git -C "$DIR" pull "$GIT_REPO" "$BRANCH" >&3 fi - if ! git -C "$DIR" switch "$BRANCH" >&4; then - echo "Branch $BRANCH did not exist. Creating it." >&4 - git -C "$DIR" switch -c "$BRANCH" >&4 + if [ "$MANUAL_BRANCH_SWITCH" = false ]; then + git -C "$DIR" switch "$BRANCH" >&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." From 14dc16ccd4f00d5b5d91ec4b5c797986fbaa6788 Mon Sep 17 00:00:00 2001 From: JSTayco Date: Sat, 1 Apr 2023 10:18:44 -0700 Subject: [PATCH 3/5] Minor fix to branch name --- setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.sh b/setup.sh index 7b40b49..80877aa 100755 --- a/setup.sh +++ b/setup.sh @@ -357,7 +357,7 @@ update_kohya_ss() { fi if [ "$MANUAL_BRANCH_SWITCH" = false ]; then - git -C "$DIR" switch "$BRANCH" >&3 + 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 From 2c470c6659e3c749b6038ad85955ddf3b7038419 Mon Sep 17 00:00:00 2001 From: JSTayco Date: Sat, 1 Apr 2023 10:37:20 -0700 Subject: [PATCH 4/5] Typo fixes --- README.md | 4 ++-- setup.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 04018cc..f74ca06 100644 --- a/README.md +++ b/README.md @@ -270,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 fiels can be found unser the advanced training tab in all trainers. + - The Min SNR gamma fields can be found under 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 @@ -278,7 +278,7 @@ 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 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. + 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. - 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) diff --git a/setup.sh b/setup.sh index 80877aa..553e801 100755 --- a/setup.sh +++ b/setup.sh @@ -588,10 +588,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 utilies on Windows + # Cygwin is a standalone suite of Linux utilities 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 utilies on Windows + # MinGW has the msys environment which is a standalone suite of Linux utilities 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 From 4fbd74ace89cc55739471fb7335fad7e35a2511e Mon Sep 17 00:00:00 2001 From: JSTayco Date: Sat, 1 Apr 2023 10:39:47 -0700 Subject: [PATCH 5/5] Missed two --- README.md | 2 +- upgrade.bat | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f74ca06..ee4c107 100644 --- a/README.md +++ b/README.md @@ -282,7 +282,7 @@ This will store your a backup file with your current locally installed pip packa - 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 prefered 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 preferred 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) diff --git a/upgrade.bat b/upgrade.bat index 787df73..c5256bf 100644 --- a/upgrade.bat +++ b/upgrade.bat @@ -10,7 +10,7 @@ if %errorlevel%==1 ( git pull :: Activate the virtual environment -call .\venv\Scripts\activate.baT +call .\venv\Scripts\activate.bat :: Upgrade the required packages pip install --upgrade -r requirements.txt \ No newline at end of file