2022-10-29 20:25:41 +00:00
|
|
|
name: Test invoke.py
|
2022-09-17 18:12:14 +00:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- 'main'
|
|
|
|
- 'development'
|
2022-10-29 21:48:25 +00:00
|
|
|
pull_request:
|
2022-10-25 21:27:38 +00:00
|
|
|
branches:
|
|
|
|
- 'main'
|
|
|
|
- 'development'
|
|
|
|
|
2022-09-17 18:12:14 +00:00
|
|
|
jobs:
|
2022-10-29 05:25:19 +00:00
|
|
|
matrix:
|
2022-09-17 18:12:14 +00:00
|
|
|
strategy:
|
2022-10-28 14:48:02 +00:00
|
|
|
fail-fast: false
|
2022-09-17 18:12:14 +00:00
|
|
|
matrix:
|
2022-10-29 05:25:19 +00:00
|
|
|
stable-diffusion-model:
|
2022-11-01 01:02:14 +00:00
|
|
|
# - 'https://huggingface.co/CompVis/stable-diffusion-v-1-4-original/resolve/main/sd-v1-4.ckpt'
|
2022-10-29 05:25:19 +00:00
|
|
|
- 'https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.ckpt'
|
|
|
|
os:
|
|
|
|
- ubuntu-latest
|
2022-10-29 08:03:03 +00:00
|
|
|
- macOS-12
|
2022-10-25 21:27:38 +00:00
|
|
|
include:
|
|
|
|
- os: ubuntu-latest
|
|
|
|
environment-file: environment.yml
|
|
|
|
default-shell: bash -l {0}
|
2022-10-29 08:14:24 +00:00
|
|
|
- os: macOS-12
|
2022-10-25 21:27:38 +00:00
|
|
|
environment-file: environment-mac.yml
|
|
|
|
default-shell: bash -l {0}
|
2022-11-01 01:02:14 +00:00
|
|
|
# - stable-diffusion-model: https://huggingface.co/CompVis/stable-diffusion-v-1-4-original/resolve/main/sd-v1-4.ckpt
|
|
|
|
# stable-diffusion-model-dl-path: models/ldm/stable-diffusion-v1/sd-v1-4.ckpt
|
|
|
|
# stable-diffusion-model-switch: stable-diffusion-1.4
|
2022-10-29 05:25:19 +00:00
|
|
|
- stable-diffusion-model: https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.ckpt
|
|
|
|
stable-diffusion-model-dl-path: models/ldm/stable-diffusion-v1/v1-5-pruned-emaonly.ckpt
|
|
|
|
stable-diffusion-model-switch: stable-diffusion-1.5
|
2022-10-29 20:25:41 +00:00
|
|
|
name: ${{ matrix.os }} with ${{ matrix.stable-diffusion-model-switch }}
|
2022-09-17 18:12:14 +00:00
|
|
|
runs-on: ${{ matrix.os }}
|
2022-10-29 03:49:12 +00:00
|
|
|
env:
|
|
|
|
CONDA_ENV_NAME: invokeai
|
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
|
2022-10-29 08:03:03 +00:00
|
|
|
id: checkout-sources
|
2022-09-17 18:12:14 +00:00
|
|
|
uses: actions/checkout@v3
|
2022-10-25 21:27:38 +00:00
|
|
|
|
2022-10-31 21:20:51 +00:00
|
|
|
- name: create models.yaml from example
|
|
|
|
run: cp configs/models.yaml.example configs/models.yaml
|
|
|
|
|
2022-10-29 06:59:23 +00:00
|
|
|
- name: Use cached conda packages
|
2022-10-29 08:03:03 +00:00
|
|
|
id: use-cached-conda-packages
|
2022-10-29 03:49:12 +00:00
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: ~/conda_pkgs_dir
|
|
|
|
key: conda-pkgs-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles(matrix.environment-file) }}
|
|
|
|
|
|
|
|
- name: Activate Conda Env
|
2022-10-29 08:03:03 +00:00
|
|
|
id: activate-conda-env
|
2022-10-25 21:27:38 +00:00
|
|
|
uses: conda-incubator/setup-miniconda@v2
|
|
|
|
with:
|
2022-10-29 03:49:12 +00:00
|
|
|
activate-environment: ${{ env.CONDA_ENV_NAME }}
|
|
|
|
environment-file: ${{ matrix.environment-file }}
|
2022-10-25 21:27:38 +00:00
|
|
|
miniconda-version: latest
|
|
|
|
|
|
|
|
- name: set test prompt to main branch validation
|
|
|
|
if: ${{ github.ref == 'refs/heads/main' }}
|
|
|
|
run: echo "TEST_PROMPTS=tests/preflight_prompts.txt" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: set test prompt to development branch validation
|
|
|
|
if: ${{ github.ref == 'refs/heads/development' }}
|
|
|
|
run: echo "TEST_PROMPTS=tests/dev_prompts.txt" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: set test prompt to Pull Request validation
|
|
|
|
if: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/development' }}
|
2022-10-28 15:54:50 +00:00
|
|
|
run: echo "TEST_PROMPTS=tests/validate_pr_prompt.txt" >> $GITHUB_ENV
|
2022-10-25 21:27:38 +00:00
|
|
|
|
2022-11-02 01:23:09 +00:00
|
|
|
- name: Use Cached Stable Diffusion Model
|
2022-11-02 01:18:46 +00:00
|
|
|
id: cache-sd-model
|
|
|
|
uses: actions/cache@v3
|
|
|
|
env:
|
|
|
|
cache-name: cache-${{ matrix.stable-diffusion-model-switch }}
|
|
|
|
with:
|
|
|
|
path: ${{ matrix.stable-diffusion-model-dl-path }}
|
|
|
|
key: ${{ env.cache-name }}
|
|
|
|
|
2022-10-29 05:35:43 +00:00
|
|
|
- name: Download ${{ matrix.stable-diffusion-model-switch }}
|
2022-10-29 08:03:03 +00:00
|
|
|
id: download-stable-diffusion-model
|
2022-11-02 01:18:46 +00:00
|
|
|
if: ${{ steps.cache-sd-model.outputs.cache-hit != 'true' }}
|
2022-09-17 18:12:14 +00:00
|
|
|
run: |
|
2022-10-25 21:27:38 +00:00
|
|
|
[[ -d models/ldm/stable-diffusion-v1 ]] \
|
|
|
|
|| mkdir -p models/ldm/stable-diffusion-v1
|
2022-10-29 05:35:43 +00:00
|
|
|
curl \
|
|
|
|
-H "Authorization: Bearer ${{ secrets.HUGGINGFACE_TOKEN }}" \
|
|
|
|
-o ${{ matrix.stable-diffusion-model-dl-path }} \
|
|
|
|
-L ${{ matrix.stable-diffusion-model }}
|
2022-10-25 21:27:38 +00:00
|
|
|
|
2022-10-29 06:59:23 +00:00
|
|
|
- name: run preload_models.py
|
2022-10-29 08:03:03 +00:00
|
|
|
id: run-preload-models
|
2022-10-30 05:47:24 +00:00
|
|
|
run: |
|
|
|
|
python scripts/preload_models.py \
|
|
|
|
--no-interactive
|
2022-10-25 21:27:38 +00:00
|
|
|
|
2022-09-17 18:12:14 +00:00
|
|
|
- name: Run the tests
|
2022-10-29 08:03:03 +00:00
|
|
|
id: run-tests
|
2022-09-17 18:12:14 +00:00
|
|
|
run: |
|
2022-10-25 21:27:38 +00:00
|
|
|
time python scripts/invoke.py \
|
2022-10-29 14:21:31 +00:00
|
|
|
--model ${{ matrix.stable-diffusion-model-switch }} \
|
|
|
|
--from_file ${{ env.TEST_PROMPTS }}
|
2022-10-25 21:27:38 +00:00
|
|
|
|
|
|
|
- name: export conda env
|
2022-10-29 08:03:03 +00:00
|
|
|
id: export-conda-env
|
2022-10-25 21:27:38 +00:00
|
|
|
run: |
|
2022-09-17 18:12:14 +00:00
|
|
|
mkdir -p outputs/img-samples
|
2022-10-29 08:03:03 +00:00
|
|
|
conda env export --name ${{ env.CONDA_ENV_NAME }} > outputs/img-samples/environment-${{ runner.os }}-${{ runner.arch }}.yml
|
2022-10-25 21:27:38 +00:00
|
|
|
|
2022-09-17 18:12:14 +00:00
|
|
|
- name: Archive results
|
2022-10-29 08:03:03 +00:00
|
|
|
id: archive-results
|
2022-09-17 18:12:14 +00:00
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
2022-10-29 06:08:15 +00:00
|
|
|
name: results_${{ matrix.os }}_${{ matrix.stable-diffusion-model-switch }}
|
2022-09-17 18:12:14 +00:00
|
|
|
path: outputs/img-samples
|