Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add test-invoke-pip.yml #1521

Merged
merged 55 commits into from
Nov 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
3f450c6
add test-invoke-pip.yml
mauwii Nov 20, 2022
96a3982
update requirements-base.txt to fix tests
mauwii Nov 20, 2022
cf61858
install requirements-base.txt separate
mauwii Nov 20, 2022
1da9f66
restore origin requirements
mauwii Nov 21, 2022
39cb688
Merge branch 'development' into add-test-invoke-pip-workflow
mauwii Nov 21, 2022
7e7c63b
re-add previously overseen req in lin-cuda
mauwii Nov 21, 2022
85f3418
Merge branch 'add-test-invoke-pip-workflow' of github.com:invoke-ai/I…
mauwii Nov 21, 2022
a0393e5
fix typo in setup.py - `scripts/preload_models.py`
mauwii Nov 21, 2022
e215b44
use GFBGAN from branch `basicsr-1.4.2`
mauwii Nov 21, 2022
4bdee4d
remove `basicsr>=1.4.2` from base reqs
mauwii Nov 21, 2022
66eb6aa
add INVOKEAI_ROOT to env
mauwii Nov 21, 2022
fb616f2
Merge branch 'development' into add-test-invoke-pip-workflow
lstein Nov 23, 2022
3afa219
disable upgrade of `pip`, `setuptools` and `wheel`
mauwii Nov 24, 2022
77b4658
try to use a venv which should not contain `wheel`
mauwii Nov 24, 2022
6260096
add relative path to pip command
mauwii Nov 24, 2022
a746de5
use `configure_invokeai.py --no-interactive --yes`
mauwii Nov 24, 2022
5e83268
set grpcio to `<1.51.0`
mauwii Nov 24, 2022
2623524
revert changes to use venv
mauwii Nov 24, 2022
bdfba5c
remove `--prefer-binary`
mauwii Nov 24, 2022
bb793a2
disable step to create models.yaml
mauwii Nov 24, 2022
df6be3f
use `pip install --no-binary=":all:"`
mauwii Nov 24, 2022
473ad6a
another try to use venv
mauwii Nov 24, 2022
96a5486
try uninstalling wheel before installing reqs
mauwii Nov 24, 2022
58e04a4
dont use requirements.txt as filename
mauwii Nov 24, 2022
d198632
Merge branch 'development' into add-test-invoke-pip-workflow
mauwii Nov 24, 2022
68c320c
update cache-dependency-path
mauwii Nov 24, 2022
25ae3e6
add facexlib to requirements-base.txt
mauwii Nov 24, 2022
83ae4be
first install requirements-base.txt
mauwii Nov 24, 2022
3db010a
first install `-e .`, then install requirements
mauwii Nov 24, 2022
a2e40f2
add facexlib to requirements.in
mauwii Nov 24, 2022
d0553ca
remove `-e .` from reqs and install after reqs
mauwii Nov 24, 2022
4aeb02b
unpin torch and torchvision in requirements.in
mauwii Nov 24, 2022
8fe9abd
fix model dl path
mauwii Nov 24, 2022
a84dc17
fix curl output path
mauwii Nov 24, 2022
8423b0c
create directory before downloading model
mauwii Nov 24, 2022
4252d6b
set INVOKEAI_ROOT_PATH
mauwii Nov 24, 2022
1916207
INVOKEAI_ROOT ${{ env.GITHUB_WORKSPACE }}/invokeai
mauwii Nov 24, 2022
6b636e5
fix matrix stable-diffusion-model-dl-path
mauwii Nov 24, 2022
832d5fa
fix INVOKEAI_ROOT
mauwii Nov 24, 2022
4711b32
fix INVOKEAI_ROOT
mauwii Nov 24, 2022
9161968
add --root and --outdir to run-tests step
mauwii Nov 24, 2022
2509be9
create models.yaml from example
mauwii Nov 24, 2022
0176c29
fix scripts variable in setup.py
mauwii Nov 24, 2022
30824e7
fix archive-results path
mauwii Nov 24, 2022
e332ca6
fix workflow to reflect latest code changes
mauwii Nov 24, 2022
12bb25e
fix copy paste error
mauwii Nov 24, 2022
6ffd4d6
fix job name
mauwii Nov 24, 2022
d6fec55
fix matrix.stable-diffusion-model
mauwii Nov 24, 2022
be8027a
restructure matrix
mauwii Nov 24, 2022
e9d6585
fix `activate conda env` step
mauwii Nov 24, 2022
601526f
update the environment yamls
mauwii Nov 24, 2022
600ac8d
Merge branch 'fix-test-invoke-conda' into add-test-invoke-pip-workflow
mauwii Nov 24, 2022
a421352
rename job in test-invoke-conda
mauwii Nov 24, 2022
e0b98a6
add tqdm to environment-lin-amd.yml
mauwii Nov 24, 2022
317ccb8
fix python commands in test-invoke-conda.yml
mauwii Nov 24, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 37 additions & 32 deletions .github/workflows/test-invoke-conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
branches:
- 'main'
- 'development'
- 'fix-gh-actions-fork'
pull_request:
branches:
- 'main'
Expand All @@ -15,28 +16,30 @@ jobs:
fail-fast: false
matrix:
stable-diffusion-model:
# - 'https://huggingface.co/CompVis/stable-diffusion-v-1-4-original/resolve/main/sd-v1-4.ckpt'
- 'https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.ckpt'
os:
- ubuntu-latest
- macOS-12
- 'stable-diffusion-1.5'
environment-yaml:
- environment-lin-amd.yml
- environment-lin-cuda.yml
- environment-mac.yml
include:
- os: ubuntu-latest
environment-file: environment-lin-cuda.yml
- environment-yaml: environment-lin-amd.yml
os: ubuntu-latest
default-shell: bash -l {0}
- os: macOS-12
environment-file: environment-mac.yml
- environment-yaml: environment-lin-cuda.yml
os: ubuntu-latest
default-shell: bash -l {0}
# - 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: stable-diffusion-1.5
name: ${{ matrix.os }} with ${{ matrix.stable-diffusion-model-switch }}
- 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 }}
runs-on: ${{ matrix.os }}
env:
CONDA_ENV_NAME: invokeai
INVOKEAI_ROOT: '${{ github.workspace }}/invokeai'
defaults:
run:
shell: ${{ matrix.default-shell }}
Expand All @@ -46,17 +49,19 @@ jobs:
uses: actions/checkout@v3

- name: create models.yaml from example
run: cp configs/models.yaml.example configs/models.yaml
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-file }} 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-file) }}
key: conda-pkgs-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles(matrix.environment-yaml) }}

- name: Activate Conda Env
id: activate-conda-env
Expand All @@ -82,34 +87,34 @@ jobs:
id: cache-sd-model
uses: actions/cache@v3
env:
cache-name: cache-${{ matrix.stable-diffusion-model-switch }}
cache-name: cache-${{ matrix.stable-diffusion-model }}
with:
path: ${{ matrix.stable-diffusion-model-dl-path }}
key: ${{ env.cache-name }}

- name: Download ${{ matrix.stable-diffusion-model-switch }}
- name: Download ${{ matrix.stable-diffusion-model }}
id: download-stable-diffusion-model
if: ${{ steps.cache-sd-model.outputs.cache-hit != 'true' }}
run: |
[[ -d models/ldm/stable-diffusion-v1 ]] \
|| mkdir -p models/ldm/stable-diffusion-v1
mkdir -p "${{ env.INVOKEAI_ROOT }}/${{ matrix.stable-diffusion-model-dl-path }}"
curl \
-H "Authorization: Bearer ${{ secrets.HUGGINGFACE_TOKEN }}" \
-o ${{ matrix.stable-diffusion-model-dl-path }} \
-L ${{ matrix.stable-diffusion-model }}
-o "${{ env.INVOKEAI_ROOT }}/${{ matrix.stable-diffusion-model-dl-path }}/${{ matrix.stable-diffusion-model-dl-name }}" \
-L ${{ matrix.stable-diffusion-model-url }}

- name: run preload_models.py
- name: run configure_invokeai.py
id: run-preload-models
run: |
python scripts/preload_models.py \
--no-interactive
python scripts/configure_invokeai.py --no-interactive --yes

- name: Run the tests
id: run-tests
run: |
time python scripts/invoke.py \
--model ${{ matrix.stable-diffusion-model-switch }} \
--from_file ${{ env.TEST_PROMPTS }}
--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
Expand All @@ -121,5 +126,5 @@ jobs:
id: archive-results
uses: actions/upload-artifact@v3
with:
name: results_${{ matrix.os }}_${{ matrix.stable-diffusion-model-switch }}
path: outputs/img-samples
name: results_${{ matrix.requirements-file }}_${{ matrix.python-version }}
path: ${{ env.INVOKEAI_ROOT }}/outputs/img-samples
125 changes: 125 additions & 0 deletions .github/workflows/test-invoke-pip.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
name: Test invoke.py pip
on:
push:
branches:
- 'main'
- 'development'
pull_request:
branches:
- 'main'
- 'development'

jobs:
matrix:
strategy:
fail-fast: false
matrix:
stable-diffusion-model:
- stable-diffusion-1.5
requirements-file:
- requirements-lin-cuda.txt
- requirements-lin-amd.txt
- requirements-mac-mps-cpu.txt
python-version:
- '3.9'
- '3.10'
include:
- requirements-file: requirements-lin-cuda.txt
os: ubuntu-latest
default-shell: bash -l {0}
- requirements-file: requirements-lin-amd.txt
os: ubuntu-latest
default-shell: bash -l {0}
- requirements-file: requirements-mac-mps-cpu.txt
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.requirements-file }} on ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
defaults:
run:
shell: ${{ matrix.default-shell }}
env:
INVOKEAI_ROOT: '${{ github.workspace }}/invokeai'
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: set test prompt to main branch validation
if: ${{ github.ref == 'refs/heads/main' }}
run: echo "TEST_PROMPTS=tests/preflight_prompts.txt" >> $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

- 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

- name: create requirements.txt
run: cp 'environments-and-requirements/${{ matrix.requirements-file }}' '${{ matrix.requirements-file }}'

- name: setup python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
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 --upgrade -r '${{ matrix.requirements-file }}'
${{ env.pythonLocation }}/bin/pip install -e .

- name: Use Cached Stable Diffusion Model
id: cache-sd-model
uses: actions/cache@v3
env:
cache-name: cache-${{ matrix.stable-diffusion-model }}
with:
path: ${{ 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
id: run-preload-models
run: |
${{ env.pythonLocation }}/bin/python scripts/configure_invokeai.py --no-interactive --yes

- name: Run the tests
id: run-tests
run: |
time ${{ env.pythonLocation }}/bin/python scripts/invoke.py \
--model ${{ matrix.stable-diffusion-model }} \
--from_file ${{ env.TEST_PROMPTS }} \
--root="${{ env.INVOKEAI_ROOT }}" \
--outdir="${{ env.INVOKEAI_ROOT }}/outputs"

- name: Archive results
id: archive-results
uses: actions/upload-artifact@v3
with:
name: results_${{ matrix.requirements-file }}_${{ matrix.python-version }}
path: ${{ env.INVOKEAI_ROOT }}/outputs/img-samples
4 changes: 2 additions & 2 deletions configs/models.yaml.example
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
# was trained on.
stable-diffusion-1.5:
description: The newest Stable Diffusion version 1.5 weight file (4.27 GB)
weights: ./models/ldm/stable-diffusion-v1/v1-5-pruned-emaonly.ckpt
config: ./configs/stable-diffusion/v1-inference.yaml
weights: models/ldm/stable-diffusion-v1/v1-5-pruned-emaonly.ckpt
config: configs/stable-diffusion/v1-inference.yaml
width: 512
height: 512
vae: ./models/ldm/stable-diffusion-v1/vae-ft-mse-840000-ema-pruned.ckpt
Expand Down
5 changes: 3 additions & 2 deletions environments-and-requirements/environment-lin-amd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@ dependencies:
- streamlit==1.12.0
- taming-transformers-rom1504
- test-tube>=0.7.5
- tqdm
- torch
- torch-fidelity==0.3.0
- torchaudio
- torchmetrics==0.7.0
- torchvision
- transformers==4.21.3
- 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
- git+https://github.com/invoke-ai/clipseg.git@relaxed-python-requirement#egg=clipseg
- git+https://github.com/invoke-ai/GFPGAN#egg=gfpgan
- git+https://github.com/invoke-ai/GFPGAN@basicsr-1.4.2#egg=gfpgan
- -e .
4 changes: 2 additions & 2 deletions environments-and-requirements/environment-lin-cuda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ dependencies:
- torchmetrics==0.7.0
- transformers==4.21.3
- 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
- git+https://github.com/invoke-ai/clipseg.git@relaxed-python-requirement#egg=clipseg
- git+https://github.com/invoke-ai/GFPGAN#egg=gfpgan
- git+https://github.com/invoke-ai/GFPGAN@basicsr-1.4.2#egg=gfpgan
- -e .
5 changes: 2 additions & 3 deletions environments-and-requirements/environment-mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,9 @@ dependencies:
- taming-transformers-rom1504
- test-tube==0.7.5
- git+https://github.com/openai/CLIP.git@main#egg=clip
- git+https://github.com/invoke-ai/k-diffusion.git@mps#egg=k_diffusion
- git+https://github.com/invoke-ai/Real-ESRGAN.git#egg=realesrgan
- git+https://github.com/invoke-ai/GFPGAN.git#egg=gfpgan
- git+https://github.com/Birch-san/k-diffusion.git@mps#egg=k-diffusion
- git+https://github.com/invoke-ai/clipseg.git@relaxed-python-requirement#egg=clipseg
- git+https://github.com/invoke-ai/[email protected]#egg=gfpgan
- -e .
variables:
PYTORCH_ENABLE_MPS_FALLBACK: 1
3 changes: 2 additions & 1 deletion environments-and-requirements/requirements-base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ dependency_injector==4.40.0
diffusers
einops
eventlet
facexlib
flask==2.1.3
flask_cors==3.0.10
flask_socketio==5.3.0
Expand Down Expand Up @@ -34,4 +35,4 @@ picklescan
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/invoke-ai/clipseg.git@relaxed-python-requirement#egg=clipseg
git+https://github.com/invoke-ai/GFPGAN#egg=gfpgan
git+https://github.com/invoke-ai/GFPGAN@basicsr-1.4.2#egg=gfpgan
4 changes: 2 additions & 2 deletions environments-and-requirements/requirements-lin-amd.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-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/rocm5.1.1 --trusted-host https://download.pytorch.org
torch
torchvision
-e .
# -e .
2 changes: 1 addition & 1 deletion environments-and-requirements/requirements-lin-cuda.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
-r environments-and-requirements/requirements-base.txt
-e .
# -e .
4 changes: 2 additions & 2 deletions environments-and-requirements/requirements-mac-mps-cpu.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-r environments-and-requirements/requirements-base.txt

grpcio==1.50.0
grpcio<1.51.0
protobuf==3.19.6
torch<1.13.0
torchvision<0.14.0
-e .
# -e .
10 changes: 6 additions & 4 deletions installer/requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,25 @@
accelerate~=0.14
albumentations
diffusers
einops
eventlet
facexlib
flask_cors
flask_socketio
flaskwebgui
getpass_asterisk
imageio-ffmpeg
kornia
numpy
pyreadline3
realesrgan
send2trash
streamlit
taming-transformers-rom1504
test-tube
torch-fidelity
torch==1.12.1 ; platform_system == 'Darwin'
torch==1.12.0+cu116 ; platform_system == 'Linux' or platform_system == 'Windows'
torchvision==0.13.0 ; platform_system == 'Darwin'
torchvision==0.13.0+cu116 ; platform_system == 'Linux' or platform_system == 'Windows'
torch
torchvision
transformers
picklescan
https://github.com/openai/CLIP/archive/d50d76daa670286dd6cacf3bcd80b5e4823fc8e1.zip
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def _get_requirements(path):
packages = f.read().splitlines()
except (IOError, OSError) as ex:
raise RuntimeError("Can't open file with requirements: %s", repr(ex))

# Drop option lines
packages = [package for package in packages if not re.match(r"^--", package)]
packages = [package for package in packages if not re.match(r"^http", package)]
Expand Down Expand Up @@ -70,7 +70,7 @@ def _get_requirements(path):
'Topic :: Scientific/Engineering :: Artificial Intelligence',
'Topic :: Scientific/Engineering :: Image Processing',
],
scripts = ['scripts/invoke.py','scripts/configure_invokeai.py','scripts/sd-metadata.py'],
scripts = ['scripts/invoke.py','scripts/configure_invokeai.py', 'scripts/sd-metadata.py'],
data_files=[('frontend',frontend_files)],
)