Merge pull request #496 from missionfloyd/setup-batch

Add setup/upgrade batch files
This commit is contained in:
bmaltais 2023-03-31 22:24:34 -04:00 committed by GitHub
commit 538752ccab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 28 deletions

View File

@ -64,36 +64,19 @@ cd kohya_ss
bash ubuntu_setup.sh
```
then configure accelerate with the same answers as in the Windows instructions when prompted.
then configure accelerate with the same answers as in the MacOS instructions when prompted.
### Windows
In the terminal, run
Give unrestricted script access to powershell so venv can work:
- Run PowerShell as an administrator
- Run `Set-ExecutionPolicy Unrestricted` and answer 'A'
- Close PowerShell
Open a regular user Powershell terminal and run the following commands:
```powershell
```
git clone https://github.com/bmaltais/kohya_ss.git
cd kohya_ss
python -m venv venv
.\venv\Scripts\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/f/xformers-0.0.14.dev0-cp310-cp310-win_amd64.whl
cp .\bitsandbytes_windows\*.dll .\venv\Lib\site-packages\bitsandbytes\
cp .\bitsandbytes_windows\cextension.py .\venv\Lib\site-packages\bitsandbytes\cextension.py
cp .\bitsandbytes_windows\main.py .\venv\Lib\site-packages\bitsandbytes\cuda_setup\main.py
accelerate config
setup.bat
```
then configure accelerate with the same answers as in the MacOS instructions when prompted.
### Optional: CUDNN 8.6
This step is optional but can improve the learning speed for NVIDIA 30X0/40X0 owners. It allows for larger training batch size and faster training speed.
@ -125,11 +108,7 @@ Once the commands have completed successfully you should be ready to use the new
When a new release comes out, you can upgrade your repo with the following commands in the root directory:
```powershell
git pull
.\venv\Scripts\activate
pip install --use-pep517 --upgrade -r requirements.txt
upgrade.bat
```
Once the commands have completed successfully you should be ready to use the new version.

13
setup.bat Normal file
View File

@ -0,0 +1,13 @@
@echo off
python -m venv venv
call .\venv\Scripts\activate.bat
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/f/xformers-0.0.14.dev0-cp310-cp310-win_amd64.whl
copy /y .\bitsandbytes_windows\*.dll .\venv\Lib\site-packages\bitsandbytes\
copy /y .\bitsandbytes_windows\cextension.py .\venv\Lib\site-packages\bitsandbytes\cextension.py
copy /y .\bitsandbytes_windows\main.py .\venv\Lib\site-packages\bitsandbytes\cuda_setup\main.py
accelerate config

16
upgrade.bat Normal file
View File

@ -0,0 +1,16 @@
@echo off
:: Check if there are any changes that need to be committed
git status --short
if %errorlevel%==1 (
echo There are changes that need to be committed. Please stash or undo your changes before running this script.
exit
)
:: Pull the latest changes from the remote repository
git pull
:: Activate the virtual environment
call .\venv\Scripts\activate.baT
:: Upgrade the required packages
pip install --upgrade -r requirements.txt