mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
docs: update CONFIGURATION.md
This commit is contained in:
parent
a281671e6c
commit
beffca6b49
@ -6,85 +6,63 @@ title: Configuration
|
|||||||
|
|
||||||
## Intro
|
## Intro
|
||||||
|
|
||||||
InvokeAI has numerous runtime settings which can be used to adjust
|
Runtime settings, including the location of files and
|
||||||
many aspects of its operations, including the location of files and
|
directories, memory usage, and performance, are managed via the
|
||||||
directories, memory usage, and performance. These settings can be
|
`invokeai.yaml` config file.
|
||||||
viewed and customized in several ways:
|
|
||||||
|
|
||||||
1. By editing settings in the `invokeai.yaml` file.
|
The most commonly changed settings are also accessible
|
||||||
2. By setting environment variables.
|
|
||||||
3. On the command-line, when InvokeAI is launched.
|
|
||||||
|
|
||||||
In addition, the most commonly changed settings are accessible
|
|
||||||
graphically via the `invokeai-configure` script.
|
graphically via the `invokeai-configure` script.
|
||||||
|
|
||||||
### How the Configuration System Works
|
### InvokeAI Root Directory
|
||||||
|
|
||||||
When InvokeAI is launched, the very first thing it needs to do is to
|
On startup, InvokeAI searches for its "root" directory. This is the directory
|
||||||
find its "root" directory, which contains its configuration files,
|
that contains models, images, the database, and so on. It also contains
|
||||||
installed models, its database of images, and the folder(s) of
|
a configuration file called `invokeai.yaml`.
|
||||||
generated images themselves. In this document, the root directory will
|
|
||||||
be referred to as ROOT.
|
|
||||||
|
|
||||||
#### Finding the Root Directory
|
InvokeAI searches for the root directory in this order:
|
||||||
|
|
||||||
To find its root directory, InvokeAI uses the following recipe:
|
1. The `--root <path>` CLI arg.
|
||||||
|
2. The environment variable INVOKEAI_ROOT.
|
||||||
|
3. The directory containing the currently active virtual environment.
|
||||||
|
4. Fallback: a directory in the current user's home directory named `invokeai`.
|
||||||
|
|
||||||
1. It first looks for the argument `--root <path>` on the command line
|
### InvokeAI Configuration File
|
||||||
it was launched from, and uses the indicated path if present.
|
|
||||||
|
|
||||||
2. Next it looks for the environment variable INVOKEAI_ROOT, and uses
|
Inside the root directory, we read settings from the `invokeai.yaml` file.
|
||||||
the directory path found there if present.
|
|
||||||
|
|
||||||
3. If neither of these are present, then InvokeAI looks for the
|
It has two sections - one for internal use and one for user settings:
|
||||||
folder containing the `.venv` Python virtual environment directory for
|
|
||||||
the currently active environment. This directory is checked for files
|
|
||||||
expected inside the InvokeAI root before it is used.
|
|
||||||
|
|
||||||
4. Finally, InvokeAI looks for a directory in the current user's home
|
```yaml
|
||||||
directory named `invokeai`.
|
# Internal metadata - do not edit:
|
||||||
|
meta:
|
||||||
|
schema_version: 4
|
||||||
|
|
||||||
#### Reading the InvokeAI Configuration File
|
# Put user settings here:
|
||||||
|
host: 0.0.0.0
|
||||||
Once the root directory has been located, InvokeAI looks for a file
|
models_dir: /external_drive/invokeai/models
|
||||||
named `ROOT/invokeai.yaml`, and if present reads configuration values
|
ram: 24
|
||||||
from it. The top of this file looks like this:
|
precision: float16
|
||||||
|
|
||||||
```
|
|
||||||
InvokeAI:
|
|
||||||
Web Server:
|
|
||||||
host: localhost
|
|
||||||
port: 9090
|
|
||||||
allow_origins: []
|
|
||||||
allow_credentials: true
|
|
||||||
allow_methods:
|
|
||||||
- '*'
|
|
||||||
allow_headers:
|
|
||||||
- '*'
|
|
||||||
Features:
|
|
||||||
esrgan: true
|
|
||||||
internet_available: true
|
|
||||||
log_tokenization: false
|
|
||||||
patchmatch: true
|
|
||||||
restore: true
|
|
||||||
...
|
|
||||||
```
|
```
|
||||||
|
|
||||||
This lines in this file are used to establish default values for
|
In this example, we've changed a few settings:
|
||||||
Invoke's settings. In the above fragment, the Web Server's listening
|
|
||||||
port is set to 9090 by the `port` setting.
|
|
||||||
|
|
||||||
You can edit this file with a text editor such as "Notepad" (do not
|
- `host: 0.0.0.0`: allow other machines on the network to connect
|
||||||
use Word or any other word processor). When editing, be careful to
|
- `models_dir: /external_drive/invokeai/models`: store model files here
|
||||||
maintain the indentation, and do not add extraneous text, as syntax
|
- `ram: 24`: set the model RAM cache to a max of 24GB
|
||||||
errors will prevent InvokeAI from launching. A basic guide to the
|
- `precision: float16`: use more efficient FP16 precision
|
||||||
format of YAML files can be found
|
|
||||||
[here](https://circleci.com/blog/what-is-yaml-a-beginner-s-guide/).
|
The settings in this file will override the defaults. You only need
|
||||||
|
to change this file if the default for a particular setting doesn't
|
||||||
|
work for you.
|
||||||
|
|
||||||
|
Some settings, like [Model Marketplace API Keys], require the YAML
|
||||||
|
to be formatted correctly. Here is a [basic guide to YAML files].
|
||||||
|
|
||||||
You can fix a broken `invokeai.yaml` by deleting it and running the
|
You can fix a broken `invokeai.yaml` by deleting it and running the
|
||||||
configuration script again -- option [6] in the launcher, "Re-run the
|
configuration script again -- option [6] in the launcher, "Re-run the
|
||||||
configure script".
|
configure script".
|
||||||
|
|
||||||
|
<!-- TODO(psyche): support env vars?
|
||||||
#### Reading Environment Variables
|
#### Reading Environment Variables
|
||||||
|
|
||||||
Next InvokeAI looks for defined environment variables in the format
|
Next InvokeAI looks for defined environment variables in the format
|
||||||
@ -102,66 +80,33 @@ Please check out these
|
|||||||
[Macintosh](https://phoenixnap.com/kb/set-environment-variable-mac)
|
[Macintosh](https://phoenixnap.com/kb/set-environment-variable-mac)
|
||||||
and
|
and
|
||||||
[Windows](https://phoenixnap.com/kb/windows-set-environment-variable)
|
[Windows](https://phoenixnap.com/kb/windows-set-environment-variable)
|
||||||
guides for setting temporary and permanent environment variables.
|
guides for setting temporary and permanent environment variables. -->
|
||||||
|
|
||||||
#### Reading the Command Line
|
### CLI Args
|
||||||
|
|
||||||
Lastly, InvokeAI takes settings from the command line, which override
|
A subset of settings may be specified using CLI args:
|
||||||
everything else. The command-line settings have the same name as the
|
|
||||||
corresponding configuration file settings, preceded by a `--`, for
|
|
||||||
example `--port 8000`.
|
|
||||||
|
|
||||||
If you are using the launcher (`invoke.sh` or `invoke.bat`) to launch
|
- `--root`: specify the root directory
|
||||||
InvokeAI, then just pass the command-line arguments to the launcher:
|
- `--ignore_missing_core-models`: if set, do not check for models needed
|
||||||
|
to convert checkpoint/safetensor models to diffusers
|
||||||
|
|
||||||
```
|
### All Settings
|
||||||
invoke.bat --port 8000 --host 0.0.0.0
|
|
||||||
```
|
|
||||||
|
|
||||||
The arguments will be applied when you select the web server option
|
The config is managed by the `InvokeAIAppConfig` class. The below docs are autogenerated from the class.
|
||||||
(and the other options as well).
|
|
||||||
|
|
||||||
If, on the other hand, you prefer to launch InvokeAI directly from the
|
|
||||||
command line, you would first activate the virtual environment (known
|
|
||||||
as the "developer's console" in the launcher), and run `invokeai-web`:
|
|
||||||
|
|
||||||
```
|
|
||||||
> C:\Users\Fred\invokeai\.venv\scripts\activate
|
|
||||||
(.venv) > invokeai-web --port 8000 --host 0.0.0.0
|
|
||||||
```
|
|
||||||
|
|
||||||
You can get a listing and brief instructions for each of the
|
|
||||||
command-line options by giving the `--help` argument:
|
|
||||||
|
|
||||||
```
|
|
||||||
(.venv) > invokeai-web --help
|
|
||||||
usage: InvokeAI [-h] [--host HOST] [--port PORT] [--allow_origins [ALLOW_ORIGINS ...]] [--allow_credentials | --no-allow_credentials] [--allow_methods [ALLOW_METHODS ...]]
|
|
||||||
[--allow_headers [ALLOW_HEADERS ...]] [--esrgan | --no-esrgan] [--internet_available | --no-internet_available] [--log_tokenization | --no-log_tokenization]
|
|
||||||
[--patchmatch | --no-patchmatch] [--restore | --no-restore]
|
|
||||||
[--always_use_cpu | --no-always_use_cpu] [--free_gpu_mem | --no-free_gpu_mem] [--max_loaded_models MAX_LOADED_MODELS] [--max_cache_size MAX_CACHE_SIZE]
|
|
||||||
[--max_vram_cache_size MAX_VRAM_CACHE_SIZE] [--gpu_mem_reserved GPU_MEM_RESERVED] [--precision {auto,float16,float32,autocast}]
|
|
||||||
[--sequential_guidance | --no-sequential_guidance] [--xformers_enabled | --no-xformers_enabled] [--tiled_decode | --no-tiled_decode] [--root ROOT]
|
|
||||||
[--autoimport_dir AUTOIMPORT_DIR] [--lora_dir LORA_DIR] [--embedding_dir EMBEDDING_DIR] [--controlnet_dir CONTROLNET_DIR] [--conf_path CONF_PATH]
|
|
||||||
[--models_dir MODELS_DIR] [--legacy_conf_dir LEGACY_CONF_DIR] [--db_dir DB_DIR] [--outdir OUTDIR] [--from_file FROM_FILE]
|
|
||||||
[--use_memory_db | --no-use_memory_db] [--model MODEL] [--log_handlers [LOG_HANDLERS ...]] [--log_format {plain,color,syslog,legacy}]
|
|
||||||
[--log_level {debug,info,warning,error,critical}] [--version | --no-version]
|
|
||||||
```
|
|
||||||
|
|
||||||
## The Configuration Settings
|
|
||||||
|
|
||||||
The config is managed by the `InvokeAIAppConfig` class, which is a pydantic model. The below docs are autogenerated from the class.
|
|
||||||
|
|
||||||
When editing your `invokeai.yaml` file, you'll need to put settings under their appropriate group. The group for each setting is denoted in the table below.
|
|
||||||
|
|
||||||
Following the table are additional explanations for certain settings.
|
Following the table are additional explanations for certain settings.
|
||||||
|
|
||||||
<!-- prettier-ignore-start -->
|
<!-- prettier-ignore-start -->
|
||||||
::: invokeai.app.services.config.config_default.InvokeAIAppConfig
|
::: invokeai.app.services.config.config_default.InvokeAIAppConfig
|
||||||
options:
|
options:
|
||||||
heading_level: 3
|
heading_level: 4
|
||||||
|
members: false
|
||||||
|
show_docstring_description: false
|
||||||
|
group_by_category: true
|
||||||
|
show_category_heading: false
|
||||||
<!-- prettier-ignore-end -->
|
<!-- prettier-ignore-end -->
|
||||||
|
|
||||||
### Model Marketplace API Keys
|
#### Model Marketplace API Keys
|
||||||
|
|
||||||
Some model marketplaces require an API key to download models. You can provide a URL pattern and appropriate token in your `invokeai.yaml` file to provide that API key.
|
Some model marketplaces require an API key to download models. You can provide a URL pattern and appropriate token in your `invokeai.yaml` file to provide that API key.
|
||||||
|
|
||||||
@ -181,7 +126,7 @@ InvokeAI:
|
|||||||
|
|
||||||
The provided token will be added as a `Bearer` token to the network requests to download the model files. As far as we know, this works for all model marketplaces that require authorization.
|
The provided token will be added as a `Bearer` token to the network requests to download the model files. As far as we know, this works for all model marketplaces that require authorization.
|
||||||
|
|
||||||
### Model Hashing
|
#### Model Hashing
|
||||||
|
|
||||||
Models are hashed during installation, providing a stable identifier for models across all platforms. The default algorithm is `blake3`, with a multi-threaded implementation.
|
Models are hashed during installation, providing a stable identifier for models across all platforms. The default algorithm is `blake3`, with a multi-threaded implementation.
|
||||||
|
|
||||||
@ -203,7 +148,7 @@ InvokeAI:
|
|||||||
|
|
||||||
Most common algorithms are supported, like `md5`, `sha256`, and `sha512`. These are typically much, much slower than `blake3`.
|
Most common algorithms are supported, like `md5`, `sha256`, and `sha512`. These are typically much, much slower than `blake3`.
|
||||||
|
|
||||||
### Paths
|
#### Paths
|
||||||
|
|
||||||
These options set the paths of various directories and files used by
|
These options set the paths of various directories and files used by
|
||||||
InvokeAI. Relative paths are interpreted relative to the root directory, so
|
InvokeAI. Relative paths are interpreted relative to the root directory, so
|
||||||
@ -215,7 +160,7 @@ Note that the autoimport directory will be searched recursively,
|
|||||||
allowing you to organize the models into folders and subfolders in any
|
allowing you to organize the models into folders and subfolders in any
|
||||||
way you wish.
|
way you wish.
|
||||||
|
|
||||||
### Logging
|
#### Logging
|
||||||
|
|
||||||
Several different log handler destinations are available, and multiple destinations are supported by providing a list:
|
Several different log handler destinations are available, and multiple destinations are supported by providing a list:
|
||||||
|
|
||||||
@ -257,3 +202,6 @@ The `log_format` option provides several alternative formats:
|
|||||||
- `plain` - same as above, but monochrome text only
|
- `plain` - same as above, but monochrome text only
|
||||||
- `syslog` - the log level and error message only, allowing the syslog system to attach the time and date
|
- `syslog` - the log level and error message only, allowing the syslog system to attach the time and date
|
||||||
- `legacy` - a format similar to the one used by the legacy 2.3 InvokeAI releases.
|
- `legacy` - a format similar to the one used by the legacy 2.3 InvokeAI releases.
|
||||||
|
|
||||||
|
[basic guide to yaml files]: https://circleci.com/blog/what-is-yaml-a-beginner-s-guide/
|
||||||
|
[Model Marketplace API Keys]: #model-marketplace-api-keys
|
||||||
|
Loading…
x
Reference in New Issue
Block a user