diff --git a/.github/workflows/test-invoke-conda.yml b/.github/workflows/test-invoke-conda.yml deleted file mode 100644 index fd6caf47fe..0000000000 --- a/.github/workflows/test-invoke-conda.yml +++ /dev/null @@ -1,161 +0,0 @@ -name: Test invoke.py -on: - push: - branches: - - 'main' - pull_request: - branches: - - 'main' - types: - - '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 - runs-on: ubuntu-22.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 - strategy: - matrix: - stable-diffusion-model: - - 'stable-diffusion-1.5' - environment-yaml: - - environment-lin-amd.yml - - environment-lin-cuda.yml - - environment-mac.yml - - environment-win-cuda.yml - include: - - environment-yaml: environment-lin-amd.yml - os: ubuntu-22.04 - curl-command: curl - github-env: $GITHUB_ENV - default-shell: bash -l {0} - - environment-yaml: environment-lin-cuda.yml - os: ubuntu-22.04 - curl-command: curl - github-env: $GITHUB_ENV - default-shell: bash -l {0} - - environment-yaml: environment-mac.yml - os: macos-12 - curl-command: curl - github-env: $GITHUB_ENV - 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-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" >> ${{ 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' }} - run: echo "TEST_PROMPTS=tests/validate_pr_prompt.txt" >> ${{ matrix.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 }}" - ${{ 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 }} - - - name: run configure_invokeai.py - id: run-preload-models - run: | - python scripts/configure_invokeai.py --skip-sd-weights --yes - - - name: cat invokeai.init - id: cat-invokeai - run: cat ${{ env.INVOKEAI_ROOT }}/invokeai.init - - - name: Run the tests - id: run-tests - if: matrix.os != 'windows-2022' - run: | - time python 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_ROOT }}/outputs" - - - name: export conda env - id: export-conda-env - if: matrix.os != 'windows-2022' - run: | - mkdir -p outputs/img-samples - conda env export --name ${{ env.CONDA_ENV_NAME }} > ${{ env.INVOKEAI_ROOT }}/outputs/environment-${{ runner.os }}-${{ runner.arch }}.yml - - - name: Archive results - if: matrix.os != 'windows-2022' - id: archive-results - uses: actions/upload-artifact@v3 - with: - name: results_${{ matrix.requirements-file }}_${{ matrix.python-version }} - path: ${{ env.INVOKEAI_ROOT }}/outputs diff --git a/.github/workflows/test-invoke-pip.yml b/.github/workflows/test-invoke-pip.yml index b12a7ca879..34c90f10c5 100644 --- a/.github/workflows/test-invoke-pip.yml +++ b/.github/workflows/test-invoke-pip.yml @@ -4,8 +4,6 @@ on: branches: - 'main' pull_request: - branches: - - 'main' types: - 'ready_for_review' - 'opened' @@ -17,14 +15,14 @@ concurrency: cancel-in-progress: true jobs: - fail_if_pull_request_is_draft: - if: github.event.pull_request.draft == true - 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 + # 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 + if: github.event.pull_request.draft == false || github.head_ref == 'dev/diffusers' strategy: matrix: stable-diffusion-model: @@ -40,26 +38,23 @@ jobs: include: - requirements-file: requirements-lin-cuda.txt os: ubuntu-22.04 - curl-command: curl github-env: $GITHUB_ENV - requirements-file: requirements-lin-amd.txt os: ubuntu-22.04 - curl-command: curl github-env: $GITHUB_ENV - requirements-file: requirements-mac-mps-cpu.txt os: macOS-12 - 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-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.requirements-file }} 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 @@ -77,10 +72,17 @@ jobs: 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 - run: | - mkdir -p ${{ env.INVOKEAI_ROOT }}/configs - cp configs/models.yaml.example ${{ env.INVOKEAI_ROOT }}/configs/models.yaml + - name: Use Cached diffusers-1.5 + id: cache-sd-model + uses: actions/cache@v3 + env: + cache-name: huggingface-${{ matrix.stable-diffusion-model }} + with: + path: | + ${{ env.INVOKEAI_ROOT }}/models/runwayml + ${{ env.INVOKEAI_ROOT }}/models/stabilityai + ${{ env.INVOKEAI_ROOT }}/models/CompVis + key: ${{ env.cache-name }} - name: set test prompt to main branch validation if: ${{ github.ref == 'refs/heads/main' }} @@ -110,30 +112,31 @@ jobs: - name: install requirements run: pip3 install -r '${{ matrix.requirements-file }}' - - 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 }}" - ${{ 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 }} - - name: run configure_invokeai.py id: run-preload-models - run: python3 scripts/configure_invokeai.py --skip-sd-weights --yes + env: + HUGGING_FACE_HUB_TOKEN: ${{ secrets.HUGGINGFACE_TOKEN }} + run: > + configure_invokeai.py + --yes + --full-precision # can't use fp16 weights without a GPU - name: Run the tests id: run-tests if: matrix.os != 'windows-2022' - 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 }}" + 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 + --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 diff --git a/README.md b/README.md index d01b89023f..07501a4242 100644 --- a/README.md +++ b/README.md @@ -8,12 +8,10 @@ [![latest release badge]][latest release link] [![github stars badge]][github stars link] [![github forks badge]][github forks link] -[![CI checks on main badge]][CI checks on main link] [![CI checks on dev badge]][CI checks on dev link] [![latest commit to dev badge]][latest commit to dev link] +[![CI checks on main badge]][CI checks on main link] [![latest commit to main badge]][latest commit to main link] [![github open issues badge]][github open issues link] [![github open prs badge]][github open prs link] -[CI checks on dev badge]: https://flat.badgen.net/github/checks/invoke-ai/InvokeAI/development?label=CI%20status%20on%20dev&cache=900&icon=github -[CI checks on dev link]: https://github.com/invoke-ai/InvokeAI/actions?query=branch%3Adevelopment [CI checks on main badge]: https://flat.badgen.net/github/checks/invoke-ai/InvokeAI/main?label=CI%20status%20on%20main&cache=900&icon=github [CI checks on main link]: https://github.com/invoke-ai/InvokeAI/actions/workflows/test-invoke-conda.yml [discord badge]: https://flat.badgen.net/discord/members/ZmtBAhwWhy?icon=discord @@ -26,19 +24,13 @@ [github open prs link]: https://github.com/invoke-ai/InvokeAI/pulls?q=is%3Apr+is%3Aopen [github stars badge]: https://flat.badgen.net/github/stars/invoke-ai/InvokeAI?icon=github [github stars link]: https://github.com/invoke-ai/InvokeAI/stargazers -[latest commit to dev badge]: https://flat.badgen.net/github/last-commit/invoke-ai/InvokeAI/development?icon=github&color=yellow&label=last%20dev%20commit&cache=900 -[latest commit to dev link]: https://github.com/invoke-ai/InvokeAI/commits/development +[latest commit to main badge]: https://flat.badgen.net/github/last-commit/invoke-ai/InvokeAI/main?icon=github&color=yellow&label=last%20dev%20commit&cache=900 +[latest commit to main link]: https://github.com/invoke-ai/InvokeAI/commits/main [latest release badge]: https://flat.badgen.net/github/release/invoke-ai/InvokeAI/development?icon=github [latest release link]: https://github.com/invoke-ai/InvokeAI/releases -This is a fork of -[CompVis/stable-diffusion](https://github.com/CompVis/stable-diffusion), -the open source text-to-image generator. It provides a streamlined -process with various new features and options to aid the image -generation process. It runs on Windows, macOS and Linux machines, with -GPU cards with as little as 4 GB of RAM. It provides both a polished -Web interface (see below), and an easy-to-use command-line interface. +InvokeAI is a leading creative engine built to empower professionals and enthusiasts alike. Generate and create stunning visual media using the latest AI-driven technologies. InvokeAI offers an industry leading Web Interface, interactive Command Line Interface, and also serves as the foundation for multiple commercial products. **Quick links**: [[How to Install](#installation)] [Discord Server] [Documentation and Tutorials] [Code and Downloads] [Bug Reports] [Discussion, Ideas & Q&A] @@ -46,6 +38,9 @@ _Note: InvokeAI is rapidly evolving. Please use the [Issues](https://github.com/invoke-ai/InvokeAI/issues) tab to report bugs and make feature requests. Be sure to use the provided templates. They will help us diagnose issues faster._ + + + # Getting Started with InvokeAI For full installation and upgrade instructions, please see: @@ -58,10 +53,7 @@ For full installation and upgrade instructions, please see: 5. Wait a while, until it is done. 6. The folder where you ran the installer from will now be filled with lots of files. If you are on Windows, double-click on the `invoke.bat` file. On macOS, open a Terminal window, drag `invoke.sh` from the folder into the Terminal, and press return. On Linux, run `invoke.sh` 7. Press 2 to open the "browser-based UI", press enter/return, wait a minute or two for Stable Diffusion to start up, then open your browser and go to http://localhost:9090. -8. Type `banana sushi` in the box on the top left and click `Invoke`: - -