Add windows to test workflows (#1809)

* add windows to test runners

* disable fail-fast for debugging

* re-enable login shell for conda workflow
also fix expression to exclude windows from run tests

* enable fail-fast again

* fix condition, pin runner verisons

* remove feature branch from push trigger
since already being triggered now via PR

* use gfpgan from pypi for windows
curious if this would fix the installation here as well
since worked for #1802

* unpin basicsr for windows

* for curiosity enabling testing for windows as well

* disable pip cache
since windows failed with a memory error now
but was working before it had a cache

* use matrix.github-env

* set platform specific root and outdir

* disable tests for windows since memory error
I guess the windows installation uses more space than linux
and for this they have less swap memory
This commit is contained in:
Matthias Wild 2022-12-09 14:21:38 +01:00 committed by GitHub
parent d2026d0509
commit ed9186b099
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 61 additions and 47 deletions

View File

@ -4,7 +4,6 @@ on:
branches: branches:
- 'main' - 'main'
- 'development' - 'development'
- 'fix-gh-actions-fork'
pull_request: pull_request:
branches: branches:
- 'main' - 'main'
@ -20,16 +19,28 @@ jobs:
- environment-lin-amd.yml - environment-lin-amd.yml
- environment-lin-cuda.yml - environment-lin-cuda.yml
- environment-mac.yml - environment-mac.yml
- environment-win-cuda.yml
include: include:
- environment-yaml: environment-lin-amd.yml - environment-yaml: environment-lin-amd.yml
os: ubuntu-latest os: ubuntu-22.04
curl-command: curl
github-env: $GITHUB_ENV
default-shell: bash -l {0} default-shell: bash -l {0}
- environment-yaml: environment-lin-cuda.yml - environment-yaml: environment-lin-cuda.yml
os: ubuntu-latest os: ubuntu-22.04
curl-command: curl
github-env: $GITHUB_ENV
default-shell: bash -l {0} default-shell: bash -l {0}
- environment-yaml: environment-mac.yml - environment-yaml: environment-mac.yml
os: macos-12 os: macos-12
curl-command: curl
github-env: $GITHUB_ENV
default-shell: bash -l {0} default-shell: bash -l {0}
- environment-yaml: environment-win-cuda.yml
os: windows-2022
curl-command: curl.exe
github-env: $env:GITHUB_ENV
default-shell: pwsh
- stable-diffusion-model: stable-diffusion-1.5 - 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-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-path: models/ldm/stable-diffusion-v1
@ -72,15 +83,15 @@ jobs:
- name: set test prompt to main branch validation - name: set test prompt to main branch validation
if: ${{ github.ref == 'refs/heads/main' }} if: ${{ github.ref == 'refs/heads/main' }}
run: echo "TEST_PROMPTS=tests/preflight_prompts.txt" >> $GITHUB_ENV run: echo "TEST_PROMPTS=tests/preflight_prompts.txt" >> ${{ matrix.github-env }}
- name: set test prompt to development branch validation - name: set test prompt to development branch validation
if: ${{ github.ref == 'refs/heads/development' }} if: ${{ github.ref == 'refs/heads/development' }}
run: echo "TEST_PROMPTS=tests/dev_prompts.txt" >> $GITHUB_ENV run: echo "TEST_PROMPTS=tests/dev_prompts.txt" >> ${{ matrix.github-env }}
- name: set test prompt to Pull Request validation - name: set test prompt to Pull Request validation
if: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/development' }} if: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/development' }}
run: echo "TEST_PROMPTS=tests/validate_pr_prompt.txt" >> $GITHUB_ENV run: echo "TEST_PROMPTS=tests/validate_pr_prompt.txt" >> ${{ matrix.github-env }}
- name: Use Cached Stable Diffusion Model - name: Use Cached Stable Diffusion Model
id: cache-sd-model id: cache-sd-model
@ -96,10 +107,7 @@ jobs:
if: ${{ steps.cache-sd-model.outputs.cache-hit != 'true' }} if: ${{ steps.cache-sd-model.outputs.cache-hit != 'true' }}
run: | run: |
mkdir -p "${{ env.INVOKEAI_ROOT }}/${{ matrix.stable-diffusion-model-dl-path }}" mkdir -p "${{ env.INVOKEAI_ROOT }}/${{ matrix.stable-diffusion-model-dl-path }}"
curl \ ${{ matrix.curl-command }} -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 }}
-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 - name: run configure_invokeai.py
id: run-preload-models id: run-preload-models
@ -112,6 +120,7 @@ jobs:
- name: Run the tests - name: Run the tests
id: run-tests id: run-tests
if: matrix.os != 'windows-2022'
run: | run: |
time python scripts/invoke.py \ time python scripts/invoke.py \
--no-patchmatch \ --no-patchmatch \
@ -123,11 +132,13 @@ jobs:
- name: export conda env - name: export conda env
id: export-conda-env id: export-conda-env
if: matrix.os != 'windows-2022'
run: | run: |
mkdir -p outputs/img-samples mkdir -p outputs/img-samples
conda env export --name ${{ env.CONDA_ENV_NAME }} > outputs/img-samples/environment-${{ runner.os }}-${{ runner.arch }}.yml conda env export --name ${{ env.CONDA_ENV_NAME }} > ${{ env.INVOKEAI_ROOT }}/outputs/environment-${{ runner.os }}-${{ runner.arch }}.yml
- name: Archive results - name: Archive results
if: matrix.os != 'windows-2022'
id: archive-results id: archive-results
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:

View File

@ -19,35 +19,50 @@ jobs:
- requirements-lin-cuda.txt - requirements-lin-cuda.txt
- requirements-lin-amd.txt - requirements-lin-amd.txt
- requirements-mac-mps-cpu.txt - requirements-mac-mps-cpu.txt
- requirements-win-colab-cuda.txt
python-version: python-version:
# - '3.9' # - '3.9'
- '3.10' - '3.10'
include: include:
- requirements-file: requirements-lin-cuda.txt - requirements-file: requirements-lin-cuda.txt
os: ubuntu-latest os: ubuntu-22.04
default-shell: bash -l {0} curl-command: curl
github-env: $GITHUB_ENV
- requirements-file: requirements-lin-amd.txt - requirements-file: requirements-lin-amd.txt
os: ubuntu-latest os: ubuntu-22.04
default-shell: bash -l {0} curl-command: curl
github-env: $GITHUB_ENV
- requirements-file: requirements-mac-mps-cpu.txt - requirements-file: requirements-mac-mps-cpu.txt
os: macOS-12 os: macOS-12
default-shell: bash -l {0} curl-command: curl
github-env: $GITHUB_ENV
- requirements-file: requirements-win-colab-cuda.txt
os: windows-2022
curl-command: curl.exe
github-env: $env:GITHUB_ENV
- stable-diffusion-model: stable-diffusion-1.5 - 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-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-path: models/ldm/stable-diffusion-v1
stable-diffusion-model-dl-name: v1-5-pruned-emaonly.ckpt stable-diffusion-model-dl-name: v1-5-pruned-emaonly.ckpt
name: ${{ matrix.requirements-file }} on ${{ matrix.python-version }} name: ${{ matrix.requirements-file }} on ${{ matrix.python-version }}
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
defaults:
run:
shell: ${{ matrix.default-shell }}
env:
INVOKEAI_ROOT: '${{ github.workspace }}/invokeai'
steps: steps:
- name: Checkout sources - name: Checkout sources
id: checkout-sources id: checkout-sources
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: set INVOKEAI_ROOT Windows
if: matrix.os == 'windows-2022'
run: |
echo "INVOKEAI_ROOT=${{ github.workspace }}\invokeai" >> ${{ matrix.github-env }}
echo "INVOKEAI_OUTDIR=${{ github.workspace }}\invokeai\outputs" >> ${{ matrix.github-env }}
- name: set INVOKEAI_ROOT others
if: matrix.os != 'windows-2022'
run: |
echo "INVOKEAI_ROOT=${{ github.workspace }}/invokeai" >> ${{ matrix.github-env }}
echo "INVOKEAI_OUTDIR=${{ github.workspace }}/invokeai/outputs" >> ${{ matrix.github-env }}
- name: create models.yaml from example - name: create models.yaml from example
run: | run: |
mkdir -p ${{ env.INVOKEAI_ROOT }}/configs mkdir -p ${{ env.INVOKEAI_ROOT }}/configs
@ -55,15 +70,15 @@ jobs:
- name: set test prompt to main branch validation - name: set test prompt to main branch validation
if: ${{ github.ref == 'refs/heads/main' }} if: ${{ github.ref == 'refs/heads/main' }}
run: echo "TEST_PROMPTS=tests/preflight_prompts.txt" >> $GITHUB_ENV run: echo "TEST_PROMPTS=tests/preflight_prompts.txt" >> ${{ matrix.github-env }}
- name: set test prompt to development branch validation - name: set test prompt to development branch validation
if: ${{ github.ref == 'refs/heads/development' }} if: ${{ github.ref == 'refs/heads/development' }}
run: echo "TEST_PROMPTS=tests/dev_prompts.txt" >> $GITHUB_ENV run: echo "TEST_PROMPTS=tests/dev_prompts.txt" >> ${{ matrix.github-env }}
- name: set test prompt to Pull Request validation - name: set test prompt to Pull Request validation
if: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/development' }} if: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/development' }}
run: echo "TEST_PROMPTS=tests/validate_pr_prompt.txt" >> $GITHUB_ENV run: echo "TEST_PROMPTS=tests/validate_pr_prompt.txt" >> ${{ matrix.github-env }}
- name: create requirements.txt - name: create requirements.txt
run: cp 'environments-and-requirements/${{ matrix.requirements-file }}' '${{ matrix.requirements-file }}' run: cp 'environments-and-requirements/${{ matrix.requirements-file }}' '${{ matrix.requirements-file }}'
@ -72,14 +87,14 @@ jobs:
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
cache: 'pip' # cache: 'pip'
cache-dependency-path: ${{ matrix.requirements-file }} # cache-dependency-path: ${{ matrix.requirements-file }}
# - name: install dependencies # - name: install dependencies
# run: ${{ env.pythonLocation }}/bin/pip install --upgrade pip setuptools wheel # run: ${{ env.pythonLocation }}/bin/pip install --upgrade pip setuptools wheel
- name: install requirements - name: install requirements
run: ${{ env.pythonLocation }}/bin/pip install -r '${{ matrix.requirements-file }}' run: pip3 install -r '${{ matrix.requirements-file }}'
- name: Use Cached Stable Diffusion Model - name: Use Cached Stable Diffusion Model
id: cache-sd-model id: cache-sd-model
@ -95,33 +110,20 @@ jobs:
if: ${{ steps.cache-sd-model.outputs.cache-hit != 'true' }} if: ${{ steps.cache-sd-model.outputs.cache-hit != 'true' }}
run: | run: |
mkdir -p "${{ env.INVOKEAI_ROOT }}/${{ matrix.stable-diffusion-model-dl-path }}" mkdir -p "${{ env.INVOKEAI_ROOT }}/${{ matrix.stable-diffusion-model-dl-path }}"
curl \ ${{ matrix.curl-command }} -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 }}
-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 - name: run configure_invokeai.py
id: run-preload-models id: run-preload-models
run: | run: python3 scripts/configure_invokeai.py --no-interactive --yes
${{ env.pythonLocation }}/bin/python scripts/configure_invokeai.py --no-interactive --yes
- name: cat ~/.invokeai
id: cat-invokeai
run: cat ~/.invokeai
- name: Run the tests - name: Run the tests
id: run-tests id: run-tests
run: | if: matrix.os != 'windows-2022'
time ${{ env.pythonLocation }}/bin/python scripts/invoke.py \ run: python3 scripts/invoke.py --no-patchmatch --no-nsfw_checker --model ${{ matrix.stable-diffusion-model }} --from_file ${{ env.TEST_PROMPTS }} --root="${{ env.INVOKEAI_ROOT }}" --outdir="${{ env.INVOKEAI_OUTDIR }}"
--no-patchmatch \
--no-nsfw_checker \
--model ${{ matrix.stable-diffusion-model }} \
--from_file ${{ env.TEST_PROMPTS }} \
--root="${{ env.INVOKEAI_ROOT }}" \
--outdir="${{ env.INVOKEAI_ROOT }}/outputs"
- name: Archive results - name: Archive results
id: archive-results id: archive-results
if: matrix.os != 'windows-2022'
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: results_${{ matrix.requirements-file }}_${{ matrix.python-version }} name: results_${{ matrix.requirements-file }}_${{ matrix.python-version }}

View File

@ -33,7 +33,7 @@ torch-fidelity
torchmetrics torchmetrics
transformers==4.21.* transformers==4.21.*
picklescan picklescan
git+https://github.com/invoke-ai/GFPGAN@basicsr-1.4.1#egg=gfpgan ; platform_system == 'Windows' # git+https://github.com/invoke-ai/GFPGAN@basicsr-1.4.1#egg=gfpgan ; platform_system == 'Windows'
git+https://github.com/invoke-ai/GFPGAN@basicsr-1.4.2#egg=gfpgan ; platform_system != 'Windows' git+https://github.com/invoke-ai/GFPGAN@basicsr-1.4.2#egg=gfpgan ; platform_system != 'Windows'
git+https://github.com/openai/CLIP.git@main#egg=clip git+https://github.com/openai/CLIP.git@main#egg=clip
git+https://github.com/Birch-san/k-diffusion.git@mps#egg=k-diffusion git+https://github.com/Birch-san/k-diffusion.git@mps#egg=k-diffusion

View File

@ -1,7 +1,8 @@
-r environments-and-requirements/requirements-base.txt -r environments-and-requirements/requirements-base.txt
# Get hardware-appropriate torch/torchvision # Get hardware-appropriate torch/torchvision
--extra-index-url https://download.pytorch.org/whl/cu116 --trusted-host https://download.pytorch.org --extra-index-url https://download.pytorch.org/whl/cu116 --trusted-host https://download.pytorch.org
basicsr==1.4.1 gfpgan
basicsr
torch==1.12.1 torch==1.12.1
torchvision==0.13.1 torchvision==0.13.1
-e . -e .