Skip to content

Instantly share code, notes, and snippets.

@jstayco
Last active September 25, 2024 19:50
Show Gist options
  • Save jstayco/9f5733f05b9dc29de95c4056a023d645 to your computer and use it in GitHub Desktop.
Save jstayco/9f5733f05b9dc29de95c4056a023d645 to your computer and use it in GitHub Desktop.
Setup script for Kohya SS on macOS

MacOS (Apple Silicon)

In the terminal, run

git clone https://github.com/bmaltais/kohya_ss.git
cd kohya_ss
# Patch these files into top level/root project folder
# Then run the next command
bash ./macos.sh

During the accelerate config screen after running the script answer "This machine", "None", "No" for the remaining questions.

#!/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 [email protected] >/dev/null || brew install [email protected]
echo "Installing Python-TK 3.10 if not found."
brew ls --versions [email protected] >/dev/null || brew install [email protected]
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.txt
accelerate config
echo -e "Setup finished! Run ./gui.sh to start."
else
echo "Python not found. Please ensure you install Python."
echo "The brew command for Python 3.10 is: brew install [email protected]"
exit 1
fi
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
.
@retret66
Copy link

retret66 commented Sep 8, 2023

setup still doesnt work using gui, I created my own branch from kohya_ss which works with MPS , however I just run the script not the gui but it works with GPU acceleration. and followed this after: https://hackmd.io/@cy2023/r1_sKqlg3
https://github.com/retret66/sd-scripts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment