From 253ab8d92499915bc80e71b67793d9b7fb8e0fc9 Mon Sep 17 00:00:00 2001 From: gabriel dhimoila Date: Tue, 23 Jan 2024 23:14:55 +0100 Subject: [PATCH 1/2] cudann -> cudnn --- README.md | 4 +-- ...55\346\226\207\346\225\231\347\250\213.md" | 2 +- setup/setup_windows.py | 34 ++++++------------- 3 files changed, 13 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index bddda2d54..e21f4be91 100644 --- a/README.md +++ b/README.md @@ -109,7 +109,7 @@ Please note that the CUDNN 8.6 DLLs needed for this process cannot be hosted on 1. Unzip the downloaded file and place the `cudnn_windows` folder in the root directory of the `kohya_ss` repository. -2. Run .\setup.bat and select the option to install cudann. +2. Run .\setup.bat and select the option to install cudnn. ### Linux and macOS @@ -122,7 +122,7 @@ To install the necessary dependencies on a Linux system, ensure that you fulfill apt install python3.10-venv ``` -- Install the cudaNN drivers by following the instructions provided in [this link](https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64). +- Install the cuDNN drivers by following the instructions provided in [this link](https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64). - Make sure you have Python version 3.10.6 or higher (but lower than 3.11.0) installed on your system. diff --git "a/README_\344\270\255\346\226\207\346\225\231\347\250\213.md" "b/README_\344\270\255\346\226\207\346\225\231\347\250\213.md" index c58afaf50..63bf3700d 100644 --- "a/README_\344\270\255\346\226\207\346\225\231\347\250\213.md" +++ "b/README_\344\270\255\346\226\207\346\225\231\347\250\213.md" @@ -21,7 +21,7 @@ GUI和PowerShell脚本等使其更易用的功能在[bmaltais的仓库](https:// Kohya_ss GUI setup menu: 1. Install kohya_ss gui -2. (Optional) Install cudann files (avoid unless you really need it) +2. (Optional) Install cuDNN files (avoid unless you really need it) 3. (Optional) Install specific bitsandbytes versions 4. (Optional) Manually configure accelerate 5. (Optional) Start Kohya_ss GUI in browser diff --git a/setup/setup_windows.py b/setup/setup_windows.py index f11e3a9e4..c814f4585 100644 --- a/setup/setup_windows.py +++ b/setup/setup_windows.py @@ -14,10 +14,8 @@ RESET_COLOR = "\033[0m" -def cudann_install(): - cudnn_src = os.path.join( - os.path.dirname(os.path.realpath(__file__)), "..\cudnn_windows" - ) +def cudnn_install(): + cudnn_src = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..\cudnn_windows") cudnn_dest = os.path.join(sysconfig.get_paths()["purelib"], "torch", "lib") log.info(f"Checking for CUDNN files in {cudnn_dest}...") @@ -77,12 +75,8 @@ def sync_bits_and_bytes_files(): dest_file_path = os.path.join(dest_dir, file) # Compare the source file with the destination file - if os.path.exists(dest_file_path) and filecmp.cmp( - source_file_path, dest_file_path - ): - log.debug( - f"Skipping {source_file_path} as it already exists in {dest_dir}" - ) + if os.path.exists(dest_file_path) and filecmp.cmp(source_file_path, dest_file_path): + log.debug(f"Skipping {source_file_path} as it already exists in {dest_dir}") else: # Copy file from source to destination, maintaining original file's metadata log.debug(f"Copy {source_file_path} to {dest_dir}") @@ -103,9 +97,7 @@ def install_kohya_ss_torch2(): # Upgrade pip if needed setup_common.install("--upgrade pip") - setup_common.install_requirements( - "requirements_windows_torch2.txt", check_no_verify_flag=False - ) + setup_common.install_requirements("requirements_windows_torch2.txt", check_no_verify_flag=False) sync_bits_and_bytes_files() setup_common.configure_accelerate(run_accelerate=True) @@ -115,9 +107,7 @@ def install_kohya_ss_torch2(): def install_bitsandbytes_0_35_0(): log.info("Installing bitsandbytes 0.35.0...") - setup_common.install( - "--upgrade bitsandbytes==0.35.0", "bitsandbytes 0.35.0", reinstall=True - ) + setup_common.install("--upgrade bitsandbytes==0.35.0", "bitsandbytes 0.35.0", reinstall=True) sync_bits_and_bytes_files() @@ -144,7 +134,7 @@ def main_menu(): while True: print("\nKohya_ss GUI setup menu:\n") print("1. Install kohya_ss gui") - print("2. (Optional) Install cudann files (avoid unless you really need it)") + print("2. (Optional) Install cuDNN files (avoid unless you really need it)") print("3. (Optional) Install specific bitsandbytes versions") print("4. (Optional) Manually configure accelerate") print("5. (Optional) Start Kohya_ss GUI in browser") @@ -156,16 +146,14 @@ def main_menu(): if choice == "1": install_kohya_ss_torch2() elif choice == "2": - cudann_install() + cudnn_install() elif choice == "3": while True: print("1. (Optional) Force installation of bitsandbytes 0.35.0") print( "2. (Optional) Force installation of bitsandbytes 0.40.1 for new optimizer options support and pre-bugfix results" ) - print( - "3. (Optional) Force installation of bitsandbytes 0.41.1 for new optimizer options support" - ) + print("3. (Optional) Force installation of bitsandbytes 0.41.1 for new optimizer options support") print( "4. (Danger) Install bitsandbytes-windows (this package has been reported to cause issues for most... avoid...)" ) @@ -183,9 +171,7 @@ def main_menu(): install_bitsandbytes_0_41_1() break elif choice_torch == "4": - setup_common.install( - "--upgrade bitsandbytes-windows", reinstall=True - ) + setup_common.install("--upgrade bitsandbytes-windows", reinstall=True) break elif choice_torch == "5": break From a5558786c93b125ba012ebdfdc93a7872d2a622c Mon Sep 17 00:00:00 2001 From: gabriel dhimoila Date: Tue, 23 Jan 2024 23:21:16 +0100 Subject: [PATCH 2/2] revert vscode formattage --- README.md | 2 +- ...55\346\226\207\346\225\231\347\250\213.md" | 2 +- setup/setup_windows.py | 30 ++++++++++++++----- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index e21f4be91..b8026d6c4 100644 --- a/README.md +++ b/README.md @@ -122,7 +122,7 @@ To install the necessary dependencies on a Linux system, ensure that you fulfill apt install python3.10-venv ``` -- Install the cuDNN drivers by following the instructions provided in [this link](https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64). +- Install the cudNN drivers by following the instructions provided in [this link](https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64). - Make sure you have Python version 3.10.6 or higher (but lower than 3.11.0) installed on your system. diff --git "a/README_\344\270\255\346\226\207\346\225\231\347\250\213.md" "b/README_\344\270\255\346\226\207\346\225\231\347\250\213.md" index 63bf3700d..cb1af47db 100644 --- "a/README_\344\270\255\346\226\207\346\225\231\347\250\213.md" +++ "b/README_\344\270\255\346\226\207\346\225\231\347\250\213.md" @@ -21,7 +21,7 @@ GUI和PowerShell脚本等使其更易用的功能在[bmaltais的仓库](https:// Kohya_ss GUI setup menu: 1. Install kohya_ss gui -2. (Optional) Install cuDNN files (avoid unless you really need it) +2. (Optional) Install cudnn files (avoid unless you really need it) 3. (Optional) Install specific bitsandbytes versions 4. (Optional) Manually configure accelerate 5. (Optional) Start Kohya_ss GUI in browser diff --git a/setup/setup_windows.py b/setup/setup_windows.py index c814f4585..4dc1c0329 100644 --- a/setup/setup_windows.py +++ b/setup/setup_windows.py @@ -15,7 +15,9 @@ def cudnn_install(): - cudnn_src = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..\cudnn_windows") + cudnn_src = os.path.join( + os.path.dirname(os.path.realpath(__file__)), "..\cudnn_windows" + ) cudnn_dest = os.path.join(sysconfig.get_paths()["purelib"], "torch", "lib") log.info(f"Checking for CUDNN files in {cudnn_dest}...") @@ -75,8 +77,12 @@ def sync_bits_and_bytes_files(): dest_file_path = os.path.join(dest_dir, file) # Compare the source file with the destination file - if os.path.exists(dest_file_path) and filecmp.cmp(source_file_path, dest_file_path): - log.debug(f"Skipping {source_file_path} as it already exists in {dest_dir}") + if os.path.exists(dest_file_path) and filecmp.cmp( + source_file_path, dest_file_path + ): + log.debug( + f"Skipping {source_file_path} as it already exists in {dest_dir}" + ) else: # Copy file from source to destination, maintaining original file's metadata log.debug(f"Copy {source_file_path} to {dest_dir}") @@ -97,7 +103,9 @@ def install_kohya_ss_torch2(): # Upgrade pip if needed setup_common.install("--upgrade pip") - setup_common.install_requirements("requirements_windows_torch2.txt", check_no_verify_flag=False) + setup_common.install_requirements( + "requirements_windows_torch2.txt", check_no_verify_flag=False + ) sync_bits_and_bytes_files() setup_common.configure_accelerate(run_accelerate=True) @@ -107,7 +115,9 @@ def install_kohya_ss_torch2(): def install_bitsandbytes_0_35_0(): log.info("Installing bitsandbytes 0.35.0...") - setup_common.install("--upgrade bitsandbytes==0.35.0", "bitsandbytes 0.35.0", reinstall=True) + setup_common.install( + "--upgrade bitsandbytes==0.35.0", "bitsandbytes 0.35.0", reinstall=True + ) sync_bits_and_bytes_files() @@ -134,7 +144,7 @@ def main_menu(): while True: print("\nKohya_ss GUI setup menu:\n") print("1. Install kohya_ss gui") - print("2. (Optional) Install cuDNN files (avoid unless you really need it)") + print("2. (Optional) Install cudnn files (avoid unless you really need it)") print("3. (Optional) Install specific bitsandbytes versions") print("4. (Optional) Manually configure accelerate") print("5. (Optional) Start Kohya_ss GUI in browser") @@ -153,7 +163,9 @@ def main_menu(): print( "2. (Optional) Force installation of bitsandbytes 0.40.1 for new optimizer options support and pre-bugfix results" ) - print("3. (Optional) Force installation of bitsandbytes 0.41.1 for new optimizer options support") + print( + "3. (Optional) Force installation of bitsandbytes 0.41.1 for new optimizer options support" + ) print( "4. (Danger) Install bitsandbytes-windows (this package has been reported to cause issues for most... avoid...)" ) @@ -171,7 +183,9 @@ def main_menu(): install_bitsandbytes_0_41_1() break elif choice_torch == "4": - setup_common.install("--upgrade bitsandbytes-windows", reinstall=True) + setup_common.install( + "--upgrade bitsandbytes-windows", reinstall=True + ) break elif choice_torch == "5": break