Compare commits

..

10 Commits

Author SHA1 Message Date
rmagur1203
bd0c0d77d2 Reduce more memories on free_gpu_mem option (#1915)
* Enhance free_gpu_mem option
Unload cond_stage_model on free_gpu_mem option is setted

* Enhance free_gpu_mem option
Unload cond_stage_model on free_gpu_mem option is setted
2022-12-11 13:49:55 -05:00
Lincoln Stein
f745f78cb3 correct bug when trying to enhance JPG images (#1928)
This fix was authored by @mebelz and is reissued here to base it on
`main`.
2022-12-11 13:48:47 -05:00
Lincoln Stein
7efe0f3996 fix mkdocs formatting (#1927)
* fix mkdocs formatting

* update formatting, add some mkdocs specials

* fix wrong line break, use icon for tab key

Co-authored-by: mauwii <Mauwii@outlook.de>
2022-12-11 13:48:34 -05:00
Damian Stewart
9f855a358a fix for crash with inpainting model introduced by #1866 (#1922)
* fix for crash using inpainting model

* prevent crash due to invalid attention_maps_saver
2022-12-11 13:48:12 -05:00
Matthias Wild
62b80a81d3 Update dockerfile 2.2.4 (#1924)
* updated Dockerfile
- use `python:3.10-slim` as baseimage
- separate builder and runtime stages again
- get rid of uneeded packages
- pin packages for persistence
- remove outdir from entrypoint since invoke.init is available in /data
- shrinked image size to <2GB
- way better security score than before

* small output update to build.sh and run.sh

* update matrix in build-container.yml

* remove branches from build-container.yml
2022-12-11 17:33:54 +01:00
blessedcoolant
14587c9a95 Fresh Frontend Build 2022-12-11 11:19:22 -05:00
blessedcoolant
fcae5defe3 Add invokeai.init to gitignore 2022-12-11 11:19:22 -05:00
Lincoln Stein
e7144055d1 make webGUI model changing work again
- Using relative root addresses was causing problems when the
  current working directory was changed after start time.
- This commit makes the root address absolute at start time, such
  that changing the working directory later on doesn't break anything.
2022-12-11 11:19:22 -05:00
Lincoln Stein
c857c6cc62 rebuild frontend for 2.2.4 2022-12-11 11:19:22 -05:00
Lincoln Stein
7ecb11cf86 remove sampler questions (#1903) 2022-12-11 09:07:55 -05:00
21 changed files with 283 additions and 264 deletions

View File

@@ -5,17 +5,12 @@ on:
push:
branches:
- 'main'
- 'development'
- 'update-dockerfile'
jobs:
docker:
strategy:
fail-fast: false
matrix:
arch:
- x86_64
- aarch64
pip-requirements:
- requirements-lin-amd.txt
- requirements-lin-cuda.txt
@@ -37,7 +32,7 @@ jobs:
with:
context: .
file: docker-build/Dockerfile
platforms: Linux/${{ matrix.arch }}
platforms: linux/amd64,linux/arm64
push: false
tags: ${{ env.dockertag }}:${{ matrix.pip-requirements }}-${{ matrix.arch }}
tags: ${{ env.dockertag }}:${{ matrix.pip-requirements }}
build-args: pip_requirements=${{ matrix.pip-requirements }}

1
.gitignore vendored
View File

@@ -6,6 +6,7 @@ models/ldm/stable-diffusion-v1/model.ckpt
# ignore user models config
configs/models.user.yaml
config/models.user.yml
invokeai.init
# ignore the Anaconda/Miniconda installer used while building Docker image
anaconda.sh

View File

@@ -1,4 +1,4 @@
FROM ubuntu:22.10
FROM python:3.10-slim AS builder
# use bash
SHELL [ "/bin/bash", "-c" ]
@@ -7,28 +7,42 @@ SHELL [ "/bin/bash", "-c" ]
RUN apt-get update \
&& apt-get install -y \
--no-install-recommends \
build-essential \
gcc \
git \
libgl1-mesa-glx \
libglib2.0-0 \
pip \
python3 \
python3-dev \
gcc=4:10.2.* \
libgl1-mesa-glx=20.3.* \
libglib2.0-0=2.66.* \
python3-dev=3.9.* \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# set workdir and copy sources
WORKDIR /invokeai
# set workdir, PATH and copy sources
WORKDIR /usr/src/app
ENV PATH /usr/src/app/.venv/bin:$PATH
ARG PIP_REQUIREMENTS=requirements-lin-cuda.txt
COPY . ./environments-and-requirements/${PIP_REQUIREMENTS} ./
# install requirements and link outputs folder
RUN pip install \
--no-cache-dir \
-r ${PIP_REQUIREMENTS}
# install requirements
RUN python3 -m venv .venv \
&& pip install \
--no-cache-dir \
-r ${PIP_REQUIREMENTS}
FROM python:3.10-slim AS runtime
# Install necesarry packages
RUN apt-get update \
&& apt-get install -y \
--no-install-recommends \
libgl1-mesa-glx=20.3.* \
libglib2.0-0=2.66.* \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /usr/src/app
COPY --from=builder /usr/src/app .
# set Environment, Entrypoint and default CMD
ENV INVOKEAI_ROOT /data
ENTRYPOINT [ "python3", "scripts/invoke.py", "--outdir=/data/outputs" ]
ENV PATH=/usr/src/app/.venv/bin:$PATH
ENTRYPOINT [ "python3", "scripts/invoke.py" ]
CMD [ "--web", "--host=0.0.0.0" ]

View File

@@ -12,13 +12,13 @@ pip_requirements=${PIP_REQUIREMENTS:-requirements-lin-cuda.txt}
dockerfile=${INVOKE_DOCKERFILE:-docker-build/Dockerfile}
# print the settings
echo "You are using these values:"
echo -e "Dockerfile:\t\t ${dockerfile}"
echo -e "requirements:\t\t ${pip_requirements}"
echo -e "volumename:\t\t ${volumename}"
echo -e "arch:\t\t\t ${arch}"
echo -e "platform:\t\t ${platform}"
echo -e "invokeai_tag:\t\t ${invokeai_tag}\n"
echo -e "You are using these values:\n"
echo -e "Dockerfile:\t ${dockerfile}"
echo -e "requirements:\t ${pip_requirements}"
echo -e "volumename:\t ${volumename}"
echo -e "arch:\t\t ${arch}"
echo -e "platform:\t ${platform}"
echo -e "invokeai_tag:\t ${invokeai_tag}\n"
if [[ -n "$(docker volume ls -f name="${volumename}" -q)" ]]; then
echo "Volume already exists"

View File

@@ -3,6 +3,10 @@ set -e
source ./docker-build/env.sh || echo "please run from repository root" || exit 1
echo -e "You are using these values:\n"
echo -e "volumename:\t ${volumename}"
echo -e "invokeai_tag:\t ${invokeai_tag}\n"
docker run \
--interactive \
--tty \

View File

@@ -6,56 +6,79 @@ title: InvokeAI Automated Installation
## Introduction
The automated installer is a shell script that attempts to automate
every step needed to install and run InvokeAI on a stock computer
running recent versions of Linux, MacOS or Windows. It will leave you
with a version that runs a stable version of InvokeAI with the option
to upgrade to experimental versions later.
The automated installer is a shell script that attempts to automate every step
needed to install and run InvokeAI on a stock computer running recent versions
of Linux, MacOS or Windows. It will leave you with a version that runs a stable
version of InvokeAI with the option to upgrade to experimental versions later.
## Walk through
1. Make sure that your system meets the [hardware
requirements](../index.md#hardware-requirements) and has the
appropriate GPU drivers installed. In particular, if you are a Linux
user with an AMD GPU installed, you may need to install the [ROCm
driver](https://rocmdocs.amd.com/en/latest/Installation_Guide/Installation-Guide.html).
1. Make sure that your system meets the
[hardware requirements](../index.md#hardware-requirements) and has the
appropriate GPU drivers installed. In particular, if you are a Linux user
with an AMD GPU installed, you may need to install the
[ROCm driver](https://rocmdocs.amd.com/en/latest/Installation_Guide/Installation-Guide.html).
- Installation requires roughly 18G of free disk space to load the libraries and
recommended model weights files.
!!! info "Required Space"
2. Check that your system has an up-to-date Python installed. To do
this, open up a command-line window ("Terminal" on Linux and
Macintosh, "Command" or "Powershell" on Windows) and type `python
--version`. If Python is installed, it will print out the version
number. If it is version `3.9.1` or higher, you meet requirements.
Installation requires roughly 18G of free disk space to load the libraries and
recommended model weights files.
- If you see an older version, or you get a command not found
error, then go to [Python
Downloads](https://www.python.org/downloads/) and download the
appropriate installer package for your platform. We recommend
[Version
3.10.9](https://www.python.org/downloads/release/python-3109/),
which has been extensively tested with InvokeAI.
2. Check that your system has an up-to-date Python installed. To do this, open
up a command-line window ("Terminal" on Linux and Macintosh, "Command" or
"Powershell" on Windows) and type `python --version`. If Python is
installed, it will print out the version number. If it is version `3.9.1` or
higher, you meet requirements.
-**Windows users**: During the Python configuration process,
Please look out for a checkbox to add Python to your PATH
and select it. If the install script complains that it can't
find python, then open the Python installer again and choose
"Modify" existing installation.
!!! warning "If you see an older version, or get a command not found error"
- **Mac users**: After installing Python, you may need to run the
following command from the Terminal in order to install the Web
certificates needed to download model data from https sites. If
you see lots of CERTIFICATE ERRORS during the last part of the
install, this is the problem:
Go to [Python Downloads](https://www.python.org/downloads/) and
download the appropriate installer package for your platform. We recommend
[Version 3.10.9](https://www.python.org/downloads/release/python-3109/),
which has been extensively tested with InvokeAI.
`/Applications/Python\ 3.10/Install\ Certificates.command`
!!! warning "At this time we do not recommend Python 3.11"
Do not use Python 3.11 at this time due to poor performance
of the underlying pytorch machine learning library.
=== "Windows users"
- **Linux users**: See [Installing Python in Ubuntu](#installing-python-in-ubuntu) for some
platform-specific tips.
- During the Python configuration process,
Please look out for a checkbox to add Python to your PATH
and select it. If the install script complains that it can't
find python, then open the Python installer again and choose
"Modify" existing installation.
- There is a slight possibility that you will encountered
DLL load errors at the very end of the installation process. This is caused
by not having up to date Visual C++ redistributable libraries. If this
happens to you, you can install the C++ libraries from this site:
https://learn.microsoft.com/en-us/cpp/windows/deploying-native-desktop-applications-visual-cpp?view=msvc-170
=== "Mac users"
- After installing Python, you may need to run the
following command from the Terminal in order to install the Web
certificates needed to download model data from https sites. If
you see lots of CERTIFICATE ERRORS during the last part of the
install, this is the problem, and you can fix it with this command:
`/Applications/Python\ 3.10/Install\ Certificates.command`
- You may need to install the Xcode command line tools. These
are a set of tools that are needed to run certain applications in a
Terminal, including InvokeAI. This package is provided directly by Apple.
- To install, open a terminal window and run `xcode-select
--install`. You will get a macOS system popup guiding you through the
install. If you already have them installed, you will instead see some
output in the Terminal advising you that the tools are already installed.
- More information can be found here:
https://www.freecodecamp.org/news/install-xcode-command-line-tools/
=== "Linux users"
- See [Installing Python in Ubuntu](#installing-python-in-ubuntu) for some
platform-specific tips.
3. The source installer is distributed in ZIP files. Go to the
[latest release](https://github.com/invoke-ai/InvokeAI/releases/latest), and
@@ -67,30 +90,10 @@ number. If it is version `3.9.1` or higher, you meet requirements.
Download the one that is appropriate for your operating system.
4. If you are a macOS user, you may need to install the Xcode command line tools.
These are a set of tools that are needed to run certain applications in a Terminal,
including InvokeAI. This package is provided directly by Apple.
- To install, open a terminal window and run `xcode-select
--install`. You will get a macOS system popup guiding you through
the install. If you already have them installed, you will instead
see some output in the Terminal advising you that the tools are
already installed.
- More information can be found here:
https://www.freecodecamp.org/news/install-xcode-command-line-tools/
5. If you are a Windows users, there is a slight possibility that you
will encountered DLL load errors at the very end of the installation
process. This is caused by not having up to date Visual C++
redistributable libraries. If this happens to you, you can install
the C++ libraries from this site:
https://learn.microsoft.com/en-us/cpp/windows/deploying-native-desktop-applications-visual-cpp?view=msvc-170
6. Unpack the zip file into a convenient directory. This will create
a new directory named "InvokeAI-Installer". This example shows how
this would look using the `unzip` command-line tool, but you may
use any graphical or command-line Zip extractor:
4. Unpack the zip file into a convenient directory. This will create a new
directory named "InvokeAI-Installer". This example shows how this would look
using the `unzip` command-line tool, but you may use any graphical or
command-line Zip extractor:
```cmd
C:\Documents\Linco> unzip InvokeAI-installer-2.2.4-windows.zip
@@ -101,63 +104,61 @@ number. If it is version `3.9.1` or higher, you meet requirements.
...
```
After successful installation, you can delete the
`InvokeAI-Installer` directory.
After successful installation, you can delete the `InvokeAI-Installer`
directory.
7. Windows users should now double-click on the file WinLongPathsEnabled.reg
and accept the dialog box that asks you if you wish to modify your
registry. This activates long filename support on your system and will
prevent mysterious errors during installation.
5. **Windows only** Please double-click on the file WinLongPathsEnabled.reg and
accept the dialog box that asks you if you wish to modify your registry.
This activates long filename support on your system and will prevent
mysterious errors during installation.
8. If you are using a desktop GUI, double-click the installer file. It will be
6. If you are using a desktop GUI, double-click the installer file. It will be
named `install.bat` on Windows systems and `install.sh` on Linux and
Macintosh systems.
On Windows systems you will probably get an "Untrusted Publisher" warning.
Click on "More Info" and select "Run Anyway." You trust us, right?
Click on "More Info" and select "Run Anyway." You trust us, right?
9. Alternatively, from the command line, run the shell script or .bat file:
7. Alternatively, from the command line, run the shell script or .bat file:
```cmd
C:\Documents\Linco> cd InvokeAI-Installer
C:\Documents\Linco\invokeAI> install.bat
```
10. The script will ask you to choose where to install InvokeAI. Select
a directory with at least 18G of free space for a full
install. InvokeAI and all its support files will be installed into
a new directory named `invokeai` located at the location you specify.
8. The script will ask you to choose where to install InvokeAI. Select a
directory with at least 18G of free space for a full install. InvokeAI and
all its support files will be installed into a new directory named
`invokeai` located at the location you specify.
- The default is to install the `invokeai` directory in your home
directory, usually `C:\Users\YourName\invokeai` on Windows systems,
`/home/YourName/invokeai` on Linux systems, and
`/Users/YourName/invokeai` on Macintoshes, where "YourName" is your
login name.
- The default is to install the `invokeai` directory in your home directory,
usually `C:\Users\YourName\invokeai` on Windows systems,
`/home/YourName/invokeai` on Linux systems, and `/Users/YourName/invokeai`
on Macintoshes, where "YourName" is your login name.
- The script uses tab autocompletion to suggest directory path
completions. Type part of the path (e.g. "C:\Users") and press
&lt;tab&gt; repeatedly to suggest completions.
- The script uses tab autocompletion to suggest directory path completions.
Type part of the path (e.g. "C:\Users") and press ++tab++ repeatedly
to suggest completions.
11. Sit back and let the install script work. It will install the
third-party libraries needed by InvokeAI, then download the
current InvokeAI release and install it.
9. Sit back and let the install script work. It will install the third-party
libraries needed by InvokeAI, then download the current InvokeAI release and
install it.
Be aware that some of the library download and install steps take
a long time. In particular, the `pytorch` package is quite large
and often appears to get "stuck" at 99.9%. Have patience and the
installation step will eventually resume. However, there are
occasions when the library install does legitimately get stuck. If
you have been waiting for more than ten minutes and nothing is
happening, you can interrupt the script with ^C. You may restart
it and it will pick up where it left off.
Be aware that some of the library download and install steps take a long
time. In particular, the `pytorch` package is quite large and often appears
to get "stuck" at 99.9%. Have patience and the installation step will
eventually resume. However, there are occasions when the library install
does legitimately get stuck. If you have been waiting for more than ten
minutes and nothing is happening, you can interrupt the script with ^C. You
may restart it and it will pick up where it left off.
12. After installation completes, the installer will launch a script
called `configure_invokeai.py`, which will guide you through the
first-time process of selecting one or more Stable Diffusion model
weights files, downloading and configuring them. We provide a list
of popular models that InvokeAI performs well with. However, you
can add more weight files later on using the command-line client
or the Web UI. See [Installing Models](INSTALLING_MODELS.md) for details.
10. After installation completes, the installer will launch a script called
`configure_invokeai.py`, which will guide you through the first-time process
of selecting one or more Stable Diffusion model weights files, downloading
and configuring them. We provide a list of popular models that InvokeAI
performs well with. However, you can add more weight files later on using
the command-line client or the Web UI. See
[Installing Models](INSTALLING_MODELS.md) for details.
Note that the main Stable Diffusion weights file is protected by a license
agreement that you must agree to in order to use. The script will list the
@@ -170,64 +171,72 @@ number. If it is version `3.9.1` or higher, you meet requirements.
prompted) and configure InvokeAI to use the previously-downloaded files. The
process for this is described in [Installing Models](INSTALLING_MODELS.md).
13. The script will now exit and you'll be ready to generate some
images. Look for the directory `invokeai` installed in the
location you chose at the beginning of the install session. Look
for a shell script named `invoke.sh` (Linux/Mac) or `invoke.bat`
(Windows). Launch the script by double-clicking it or typing its
name at the command-line:
11. The script will now exit and you'll be ready to generate some images. Look
for the directory `invokeai` installed in the location you chose at the
beginning of the install session. Look for a shell script named `invoke.sh`
(Linux/Mac) or `invoke.bat` (Windows). Launch the script by double-clicking
it or typing its name at the command-line:
```cmd
C:\Documents\Linco> cd invokeai
C:\Documents\Linco\invokeAI> invoke.bat
```
- The `invoke.bat` (`invoke.sh`) script will give you the choice of starting (1)
the command-line interface, or (2) the web GUI. If you start the latter, you can
load the user interface by pointing your browser at http://localhost:9090.
- The `invoke.bat` (`invoke.sh`) script will give you the choice of starting
(1) the command-line interface, or (2) the web GUI. If you start the
latter, you can load the user interface by pointing your browser at
http://localhost:9090.
- The script also offers you a third option labeled "open the developer
console". If you choose this option, you will be dropped into a
command-line interface in which you can run python commands directly,
access developer tools, and launch InvokeAI with customized options.
console". If you choose this option, you will be dropped into a
command-line interface in which you can run python commands directly,
access developer tools, and launch InvokeAI with customized options.
14. You can launch InvokeAI with several different command-line arguments
that customize its behavior. For example, you can change the location
of the inage output directory, or select your favorite sampler. See
the [Command-Line Interface](../features/CLI.md) for a full list of
the options.
12. You can launch InvokeAI with several different command-line arguments that
customize its behavior. For example, you can change the location of the
inage output directory, or select your favorite sampler. See the
[Command-Line Interface](../features/CLI.md) for a full list of the options.
- To set defaults that will take effect every time you launch InvokeAI,
use a text editor (e.g. Notepad) to exit the file
`invokeai\invokeai.init`. It contains a variety of examples that you can
follow to add and modify launch options.
- To set defaults that will take effect every time you launch InvokeAI,
use a text editor (e.g. Notepad) to exit the file
`invokeai\invokeai.init`. It contains a variety of examples that you can
follow to add and modify launch options.
!!! warning "The `invokeai` directory contains the `invoke` application, its configuration files, the model weight files, and outputs of image generation. Once InvokeAI is installed, do not move or remove this directory."
!!! warning "The `invokeai` directory contains the `invoke` application, its
configuration files, the model weight files, and outputs of image generation.
Once InvokeAI is installed, do not move or remove this directory."
## Troubleshooting
_Package dependency conflicts_ If you have previously installed
InvokeAI or another Stable Diffusion package, the installer may
occasionally pick up outdated libraries and either the installer or
`invoke` will fail with complaints about library conflicts. You can
address this by entering the `invokeai` directory and running
`update.sh`, which will bring InvokeAI up to date with the latest
libraries.
### _Package dependency conflicts_
!!! warning "Some users have tried to correct dependency problems by installing the `ldm` package from PyPi.org. Unfortunately this is an unrelated package that has nothing to do with the 'latent diffusion model' used by InvokeAI. Installing ldm will make matters worse. If you've installed ldm, uninstall it with `pip uninstall ldm`."
If you have previously installed InvokeAI or another Stable Diffusion package,
the installer may occasionally pick up outdated libraries and either the
installer or `invoke` will fail with complaints about library conflicts. You can
address this by entering the `invokeai` directory and running `update.sh`, which
will bring InvokeAI up to date with the latest libraries.
_"Corrupted configuration file."__ Everything seems to install ok, but
`invoke` complains of a corrupted configuration file and goes back
into the configuration process (asking you to download models, etc),
but this doesn't fix the problem.
### ldm from pypi
This issue is often caused by a misconfigured configuration directive
in the `invokeai\invokeai.init` initialization file that contains
startup settings. The easiest way to fix the problem is to move the
file out of the way and re-run `configure_invokeai.py`. Enter the
developer's console (option 3 of the launcher script) and run this
command:
!!! warning
Some users have tried to correct dependency problems by installing
the `ldm` package from PyPi.org. Unfortunately this is an unrelated package that
has nothing to do with the 'latent diffusion model' used by InvokeAI. Installing
ldm will make matters worse. If you've installed ldm, uninstall it with
`pip uninstall ldm`.
### Corrupted configuration file
Everything seems to install ok, but `invoke` complains of a corrupted
configuration file and goes back into the configuration process (asking you to
download models, etc), but this doesn't fix the problem.
This issue is often caused by a misconfigured configuration directive in the
`invokeai\invokeai.init` initialization file that contains startup settings. The
easiest way to fix the problem is to move the file out of the way and re-run
`configure_invokeai.py`. Enter the developer's console (option 3 of the launcher
script) and run this command:
```cmd
configure_invokeai.py --root=.
@@ -235,45 +244,12 @@ configure_invokeai.py --root=.
Note the dot (.) after `--root`. It is part of the command.
_If none of these maneuvers fixes the problem_ then please report the
problem to the [InvokeAI
Issues](https://github.com/invoke-ai/InvokeAI/issues) section, or
visit our [Discord Server](https://discord.gg/ZmtBAhwWhy) for interactive assistance.
_If none of these maneuvers fixes the problem_ then please report the problem to
the [InvokeAI Issues](https://github.com/invoke-ai/InvokeAI/issues) section, or
visit our [Discord Server](https://discord.gg/ZmtBAhwWhy) for interactive
assistance.
## Updating to newer versions
This distribution is changing rapidly, and we add new features on a daily basis.
To update to the latest released version (recommended), run the `update.sh`
(Linux/Mac) or `update.bat` (Windows) scripts. This will fetch the latest
release and re-run the `configure_invokeai` script to download any updated models
files that may be needed. You can also use this to add additional models that
you did not select at installation time.
You can now close the developer console and run `invoke` as before. If you get
complaints about missing models, then you may need to do the additional step of
running `configure_invokeai.py`. This happens relatively infrequently. To do this,
simply open up the developer's console again and type
`python scripts/configure_invokeai.py`.
You may also use the `update` script to install any selected version
of InvokeAI. From https://github.com/invoke-ai/InvokeAI, navigate to
the zip file link of the version you wish to install. You can find the
zip links by going to the one of the release pages and looking for the
**Assets** section at the bottom. Alternatively, you can browse
"branches" and "tags" at the top of the big code directory on the
InvokeAI welcome page. When you find the version you want to install,
go to the green "&lt;&gt; Code" button at the top, and copy the
"Download ZIP" link.
Now run `update.sh` (or `update.bat`) with the URL of the desired
InvokeAI version as its argument. For example, this will install the
old 2.2.0 release.
```cmd
update.sh https://github.com/invoke-ai/InvokeAI/archive/refs/tags/v2.2.0.zip
```
## Troubleshooting
### other problems
If you run into problems during or after installation, the InvokeAI team is
available to help you. Either create an
@@ -283,16 +259,46 @@ make a request for help on the "bugs-and-support" channel of our
organization, but typically somebody will be available to help you within 24
hours, and often much sooner.
## Updating to newer versions
This distribution is changing rapidly, and we add new features on a daily basis.
To update to the latest released version (recommended), run the `update.sh`
(Linux/Mac) or `update.bat` (Windows) scripts. This will fetch the latest
release and re-run the `configure_invokeai` script to download any updated
models files that may be needed. You can also use this to add additional models
that you did not select at installation time.
You can now close the developer console and run `invoke` as before. If you get
complaints about missing models, then you may need to do the additional step of
running `configure_invokeai.py`. This happens relatively infrequently. To do
this, simply open up the developer's console again and type
`python scripts/configure_invokeai.py`.
You may also use the `update` script to install any selected version of
InvokeAI. From https://github.com/invoke-ai/InvokeAI, navigate to the zip file
link of the version you wish to install. You can find the zip links by going to
the one of the release pages and looking for the **Assets** section at the
bottom. Alternatively, you can browse "branches" and "tags" at the top of the
big code directory on the InvokeAI welcome page. When you find the version you
want to install, go to the green "&lt;&gt; Code" button at the top, and copy the
"Download ZIP" link.
Now run `update.sh` (or `update.bat`) with the URL of the desired InvokeAI
version as its argument. For example, this will install the old 2.2.0 release.
```cmd
update.sh https://github.com/invoke-ai/InvokeAI/archive/refs/tags/v2.2.0.zip
```
## Installing Python in Ubuntu
For reasons that are not entirely clear, installing the correct
version of Python can be a bit of a challenge on Ubuntu, Linux Mint, and
other Ubuntu-derived distributions.
For reasons that are not entirely clear, installing the correct version of
Python can be a bit of a challenge on Ubuntu, Linux Mint, and other
Ubuntu-derived distributions.
In particular, Ubuntu version 20.04 LTS comes with an old version of
Python, does not come with the PIP package manager installed, and to
make matters worse, the `python` command points to Python2, not
Python3.
In particular, Ubuntu version 20.04 LTS comes with an old version of Python,
does not come with the PIP package manager installed, and to make matters worse,
the `python` command points to Python2, not Python3.
Here is the quick recipe for bringing your system up to date:
@@ -305,6 +311,5 @@ sudo ln -sf python3.9 python3
sudo ln -sf python3 python
```
You can still access older versions of Python by calling `python2`,
`python3.8`, etc.
You can still access older versions of Python by calling `python2`, `python3.8`,
etc.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -8,8 +8,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>InvokeAI - A Stable Diffusion Toolkit</title>
<link rel="shortcut icon" type="icon" href="./assets/favicon.0d253ced.ico" />
<script type="module" crossorigin src="./assets/index.6f857312.js"></script>
<link rel="stylesheet" href="./assets/index.c609c0c8.css">
<script type="module" crossorigin src="./assets/index.d864890e.js"></script>
<link rel="stylesheet" href="./assets/index.81f1c71c.css">
<script type="module">try{import.meta.url;import("_").catch(()=>1);}catch(e){}window.__vite_is_modern_browser=true;</script>
<script type="module">!function(){if(window.__vite_is_modern_browser)return;console.warn("vite: loading legacy build because dynamic import or import.meta.url is unsupported, syntax error above should be ignored");var e=document.getElementById("vite-legacy-polyfill"),n=document.createElement("script");n.src=e.src,n.onload=function(){System.import(document.getElementById('vite-legacy-entry').getAttribute('data-src'))},document.body.appendChild(n)}();</script>
</head>
@@ -19,7 +19,7 @@
<script nomodule>!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",(function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()}),!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script>
<script nomodule crossorigin id="vite-legacy-polyfill" src="./assets/polyfills-legacy-dde3a68a.js"></script>
<script nomodule crossorigin id="vite-legacy-entry" data-src="./assets/index-legacy-4f120d5f.js">System.import(document.getElementById('vite-legacy-entry').getAttribute('data-src'))</script>
<script nomodule crossorigin id="vite-legacy-entry" data-src="./assets/index-legacy-8e84772c.js">System.import(document.getElementById('vite-legacy-entry').getAttribute('data-src'))</script>
</body>
</html>

View File

@@ -14,8 +14,8 @@ if "%1" == "use-cache" (
@rem Config
@rem this should be changed to the tagged release!
@rem set INVOKE_AI_SRC=https://github.com/invoke-ai/InvokeAI/archive/main.zip
set INVOKE_AI_SRC=https://github.com/invoke-ai/InvokeAI/archive/refs/tags/2.2.4-rc1.zip
set INVOKE_AI_SRC=https://github.com/invoke-ai/InvokeAI/archive/main.zip
@rem set INVOKE_AI_SRC=https://github.com/invoke-ai/InvokeAI/archive/refs/tags/v2.2.4.zip
set INSTRUCTIONS=https://invoke-ai.github.io/InvokeAI/installation/INSTALL_AUTOMATED/
set TROUBLESHOOTING=https://invoke-ai.github.io/InvokeAI/installation/INSTALL_AUTOMATED/#troubleshooting
set PYTHON_URL=https://www.python.org/downloads/windows/

View File

@@ -9,7 +9,8 @@ cd "$scriptdir"
deactivate >/dev/null 2>&1
# this should be changed to the tagged release!
INVOKE_AI_SRC=https://github.com/invoke-ai/InvokeAI/archive/refs/tags/2.2.4-rc1.zip
INVOKE_AI_SRC=https://github.com/invoke-ai/InvokeAI/archive/main.zip
# INVOKE_AI_SRC=https://github.com/invoke-ai/InvokeAI/archive/refs/tags/v2.2.4.zip
INSTRUCTIONS=https://invoke-ai.github.io/InvokeAI/installation/INSTALL_AUTOMATED/
TROUBLESHOOTING=https://invoke-ai.github.io/InvokeAI/installation/INSTALL_AUTOMATED/#troubleshooting
MINIMUM_PYTHON_VERSION=3.9.0

View File

@@ -453,6 +453,11 @@ class Generate:
init_image = None
mask_image = None
if self.free_gpu_mem and self.model.cond_stage_model.device != self.model.device:
self.model.cond_stage_model.device = self.model.device
self.model.cond_stage_model.to(self.model.device)
try:
uc, c, extra_conditioning_info = get_uc_and_c_and_ec(
prompt, model =self.model,

View File

@@ -174,7 +174,7 @@ class Args(object):
sysargs = sys.argv[1:]
# pre-parse to get the root directory; ignore the rest
switches = self._arg_parser.parse_args(sysargs)
Globals.root = switches.root_dir or Globals.root
Globals.root = os.path.abspath(switches.root_dir or Globals.root)
# now use root directory to find the init file
initfile = os.path.expanduser(os.path.join(Globals.root,Globals.initfile))

View File

@@ -6,6 +6,7 @@ import torch
import numpy as np
from ldm.invoke.generator.base import Generator
from ldm.models.diffusion.shared_invokeai_diffusion import InvokeAIDiffuserComponent
import gc
class Txt2Img(Generator):
@@ -55,7 +56,11 @@ class Txt2Img(Generator):
)
if self.free_gpu_mem:
self.model.model.to("cpu")
self.model.model.to('cpu')
self.model.cond_stage_model.device = 'cpu'
self.model.cond_stage_model.to('cpu')
gc.collect()
torch.cuda.empty_cache()
return self.sample_to_image(samples)

View File

@@ -100,7 +100,11 @@ class Txt2Img2Img(Generator):
)
if self.free_gpu_mem:
self.model.model.to("cpu")
self.model.model.to('cpu')
self.model.cond_stage_model.device = 'cpu'
self.model.cond_stage_model.to('cpu')
gc.collect()
torch.cuda.empty_cache()
return self.sample_to_image(samples)
@@ -142,7 +146,7 @@ class Txt2Img2Img(Generator):
**kwargs
)
return result[0][0]
if sampler.uses_inpainting_model():
return inpaint_make_image
else:

View File

@@ -16,7 +16,7 @@ from argparse import Namespace
Globals = Namespace()
# This is usually overwritten by the command line and/or environment variables
Globals.root = os.environ.get('INVOKEAI_ROOT') or os.path.expanduser('~/invokeai')
Globals.root = os.path.abspath(os.environ.get('INVOKEAI_ROOT') or os.path.expanduser('~/invokeai'))
# Where to look for the initialization file
Globals.initfile = 'invokeai.init'

View File

@@ -57,8 +57,13 @@ def retrieve_metadata(img_path):
metadata stored there, as a dict
'''
im = Image.open(img_path)
md = im.text.get('sd-metadata', '{}')
dream_prompt = im.text.get('Dream', '')
if hasattr(im, 'text'):
md = im.text.get('sd-metadata', '{}')
dream_prompt = im.text.get('Dream', '')
else:
# When trying to retrieve metadata from images without a 'text' payload, such as JPG images.
md = '{}'
dream_prompt = ''
return {'sd-metadata': json.loads(md), 'Dream': dream_prompt}
def write_metadata(img_path:str, meta:dict):

View File

@@ -208,9 +208,12 @@ class KSampler(Sampler):
model_wrap_cfg = CFGDenoiser(self.model, threshold=threshold, warmup=max(0.8*S,S-10))
model_wrap_cfg.prepare_to_sample(S, extra_conditioning_info=extra_conditioning_info)
attention_map_token_ids = range(1, extra_conditioning_info.tokens_count_including_eos_bos - 1)
attention_maps_saver = None if attention_maps_callback is None else AttentionMapSaver(token_ids = attention_map_token_ids, latents_shape=x.shape[-2:])
if attention_maps_callback is not None:
# setup attention maps saving. checks for None are because there are multiple code paths to get here.
attention_maps_saver = None
if attention_maps_callback is not None and extra_conditioning_info is not None:
eos_token_index = extra_conditioning_info.tokens_count_including_eos_bos - 1
attention_map_token_ids = range(1, eos_token_index)
attention_maps_saver = AttentionMapSaver(token_ids = attention_map_token_ids, latents_shape=x.shape[-2:])
model_wrap_cfg.invokeai_diffuser.setup_attention_map_saving(attention_maps_saver)
extra_args = {
@@ -226,7 +229,7 @@ class KSampler(Sampler):
),
None,
)
if attention_maps_callback is not None:
if attention_maps_saver is not None:
attention_maps_callback(attention_maps_saver)
return sampling_result

25
scripts/configure_invokeai.py Executable file → Normal file
View File

@@ -624,35 +624,14 @@ def initialize_rootdir(root:str,yes_to_all:bool=False):
print(f'You may also change the runtime directory by setting the environment variable INVOKEAI_ROOT.\n')
enable_safety_checker = True
default_sampler = 'k_heun'
default_steps = '20' # deliberately a string - see test below
sampler_choices =['ddim','k_dpm_2_a','k_dpm_2','k_euler_a','k_euler','k_heun','k_lms','plms']
if not yes_to_all:
print('The NSFW (not safe for work) checker blurs out images that potentially contain sexual imagery.')
print('It can be selectively enabled at run time with --nsfw_checker, and disabled with --no-nsfw_checker.')
print('The following option will set whether the checker is enabled by default. Like other options, you can')
print(f'change this setting later by editing the file {Globals.initfile}.')
print(f'The NSFW checker is a memory hog. If you have less than 6 GB of VRAM answer NO to this option.')
print(f"This is NOT recommended for systems with less than 6G VRAM because of the checker's memory requirements.")
enable_safety_checker = yes_or_no('Enable the NSFW checker by default?',enable_safety_checker)
print('\nThe next choice selects the sampler to use by default. Samplers have different speed/performance')
print('tradeoffs. If you are not sure what to select, accept the default.')
sampler = None
while sampler not in sampler_choices:
sampler = input(f'Default sampler to use? ({", ".join(sampler_choices)}) [{default_sampler}]:') or default_sampler
print('\nThe number of denoising steps affects both the speed and quality of the images generated.')
print('Higher steps often (but not always) increases the quality of the image, but increases image')
print('generation time. This can be changed at run time. Accept the default if you are unsure.')
steps = ''
while not steps.isnumeric():
steps = input(f'Default number of steps to use during generation? [{default_steps}]:') or default_steps
else:
sampler = default_sampler
steps = default_steps
safety_checker = '--nsfw_checker' if enable_safety_checker else '--no-nsfw_checker'
for name in ('models','configs','embeddings'):
@@ -677,8 +656,6 @@ def initialize_rootdir(root:str,yes_to_all:bool=False):
# generation arguments
{safety_checker}
--sampler={sampler}
--steps={steps}
# You may place other frequently-used startup commands here, one or more per line.
# Examples: