Merge remote-tracking branch 'origin/main' into dev/diffusers

# Conflicts:
#	.github/workflows/test-invoke-conda.yml
#	.github/workflows/test-invoke-pip.yml
#	environments-and-requirements/requirements-base.txt
This commit is contained in:
Kevin Turner 2022-12-09 10:34:29 -08:00
commit a3e41d63ec
8 changed files with 57 additions and 31 deletions

View File

@ -4,7 +4,6 @@ on:
branches:
- 'main'
- 'development'
- 'fix-gh-actions-fork'
pull_request:
jobs:
@ -17,16 +16,24 @@ jobs:
- environment-lin-amd.yml
- environment-lin-cuda.yml
- environment-mac.yml
- environment-win-cuda.yml
include:
- environment-yaml: environment-lin-amd.yml
os: ubuntu-latest
os: ubuntu-22.04
github-env: $GITHUB_ENV
default-shell: bash -l {0}
- environment-yaml: environment-lin-cuda.yml
os: ubuntu-latest
os: ubuntu-22.04
github-env: $GITHUB_ENV
default-shell: bash -l {0}
- environment-yaml: environment-mac.yml
os: macos-12
github-env: $GITHUB_ENV
default-shell: bash -l {0}
- environment-yaml: environment-win-cuda.yml
os: windows-2022
github-env: $env:GITHUB_ENV
default-shell: pwsh
name: ${{ matrix.environment-yaml }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
env:
@ -76,15 +83,15 @@ jobs:
- name: set test prompt to main branch validation
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
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
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: run configure_invokeai.py
id: run-preload-models
@ -103,6 +110,7 @@ jobs:
- name: Run the tests
id: run-tests
if: matrix.os != 'windows-2022'
env:
# Set offline mode to make sure configure preloaded successfully.
HF_HUB_OFFLINE: 1
@ -119,11 +127,13 @@ jobs:
- 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 }} > 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
if: matrix.os != 'windows-2022'
id: archive-results
uses: actions/upload-artifact@v3
with:

View File

@ -16,24 +16,25 @@ jobs:
- requirements-lin-cuda.txt
- requirements-lin-amd.txt
- requirements-mac-mps-cpu.txt
- requirements-win-colab-cuda.txt
python-version:
# - '3.9'
- '3.10'
include:
- requirements-file: requirements-lin-cuda.txt
os: ubuntu-latest
default-shell: bash -l {0}
os: ubuntu-22.04
github-env: $GITHUB_ENV
- requirements-file: requirements-lin-amd.txt
os: ubuntu-latest
default-shell: bash -l {0}
os: ubuntu-22.04
github-env: $GITHUB_ENV
- requirements-file: requirements-mac-mps-cpu.txt
os: macOS-12
default-shell: bash -l {0}
github-env: $GITHUB_ENV
- requirements-file: requirements-win-colab-cuda.txt
os: windows-2022
github-env: $env:GITHUB_ENV
name: ${{ matrix.requirements-file }} on ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
defaults:
run:
shell: ${{ matrix.default-shell }}
env:
INVOKEAI_ROOT: '${{ github.workspace }}/invokeai'
PYTHONUNBUFFERED: 1
@ -43,6 +44,18 @@ jobs:
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: create models.yaml from example
run: |
mkdir -p ${{ env.INVOKEAI_ROOT }}/configs
@ -59,15 +72,15 @@ jobs:
- name: set test prompt to main branch validation
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
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
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
run: cp 'environments-and-requirements/${{ matrix.requirements-file }}' '${{ matrix.requirements-file }}'
@ -76,14 +89,14 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: ${{ matrix.requirements-file }}
# cache: 'pip'
# cache-dependency-path: ${{ matrix.requirements-file }}
# - name: install dependencies
# run: ${{ env.pythonLocation }}/bin/pip install --upgrade pip setuptools wheel
- name: install requirements
run: ${{ env.pythonLocation }}/bin/pip install -r '${{ matrix.requirements-file }}'
run: pip3 install -r '${{ matrix.requirements-file }}'
- name: run configure_invokeai.py
id: run-preload-models
@ -92,7 +105,7 @@ jobs:
mkdir -p ~/.huggingface
echo -n '${{ secrets.HUGGINGFACE_TOKEN }}' > ~/.huggingface/token
fi
${{ env.pythonLocation }}/bin/python scripts/configure_invokeai.py \
python3 scripts/configure_invokeai.py \
--no-interactive --yes \
--full-precision # can't use fp16 weights without a GPU
@ -102,22 +115,24 @@ jobs:
- name: Run the tests
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: |
time ${{ env.pythonLocation }}/bin/python scripts/invoke.py \
time 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_ROOT }}/outputs"
--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 }}

View File

@ -33,7 +33,7 @@ torch-fidelity
torchmetrics
transformers~=4.24
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/openai/CLIP.git@main#egg=clip
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
# Get hardware-appropriate torch/torchvision
--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
torchvision==0.13.1
-e .

View File

@ -62,7 +62,7 @@ const PromptInput = () => {
<Textarea
id="prompt"
name="prompt"
placeholder="I'm dreaming of..."
placeholder="Type prompt here. [negative tokens], (upweight)++, (downweight)--, swap and blend are available (see docs)"
size={'lg'}
value={prompt}
onChange={handleChangePrompt}

View File

@ -763,7 +763,7 @@ class Generate:
elif text_mask:
init_mask = self._txt2mask(image, text_mask, width, height, fit=fit)
if invert_mask:
if init_mask and invert_mask:
init_mask = ImageOps.invert(init_mask)
return init_image,init_mask

View File

@ -282,7 +282,7 @@ def main_loop(gen, opt):
prefix = file_writer.unique_prefix()
step_callback = make_step_callback(gen, opt, prefix) if opt.save_intermediates > 0 else None
def image_writer(image, seed, upscaled=False, first_seed=None, use_prefix=None):
def image_writer(image, seed, upscaled=False, first_seed=None, use_prefix=None, prompt_in=None):
# note the seed is the seed of the current image
# the first_seed is the original seed that noise is added to
# when the -v switch is used to generate variations
@ -311,7 +311,7 @@ def main_loop(gen, opt):
if use_prefix is not None:
prefix = use_prefix
postprocessed = upscaled if upscaled else operation=='postprocess'
opt.prompt = gen.concept_lib().replace_triggers_with_concepts(opt.prompt) # to avoid the problem of non-unique concept triggers
opt.prompt = gen.concept_lib().replace_triggers_with_concepts(opt.prompt or prompt_in) # to avoid the problem of non-unique concept triggers
filename, formatted_dream_prompt = prepare_image_metadata(
opt,
prefix,

View File

@ -40,7 +40,7 @@ class Embiggen(Generator):
image = make_image()
results.append([image, seed])
if image_callback is not None:
image_callback(image, seed)
image_callback(image, seed, prompt_in=prompt)
seed = self.new_seed()
return results