diff --git a/README-ja.md b/README-ja.md index 064464c..319efe9 100644 --- a/README-ja.md +++ b/README-ja.md @@ -38,6 +38,18 @@ PowerShellを使う場合、venvを使えるようにするためには以下の - 「Set-ExecutionPolicy Unrestricted」と入力し、Yと答えます。 - 管理者のPowerShellを閉じます。 +## Ubuntu環境でのインストール + +``` +git clone https://github.com/kohya-ss/sd-scripts.git +cd sd-scripts +bash ubuntu_setup.sh +``` + +をコマンドプロンプトで実行し、tkをインストールし、accelerateの質問をWindowsと同じように答えます。 + +`./gui.sh`でGUIを実行します。 + ## Windows環境でのインストール 以下の例ではPyTorchは1.12.1/CUDA 11.6版をインストールします。CUDA 11.3版やPyTorch 1.13を使う場合は適宜書き換えください。 diff --git a/README.md b/README.md index 7c5dc8f..2dd649b 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,19 @@ If you run on Linux and would like to use the GUI, there is now a port of it as ## Installation +### Ubuntu +In the terminal, run + +``` +git clone https://github.com/bmaltais/kohya_ss.git +cd kohya_ss +bash ubuntu_setup.sh +``` + +then configure accelerate with the same answers as in the Windows instructions when prompted. + +### Windows + Give unrestricted script access to powershell so venv can work: - Run PowerShell as an administrator diff --git a/ubuntu_setup.sh b/ubuntu_setup.sh new file mode 100755 index 0000000..5bc862b --- /dev/null +++ b/ubuntu_setup.sh @@ -0,0 +1,29 @@ +#!/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 + +rm *.bat +rm *.ps1 + +set +H +echo "#!/bin/bash" > gui.sh +echo "source venv/bin/activate" >> gui.sh +echo "python kohya_gui.py $@" >> gui.sh +chmod +x gui.sh +sources=$(find $(ls | grep -v venv) | egrep "\.py$") + +for source in $sources +do + #fix accelerate commands + sed -i -r 's/(accelerate launch .*?)"(.+?\.py)"/\1\2/g' $source + sed -i -r 's/subprocess.run\(run_cmd\)/subprocess.run(run_cmd, shell=True)/g' $source +done + +echo -e "setup finished! run \e[0;92m./gui.sh\e[0m to start"