mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
2433cc344a
* add test-invoke-pip.yml * update requirements-base.txt to fix tests * install requirements-base.txt separate since it requires to have torch already installed also restore origin requirements-base.txt after suc. test in my fork * restore origin requirements add `basicsr>=1.4.2` to requirements-base.txt remove second installation step * re-add previously overseen req in lin-cuda * fix typo in setup.py - `scripts/preload_models.py` * use GFBGAN from branch `basicsr-1.4.2` * remove `basicsr>=1.4.2` from base reqs * add INVOKEAI_ROOT to env * disable upgrade of `pip`, `setuptools` and `wheel` * try to use a venv which should not contain `wheel` * add relative path to pip command * use `configure_invokeai.py --no-interactive --yes` * set grpcio to `<1.51.0` * revert changes to use venv * remove `--prefer-binary` * disable step to create models.yaml since this will not be used anymore with new `configure_invokeai.py` * use `pip install --no-binary=":all:"` * another try to use venv * try uninstalling wheel before installing reqs * dont use requirements.txt as filename * update cache-dependency-path * add facexlib to requirements-base.txt * first install requirements-base.txt * first install `-e .`, then install requirements I know that this is obviously the wrong order, but still have a feeling * add facexlib to requirements.in * remove `-e .` from reqs and install after reqs * unpin torch and torchvision in requirements.in * fix model dl path * fix curl output path * create directory before downloading model * set INVOKEAI_ROOT_PATH https://docs.github.com/en/actions/learn-github-actions/environment-variables#naming-conventions-for-environment-variables * INVOKEAI_ROOT ${{ env.GITHUB_WORKSPACE }}/invokeai * fix matrix stable-diffusion-model-dl-path * fix INVOKEAI_ROOT * fix INVOKEAI_ROOT * add --root and --outdir to run-tests step * create models.yaml from example * fix scripts variable in setup.py by removing unused scripts * fix archive-results path * fix workflow to reflect latest code changes * fix copy paste error * fix job name * fix matrix.stable-diffusion-model * restructure matrix * fix `activate conda env` step * update the environment yamls use same 4 git packages as for pip * rename job in test-invoke-conda * add tqdm to environment-lin-amd.yml * fix python commands in test-invoke-conda.yml Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com>
131 lines
4.7 KiB
YAML
131 lines
4.7 KiB
YAML
name: Test invoke.py
|
|
on:
|
|
push:
|
|
branches:
|
|
- 'main'
|
|
- 'development'
|
|
- 'fix-gh-actions-fork'
|
|
pull_request:
|
|
branches:
|
|
- 'main'
|
|
- 'development'
|
|
|
|
jobs:
|
|
matrix:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
stable-diffusion-model:
|
|
- 'stable-diffusion-1.5'
|
|
environment-yaml:
|
|
- environment-lin-amd.yml
|
|
- environment-lin-cuda.yml
|
|
- environment-mac.yml
|
|
include:
|
|
- environment-yaml: environment-lin-amd.yml
|
|
os: ubuntu-latest
|
|
default-shell: bash -l {0}
|
|
- environment-yaml: environment-lin-cuda.yml
|
|
os: ubuntu-latest
|
|
default-shell: bash -l {0}
|
|
- environment-yaml: environment-mac.yml
|
|
os: macos-12
|
|
default-shell: bash -l {0}
|
|
- stable-diffusion-model: stable-diffusion-1.5
|
|
stable-diffusion-model-url: 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
|
|
stable-diffusion-model-dl-name: v1-5-pruned-emaonly.ckpt
|
|
name: ${{ matrix.environment-yaml }} on ${{ matrix.os }}
|
|
runs-on: ${{ matrix.os }}
|
|
env:
|
|
CONDA_ENV_NAME: invokeai
|
|
INVOKEAI_ROOT: '${{ github.workspace }}/invokeai'
|
|
defaults:
|
|
run:
|
|
shell: ${{ matrix.default-shell }}
|
|
steps:
|
|
- name: Checkout sources
|
|
id: checkout-sources
|
|
uses: actions/checkout@v3
|
|
|
|
- name: create models.yaml from example
|
|
run: |
|
|
mkdir -p ${{ env.INVOKEAI_ROOT }}/configs
|
|
cp configs/models.yaml.example ${{ env.INVOKEAI_ROOT }}/configs/models.yaml
|
|
|
|
- name: create environment.yml
|
|
run: cp "environments-and-requirements/${{ matrix.environment-yaml }}" environment.yml
|
|
|
|
- name: Use cached conda packages
|
|
id: use-cached-conda-packages
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/conda_pkgs_dir
|
|
key: conda-pkgs-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles(matrix.environment-yaml) }}
|
|
|
|
- name: Activate Conda Env
|
|
id: activate-conda-env
|
|
uses: conda-incubator/setup-miniconda@v2
|
|
with:
|
|
activate-environment: ${{ env.CONDA_ENV_NAME }}
|
|
environment-file: environment.yml
|
|
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' }}
|
|
run: echo "TEST_PROMPTS=tests/validate_pr_prompt.txt" >> $GITHUB_ENV
|
|
|
|
- name: Use Cached Stable Diffusion Model
|
|
id: cache-sd-model
|
|
uses: actions/cache@v3
|
|
env:
|
|
cache-name: cache-${{ matrix.stable-diffusion-model }}
|
|
with:
|
|
path: ${{ matrix.stable-diffusion-model-dl-path }}
|
|
key: ${{ env.cache-name }}
|
|
|
|
- name: Download ${{ matrix.stable-diffusion-model }}
|
|
id: download-stable-diffusion-model
|
|
if: ${{ steps.cache-sd-model.outputs.cache-hit != 'true' }}
|
|
run: |
|
|
mkdir -p "${{ env.INVOKEAI_ROOT }}/${{ matrix.stable-diffusion-model-dl-path }}"
|
|
curl \
|
|
-H "Authorization: Bearer ${{ secrets.HUGGINGFACE_TOKEN }}" \
|
|
-o "${{ env.INVOKEAI_ROOT }}/${{ matrix.stable-diffusion-model-dl-path }}/${{ matrix.stable-diffusion-model-dl-name }}" \
|
|
-L ${{ matrix.stable-diffusion-model-url }}
|
|
|
|
- name: run configure_invokeai.py
|
|
id: run-preload-models
|
|
run: |
|
|
python scripts/configure_invokeai.py --no-interactive --yes
|
|
|
|
- name: Run the tests
|
|
id: run-tests
|
|
run: |
|
|
time python scripts/invoke.py \
|
|
--model ${{ matrix.stable-diffusion-model }} \
|
|
--from_file ${{ env.TEST_PROMPTS }} \
|
|
--root="${{ env.INVOKEAI_ROOT }}" \
|
|
--outdir="${{ env.INVOKEAI_ROOT }}/outputs"
|
|
|
|
- name: export conda env
|
|
id: export-conda-env
|
|
run: |
|
|
mkdir -p outputs/img-samples
|
|
conda env export --name ${{ env.CONDA_ENV_NAME }} > outputs/img-samples/environment-${{ runner.os }}-${{ runner.arch }}.yml
|
|
|
|
- name: Archive results
|
|
id: archive-results
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: results_${{ matrix.requirements-file }}_${{ matrix.python-version }}
|
|
path: ${{ env.INVOKEAI_ROOT }}/outputs/img-samples
|