diff --git a/.github/workflows/test-invoke-pip.yml b/.github/workflows/test-invoke-pip.yml index 4985202782..a88a2fb883 100644 --- a/.github/workflows/test-invoke-pip.yml +++ b/.github/workflows/test-invoke-pip.yml @@ -8,141 +8,133 @@ on: - 'ready_for_review' - 'opened' - 'synchronize' - - 'converted_to_draft' concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true jobs: - # fail_if_pull_request_is_draft: - # if: github.event.pull_request.draft == true && github.head_ref != 'dev/diffusers' - # runs-on: ubuntu-18.04 - # steps: - # - name: Fails in order to indicate that pull request needs to be marked as ready to review and unit tests workflow needs to pass. - # run: exit 1 matrix: - if: github.event.pull_request.draft == false || github.head_ref == 'dev/diffusers' + if: github.event.pull_request.draft == false strategy: matrix: - stable-diffusion-model: - - stable-diffusion-1.5 - requirements-file: - - requirements-lin-cuda.txt - - requirements-lin-amd.txt - - requirements-mac-mps-cpu.txt - - requirements-win-colab-cuda.txt python-version: # - '3.9' - '3.10' + pytorch: + - linux-cuda-11_6 + - linux-cuda-11_7 + - linux-rocm-5_2 + - linux-cpu + - macos-default + - windows-cpu + - windows-cuda-11_6 + - windows-cuda-11_7 include: - - requirements-file: requirements-lin-cuda.txt + - pytorch: linux-cuda-11_6 + os: ubuntu-22.04 + extra-index-url: 'https://download.pytorch.org/whl/cu116' + github-env: $GITHUB_ENV + - pytorch: linux-cuda-11_7 os: ubuntu-22.04 github-env: $GITHUB_ENV - - requirements-file: requirements-lin-amd.txt + - pytorch: linux-rocm-5_2 os: ubuntu-22.04 + extra-index-url: 'https://download.pytorch.org/whl/rocm5.2' github-env: $GITHUB_ENV - - requirements-file: requirements-mac-mps-cpu.txt + - pytorch: linux-cpu + os: ubuntu-22.04 + extra-index-url: 'https://download.pytorch.org/whl/cpu' + github-env: $GITHUB_ENV + - pytorch: macos-default os: macOS-12 github-env: $GITHUB_ENV - - requirements-file: requirements-win-colab-cuda.txt + - pytorch: windows-cpu os: windows-2022 github-env: $env:GITHUB_ENV - name: ${{ matrix.requirements-file }} on ${{ matrix.python-version }} + - pytorch: windows-cuda-11_6 + os: windows-2022 + extra-index-url: 'https://download.pytorch.org/whl/cu116' + github-env: $env:GITHUB_ENV + - pytorch: windows-cuda-11_7 + os: windows-2022 + extra-index-url: 'https://download.pytorch.org/whl/cu117' + github-env: $env:GITHUB_ENV + name: ${{ matrix.pytorch }} on ${{ matrix.python-version }} runs-on: ${{ matrix.os }} - env: - INVOKE_MODEL_RECONFIGURE: '--yes' - INVOKEAI_ROOT: '${{ github.workspace }}/invokeai' - PYTHONUNBUFFERED: 1 - HAVE_SECRETS: ${{ secrets.HUGGINGFACE_TOKEN != '' }} steps: - name: Checkout sources id: checkout-sources 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: Use Cached diffusers-1.5 - id: cache-sd-model - uses: actions/cache@v3 - env: - cache-name: huggingface-${{ matrix.stable-diffusion-model }} + - name: setup python + uses: actions/setup-python@v4 with: - path: | - ${{ env.INVOKEAI_ROOT }}/models/runwayml - ${{ env.INVOKEAI_ROOT }}/models/stabilityai - ${{ env.INVOKEAI_ROOT }}/models/CompVis - key: ${{ env.cache-name }} + python-version: ${{ matrix.python-version }} + + - name: Set Cache-Directory Windows + if: runner.os == 'Windows' + id: set-cache-dir-windows + run: | + echo "CACHE_DIR=$HOME\invokeai\models" >> ${{ matrix.github-env }} + echo "PIP_NO_CACHE_DIR=1" >> ${{ matrix.github-env }} + + - name: Set Cache-Directory others + if: runner.os != 'Windows' + id: set-cache-dir-others + run: echo "CACHE_DIR=$HOME/invokeai/models" >> ${{ matrix.github-env }} - name: set test prompt to main branch validation if: ${{ github.ref == 'refs/heads/main' }} run: echo "TEST_PROMPTS=tests/preflight_prompts.txt" >> ${{ matrix.github-env }} - - name: set test prompt to development branch validation - if: ${{ github.ref == 'refs/heads/development' }} - run: echo "TEST_PROMPTS=tests/dev_prompts.txt" >> ${{ matrix.github-env }} - - 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' }} run: echo "TEST_PROMPTS=tests/validate_pr_prompt.txt" >> ${{ matrix.github-env }} - - name: create requirements.txt - run: cp 'environments-and-requirements/${{ matrix.requirements-file }}' '${{ matrix.requirements-file }}' + - name: install invokeai + run: pip3 install --use-pep517 -e . + env: + PIP_EXTRA_INDEX_URL: ${{ matrix.extra-index-url }} - - name: setup python - uses: actions/setup-python@v4 + - name: Use Cached models + id: cache-sd-model + uses: actions/cache@v3 + env: + cache-name: huggingface-models with: - python-version: ${{ matrix.python-version }} - # cache: 'pip' - # cache-dependency-path: ${{ matrix.requirements-file }} + path: ${{ env.CACHE_DIR }} + key: ${{ env.cache-name }} + enableCrossOsArchive: true - - name: install dependencies - run: pip3 install --upgrade pip setuptools wheel - - - name: install requirements - run: pip3 install -r '${{ matrix.requirements-file }}' - - - name: run configure_invokeai.py + - name: run configure_invokeai id: run-preload-models env: HUGGING_FACE_HUB_TOKEN: ${{ secrets.HUGGINGFACE_TOKEN }} run: > - configure_invokeai.py + configure_invokeai --yes --default_only - --full-precision # can't use fp16 weights without a GPU + --full-precision + # can't use fp16 weights without a GPU - name: Run the tests + if: runner.os != 'Windows' id: run-tests - if: matrix.os != 'windows-2022' env: # Set offline mode to make sure configure preloaded successfully. HF_HUB_OFFLINE: 1 HF_DATASETS_OFFLINE: 1 TRANSFORMERS_OFFLINE: 1 run: > - python3 scripts/invoke.py + invoke --no-patchmatch --no-nsfw_checker - --model ${{ matrix.stable-diffusion-model }} --from_file ${{ env.TEST_PROMPTS }} - --root="${{ env.INVOKEAI_ROOT }}" - --outdir="${{ env.INVOKEAI_OUTDIR }}" - name: Archive results id: archive-results - if: matrix.os != 'windows-2022' uses: actions/upload-artifact@v3 with: - name: results_${{ matrix.requirements-file }}_${{ matrix.python-version }} + name: results_${{ matrix.pytorch }}_${{ matrix.python-version }} path: ${{ env.INVOKEAI_ROOT }}/outputs diff --git a/README.md b/README.md index 07501a4242..765bed663a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@