Skip to content

Instantly share code, notes, and snippets.

@jstayco
Last active February 19, 2025 03:17
Show Gist options
  • Select an option

  • Save jstayco/9f5733f05b9dc29de95c4056a023d645 to your computer and use it in GitHub Desktop.

Select an option

Save jstayco/9f5733f05b9dc29de95c4056a023d645 to your computer and use it in GitHub Desktop.

Revisions

  1. jstayco revised this gist Mar 24, 2023. 1 changed file with 12 additions and 0 deletions.
    12 changes: 12 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    ### 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.
  2. jstayco created this gist Mar 24, 2023.
    38 changes: 38 additions & 0 deletions macos_setup.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,38 @@
    #!/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 python@3.10 >/dev/null || brew install python@3.10
    echo "Installing Python-TK 3.10 if not found."
    brew ls --versions python-tk@3.10 >/dev/null || brew install python-tk@3.10

    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 python@3.10"
    exit 1
    fi
    32 changes: 32 additions & 0 deletions requirements.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    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
    .