2022-09-17 18:12:14 +00:00
|
|
|
name: Create Caches
|
2022-10-25 21:27:38 +00:00
|
|
|
|
|
|
|
on: workflow_dispatch
|
|
|
|
|
2022-09-17 18:12:14 +00:00
|
|
|
jobs:
|
2022-10-25 21:27:38 +00:00
|
|
|
os_matrix:
|
2022-09-17 18:12:14 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2022-10-25 21:27:38 +00:00
|
|
|
os: [ubuntu-latest, macos-latest]
|
|
|
|
include:
|
|
|
|
- os: ubuntu-latest
|
|
|
|
environment-file: environment.yml
|
|
|
|
default-shell: bash -l {0}
|
|
|
|
- os: macos-latest
|
|
|
|
environment-file: environment-mac.yml
|
|
|
|
default-shell: bash -l {0}
|
|
|
|
name: Test invoke.py on ${{ matrix.os }} with conda
|
2022-09-17 18:12:14 +00:00
|
|
|
runs-on: ${{ matrix.os }}
|
2022-10-25 21:27:38 +00:00
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: ${{ matrix.default-shell }}
|
2022-09-17 18:12:14 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout sources
|
|
|
|
uses: actions/checkout@v3
|
2022-10-25 21:27:38 +00:00
|
|
|
|
|
|
|
- name: setup miniconda
|
|
|
|
uses: conda-incubator/setup-miniconda@v2
|
|
|
|
with:
|
|
|
|
auto-activate-base: false
|
|
|
|
auto-update-conda: false
|
|
|
|
miniconda-version: latest
|
|
|
|
|
|
|
|
- name: set environment
|
|
|
|
run: |
|
|
|
|
[[ "$GITHUB_REF" == 'refs/heads/main' ]] \
|
|
|
|
&& echo "TEST_PROMPTS=tests/preflight_prompts.txt" >> $GITHUB_ENV \
|
|
|
|
|| echo "TEST_PROMPTS=tests/dev_prompts.txt" >> $GITHUB_ENV
|
|
|
|
echo "CONDA_ROOT=$CONDA" >> $GITHUB_ENV
|
|
|
|
echo "CONDA_ENV_NAME=invokeai" >> $GITHUB_ENV
|
|
|
|
|
2022-09-17 18:12:14 +00:00
|
|
|
- name: Use Cached Stable Diffusion v1.4 Model
|
|
|
|
id: cache-sd-v1-4
|
|
|
|
uses: actions/cache@v3
|
|
|
|
env:
|
|
|
|
cache-name: cache-sd-v1-4
|
|
|
|
with:
|
|
|
|
path: models/ldm/stable-diffusion-v1/model.ckpt
|
|
|
|
key: ${{ env.cache-name }}
|
2022-10-25 21:27:38 +00:00
|
|
|
restore-keys: ${{ env.cache-name }}
|
|
|
|
|
2022-09-17 18:12:14 +00:00
|
|
|
- name: Download Stable Diffusion v1.4 Model
|
|
|
|
if: ${{ steps.cache-sd-v1-4.outputs.cache-hit != 'true' }}
|
|
|
|
run: |
|
2022-10-25 21:27:38 +00:00
|
|
|
[[ -d models/ldm/stable-diffusion-v1 ]] \
|
|
|
|
|| mkdir -p models/ldm/stable-diffusion-v1
|
|
|
|
[[ -r models/ldm/stable-diffusion-v1/model.ckpt ]] \
|
2022-10-28 18:41:04 +00:00
|
|
|
|| curl \
|
|
|
|
-H "Authorization: Bearer ${{ secrets.HUGGINGFACE_TOKEN }}" \
|
2022-10-28 17:35:01 +00:00
|
|
|
-o models/ldm/stable-diffusion-v1/model.ckpt \
|
2022-10-28 18:53:57 +00:00
|
|
|
-L https://huggingface.co/CompVis/stable-diffusion-v-1-4-original/resolve/main/sd-v1-4.ckpt
|
2022-10-25 21:27:38 +00:00
|
|
|
|
|
|
|
- name: Activate Conda Env
|
|
|
|
uses: conda-incubator/setup-miniconda@v2
|
|
|
|
with:
|
|
|
|
activate-environment: ${{ env.CONDA_ENV_NAME }}
|
|
|
|
environment-file: ${{ matrix.environment-file }}
|
|
|
|
|
2022-09-17 18:12:14 +00:00
|
|
|
- name: Use Cached Huggingface and Torch models
|
2022-10-25 21:27:38 +00:00
|
|
|
id: cache-hugginface-torch
|
2022-09-17 18:12:14 +00:00
|
|
|
uses: actions/cache@v3
|
|
|
|
env:
|
2022-10-25 21:27:38 +00:00
|
|
|
cache-name: cache-hugginface-torch
|
2022-09-17 18:12:14 +00:00
|
|
|
with:
|
|
|
|
path: ~/.cache
|
|
|
|
key: ${{ env.cache-name }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ env.cache-name }}-${{ hashFiles('scripts/preload_models.py') }}
|
2022-10-25 21:27:38 +00:00
|
|
|
|
|
|
|
- name: run preload_models.py
|
|
|
|
run: python scripts/preload_models.py
|