Skip to content

Commit 174a9b7

Browse files
committed
Bring main back into a consistent state with other branches
- Due to misuse of rebase command, main was transiently in an inconsistent state. - This repairs the damage, and adds a few post-release patches that ensure stable conda installs on Mac and Windows.
2 parents 90d37ea + aa247e6 commit 174a9b7

File tree

370 files changed

+32862
-10007
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

370 files changed

+32862
-10007
lines changed

.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*
2+
!environment*.yml
3+
!docker-build
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Building the Image without pushing to confirm it is still buildable
2+
# confirum functionality would unfortunately need way more resources
3+
name: build container image
4+
on:
5+
push:
6+
branches:
7+
- 'main'
8+
- 'development'
9+
pull_request:
10+
branches:
11+
- 'main'
12+
- 'development'
13+
14+
jobs:
15+
docker:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: prepare docker-tag
19+
env:
20+
repository: ${{ github.repository }}
21+
run: echo "dockertag=${repository,,}" >> $GITHUB_ENV
22+
- name: Checkout
23+
uses: actions/checkout@v3
24+
- name: Set up QEMU
25+
uses: docker/setup-qemu-action@v2
26+
- name: Set up Docker Buildx
27+
uses: docker/setup-buildx-action@v2
28+
- name: Cache Docker layers
29+
uses: actions/cache@v2
30+
with:
31+
path: /tmp/.buildx-cache
32+
key: buildx-${{ hashFiles('docker-build/Dockerfile') }}
33+
- name: Build container
34+
uses: docker/build-push-action@v3
35+
with:
36+
context: .
37+
file: docker-build/Dockerfile
38+
platforms: linux/amd64
39+
push: false
40+
tags: ${{ env.dockertag }}:latest
41+
cache-from: type=local,src=/tmp/.buildx-cache
42+
cache-to: type=local,dest=/tmp/.buildx-cache

.github/workflows/create-caches.yml

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -54,27 +54,10 @@ jobs:
5454
[[ -d models/ldm/stable-diffusion-v1 ]] \
5555
|| mkdir -p models/ldm/stable-diffusion-v1
5656
[[ -r models/ldm/stable-diffusion-v1/model.ckpt ]] \
57-
|| curl -o models/ldm/stable-diffusion-v1/model.ckpt ${{ secrets.SD_V1_4_URL }}
58-
59-
- name: Use cached Conda Environment
60-
uses: actions/cache@v3
61-
env:
62-
cache-name: cache-conda-env-${{ env.CONDA_ENV_NAME }}
63-
conda-env-file: ${{ matrix.environment-file }}
64-
with:
65-
path: ${{ env.CONDA_ROOT }}/envs/${{ env.CONDA_ENV_NAME }}
66-
key: ${{ env.cache-name }}
67-
restore-keys: ${{ env.cache-name }}-${{ runner.os }}-${{ hashFiles(env.conda-env-file) }}
68-
69-
- name: Use cached Conda Packages
70-
uses: actions/cache@v3
71-
env:
72-
cache-name: cache-conda-env-${{ env.CONDA_ENV_NAME }}
73-
conda-env-file: ${{ matrix.environment-file }}
74-
with:
75-
path: ${{ env.CONDA_PKGS_DIR }}
76-
key: ${{ env.cache-name }}
77-
restore-keys: ${{ env.cache-name }}-${{ runner.os }}-${{ hashFiles(env.conda-env-file) }}
57+
|| curl \
58+
-H "Authorization: Bearer ${{ secrets.HUGGINGFACE_TOKEN }}" \
59+
-o models/ldm/stable-diffusion-v1/model.ckpt \
60+
-L https://huggingface.co/CompVis/stable-diffusion-v-1-4-original/resolve/main/sd-v1-4.ckpt
7861
7962
- name: Activate Conda Env
8063
uses: conda-incubator/setup-miniconda@v2
Lines changed: 51 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Test Invoke with Conda
1+
name: Test invoke.py
22
on:
33
push:
44
branches:
@@ -11,31 +11,57 @@ on:
1111
- 'development'
1212

1313
jobs:
14-
os_matrix:
14+
matrix:
1515
strategy:
16+
fail-fast: false
1617
matrix:
17-
os: [ubuntu-latest, macos-latest]
18+
stable-diffusion-model:
19+
# - 'https://huggingface.co/CompVis/stable-diffusion-v-1-4-original/resolve/main/sd-v1-4.ckpt'
20+
- 'https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.ckpt'
21+
os:
22+
- ubuntu-latest
23+
- macOS-12
1824
include:
1925
- os: ubuntu-latest
2026
environment-file: environment.yml
2127
default-shell: bash -l {0}
22-
- os: macos-latest
28+
- os: macOS-12
2329
environment-file: environment-mac.yml
2430
default-shell: bash -l {0}
25-
name: Test invoke.py on ${{ matrix.os }} with conda
31+
# - stable-diffusion-model: https://huggingface.co/CompVis/stable-diffusion-v-1-4-original/resolve/main/sd-v1-4.ckpt
32+
# stable-diffusion-model-dl-path: models/ldm/stable-diffusion-v1/sd-v1-4.ckpt
33+
# stable-diffusion-model-switch: stable-diffusion-1.4
34+
- stable-diffusion-model: https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.ckpt
35+
stable-diffusion-model-dl-path: models/ldm/stable-diffusion-v1/v1-5-pruned-emaonly.ckpt
36+
stable-diffusion-model-switch: stable-diffusion-1.5
37+
name: ${{ matrix.os }} with ${{ matrix.stable-diffusion-model-switch }}
2638
runs-on: ${{ matrix.os }}
39+
env:
40+
CONDA_ENV_NAME: invokeai
2741
defaults:
2842
run:
2943
shell: ${{ matrix.default-shell }}
3044
steps:
3145
- name: Checkout sources
46+
id: checkout-sources
3247
uses: actions/checkout@v3
3348

34-
- name: setup miniconda
49+
- name: create models.yaml from example
50+
run: cp configs/models.yaml.example configs/models.yaml
51+
52+
- name: Use cached conda packages
53+
id: use-cached-conda-packages
54+
uses: actions/cache@v3
55+
with:
56+
path: ~/conda_pkgs_dir
57+
key: conda-pkgs-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles(matrix.environment-file) }}
58+
59+
- name: Activate Conda Env
60+
id: activate-conda-env
3561
uses: conda-incubator/setup-miniconda@v2
3662
with:
37-
auto-activate-base: false
38-
auto-update-conda: false
63+
activate-environment: ${{ env.CONDA_ENV_NAME }}
64+
environment-file: ${{ matrix.environment-file }}
3965
miniconda-version: latest
4066

4167
- name: set test prompt to main branch validation
@@ -48,79 +74,40 @@ jobs:
4874

4975
- name: set test prompt to Pull Request validation
5076
if: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/development' }}
51-
run: echo "TEST_PROMPTS=tests/pr_prompt.txt" >> $GITHUB_ENV
77+
run: echo "TEST_PROMPTS=tests/validate_pr_prompt.txt" >> $GITHUB_ENV
5278

53-
- name: set conda environment name
54-
run: echo "CONDA_ENV_NAME=invokeai" >> $GITHUB_ENV
55-
56-
- name: Use Cached Stable Diffusion v1.4 Model
57-
id: cache-sd-v1-4
58-
uses: actions/cache@v3
59-
env:
60-
cache-name: cache-sd-v1-4
61-
with:
62-
path: models/ldm/stable-diffusion-v1/model.ckpt
63-
key: ${{ env.cache-name }}
64-
restore-keys: ${{ env.cache-name }}
65-
66-
- name: Download Stable Diffusion v1.4 Model
67-
if: ${{ steps.cache-sd-v1-4.outputs.cache-hit != 'true' }}
79+
- name: Download ${{ matrix.stable-diffusion-model-switch }}
80+
id: download-stable-diffusion-model
6881
run: |
6982
[[ -d models/ldm/stable-diffusion-v1 ]] \
7083
|| mkdir -p models/ldm/stable-diffusion-v1
71-
[[ -r models/ldm/stable-diffusion-v1/model.ckpt ]] \
72-
|| curl -o models/ldm/stable-diffusion-v1/model.ckpt ${{ secrets.SD_V1_4_URL }}
73-
74-
- name: Use cached Conda Environment
75-
uses: actions/cache@v3
76-
env:
77-
cache-name: cache-conda-env-${{ env.CONDA_ENV_NAME }}
78-
conda-env-file: ${{ matrix.environment-file }}
79-
with:
80-
path: ${{ env.CONDA }}/envs/${{ env.CONDA_ENV_NAME }}
81-
key: env-${{ env.cache-name }}-${{ runner.os }}-${{ hashFiles(env.conda-env-file) }}
82-
83-
- name: Use cached Conda Packages
84-
uses: actions/cache@v3
85-
env:
86-
cache-name: cache-conda-pkgs-${{ env.CONDA_ENV_NAME }}
87-
conda-env-file: ${{ matrix.environment-file }}
88-
with:
89-
path: ${{ env.CONDA_PKGS_DIR }}
90-
key: pkgs-${{ env.cache-name }}-${{ runner.os }}-${{ hashFiles(env.conda-env-file) }}
91-
92-
- name: Activate Conda Env
93-
uses: conda-incubator/setup-miniconda@v2
94-
with:
95-
activate-environment: ${{ env.CONDA_ENV_NAME }}
96-
environment-file: ${{ matrix.environment-file }}
97-
98-
- name: Use Cached Huggingface and Torch models
99-
id: cache-hugginface-torch
100-
uses: actions/cache@v3
101-
env:
102-
cache-name: cache-hugginface-torch
103-
with:
104-
path: ~/.cache
105-
key: ${{ env.cache-name }}
106-
restore-keys: |
107-
${{ env.cache-name }}-${{ hashFiles('scripts/preload_models.py') }}
84+
curl \
85+
-H "Authorization: Bearer ${{ secrets.HUGGINGFACE_TOKEN }}" \
86+
-o ${{ matrix.stable-diffusion-model-dl-path }} \
87+
-L ${{ matrix.stable-diffusion-model }}
10888
10989
- name: run preload_models.py
110-
run: python scripts/preload_models.py
90+
id: run-preload-models
91+
run: |
92+
python scripts/preload_models.py \
93+
--no-interactive
11194
11295
- name: Run the tests
96+
id: run-tests
11397
run: |
11498
time python scripts/invoke.py \
99+
--model ${{ matrix.stable-diffusion-model-switch }} \
115100
--from_file ${{ env.TEST_PROMPTS }}
116101
117102
- name: export conda env
103+
id: export-conda-env
118104
run: |
119105
mkdir -p outputs/img-samples
120-
conda env export --name ${{ env.CONDA_ENV_NAME }} > outputs/img-samples/environment-${{ runner.os }}.yml
106+
conda env export --name ${{ env.CONDA_ENV_NAME }} > outputs/img-samples/environment-${{ runner.os }}-${{ runner.arch }}.yml
121107
122108
- name: Archive results
109+
id: archive-results
123110
uses: actions/upload-artifact@v3
124111
with:
125-
name: results_${{ matrix.os }}
112+
name: results_${{ matrix.os }}_${{ matrix.stable-diffusion-model-switch }}
126113
path: outputs/img-samples

.gitignore

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ outputs/
33
models/ldm/stable-diffusion-v1/model.ckpt
44
**/restoration/codeformer/weights
55

6+
# ignore user models config
7+
configs/models.user.yaml
8+
config/models.user.yml
9+
610
# ignore the Anaconda/Miniconda installer used while building Docker image
711
anaconda.sh
812

@@ -195,7 +199,13 @@ checkpoints
195199
.scratch/
196200
.vscode/
197201
gfpgan/
198-
models/ldm/stable-diffusion-v1/model.sha256
202+
models/ldm/stable-diffusion-v1/*.sha256
199203

200204
# GFPGAN model files
201205
gfpgan/
206+
207+
# config file (will be created by installer)
208+
configs/models.yaml
209+
210+
# weights (will be created by installer)
211+
models/ldm/stable-diffusion-v1/*.ckpt

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# InvokeAI: A Stable Diffusion Toolkit
44

5-
_Formally known as lstein/stable-diffusion_
5+
_Formerly known as lstein/stable-diffusion_
66

77
![project logo](docs/assets/logo.png)
88

assets/caution.png

33.2 KB
Loading

0 commit comments

Comments
 (0)