mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
test-invoke-conda: use diffusers-format model
test-invoke-conda: put huggingface-token where the library can use it
This commit is contained in:
parent
aca6d213d7
commit
c5274e6e50
71
.github/workflows/test-invoke-conda.yml
vendored
71
.github/workflows/test-invoke-conda.yml
vendored
@ -1,17 +1,16 @@
|
||||
name: Test invoke.py
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'main'
|
||||
- 'development'
|
||||
- 'fix-gh-actions-fork'
|
||||
pull_request:
|
||||
branches:
|
||||
- 'main'
|
||||
- 'development'
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
matrix:
|
||||
# Run on:
|
||||
# - pull requests
|
||||
# - pushes to forks (will run in the forked project with that fork's secrets)
|
||||
# - pushes to branches that are *not* pull requests
|
||||
if: |
|
||||
github.event_name == 'pull_request'
|
||||
|| github.repository != 'invoke-ai/InvokeAI'
|
||||
|| github.ref_protected
|
||||
strategy:
|
||||
matrix:
|
||||
stable-diffusion-model:
|
||||
@ -30,15 +29,19 @@ jobs:
|
||||
- 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 }}
|
||||
# - 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
|
||||
- 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: diffusers-1.5
|
||||
name: ${{ matrix.os }} with ${{ matrix.stable-diffusion-model-switch }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
env:
|
||||
CONDA_ENV_NAME: invokeai
|
||||
INVOKEAI_ROOT: '${{ github.workspace }}/invokeai'
|
||||
PYTHONUNBUFFERED: 1
|
||||
HAVE_SECRETS: ${{ secrets.HUGGINGFACE_TOKEN != '' }}
|
||||
defaults:
|
||||
run:
|
||||
shell: ${{ matrix.default-shell }}
|
||||
@ -55,6 +58,19 @@ jobs:
|
||||
- name: create environment.yml
|
||||
run: cp "environments-and-requirements/${{ matrix.environment-yaml }}" environment.yml
|
||||
|
||||
- name: Use Cached Stable Diffusion Model
|
||||
id: cache-sd-model
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: huggingface-${{ matrix.stable-diffusion-model-switch }}
|
||||
with:
|
||||
path: ~/.cache/huggingface
|
||||
key: ${{ env.cache-name }}
|
||||
|
||||
- name: Check model availability
|
||||
if: steps.cache-sd-model.outputs.cache-hit != true && env.HAVE_SECRETS != 'true'
|
||||
run: echo -e '\a ⛔ GitHub model cache not found, and no HUGGINGFACE_TOKEN is available. Will not be able to load Stable Diffusion.' ; exit 1
|
||||
|
||||
- name: Use cached conda packages
|
||||
id: use-cached-conda-packages
|
||||
uses: actions/cache@v3
|
||||
@ -82,28 +98,13 @@ jobs:
|
||||
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: ${{ env.INVOKEAI_ROOT }}/${{ 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
|
||||
- name: run preload_models.py
|
||||
id: run-preload-models
|
||||
run: |
|
||||
if [ "${HAVE_SECRETS}" == true ] ; then
|
||||
mkdir -p ~/.huggingface
|
||||
echo -n '${{ secrets.HUGGINGFACE_TOKEN }}' > ~/.huggingface/token
|
||||
fi
|
||||
python scripts/configure_invokeai.py --no-interactive --yes
|
||||
|
||||
- name: cat ~/.invokeai
|
||||
|
Loading…
Reference in New Issue
Block a user