-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Add configuration system, remove legacy globals, args, generate and CLI #3340
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
Conversation
ebr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- invokeai-configure updated to work with new config system - migrate invokeai.init to invokeai.yaml during configure - replace legacy invokeai with invokeai-node-cli - add ability to run an invocation directly from invokeai-node-cli command line - update CI tests to work with new invokeai syntax
|
@ebr It turned out that having different config objects for the client and web apps wasn't doing what I wanted. In fact However, I ended up generalizing the configuration categories, so they are nicely categorized now. The config file looks like this: And the command-line help menu looks like this: Both the config file and the help text are driven off the pydantic class definition. |
…vokeAI into lstein/global-configuration
- remove non-existent import InvokeAIWebConfig - fix workflow file formatting - clean up whitespace
…h the actual category
|
I pushed some commits containing web-related enhancements/cleanup, and one critical fix for a missing import. All of the below works beautifully:
There are also some issues that in my opinion do NOT need to block this PR, but we can fix them in a followup to 3.0
Note that for the Web UI to be served correctly with And to reset it back to current state (for a clean |
ebr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved, but please see above comment. I can open new issues for the minor concerns raised, or we can discuss in Discord how to handle any of those.
Overall, AMAZING work from all angles (structured config file, typed configuration, all the things!!) 👏 . And I love how much cleaner and succinct the configuration has become, removing so much legacy code. We wanted to retire Globals all the way last November 😄 - thank you for this!
Thanks so much for the review! I will make the following changes:
I've got a problem with the CI tests. I want to feed commands to |
damian0815
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me
- Make environment variable settings case InSenSiTive: INVOKEAI_MAX_LOADED_MODELS and InvokeAI_Max_Loaded_Models environment variables will both set `max_loaded_models` - Updated realesrgan to use new config system. - Updated textual_inversion_training to use new config system. - Discovered a race condition when InvokeAIAppConfig is created at module load time, which makes it impossible to customize or replace the help message produced with --help on the command line. To fix this, moved all instances of get_invokeai_config() from module load time to object initialization time. Makes code cleaner, too. - Added `--from_file` argument to `invokeai-node-cli` and changed github action to match. CI tests will hopefully work now.
Application-wide configuration service
This PR creates a new
InvokeAIAppConfigobject that reads application-wide settings from an init file, the environment, and the command line.Arguments and fields are taken from the pydantic definition of the model. Defaults can be set by creating a yaml configuration file that has a top-level key of "InvokeAI" and subheadings for each of the categories returned by
invokeai --help.The file looks like this:
[file: invokeai.yaml]
The default name of the configuration file is
invokeai.yaml, located in INVOKEAI_ROOT. You can use any OmegaConf dictionary by passing it to the config object at initialization time:The default name of the configuration file is
invokeai.yaml, located in INVOKEAI_ROOT. You can replace supersede this by providing anyOmegaConf dictionary object initialization time:By default, InvokeAIAppConfig will parse the contents of
sys.argvat initialization time. You may pass a list of strings in the optionalargvargument to use instead of the system argv:It is also possible to set a value at initialization time. This value has highest priority.
Any setting can be overwritten by setting an environment variable of form: "INVOKEAI_", as in:
Order of precedence (from highest):
Typical usage:
Finally, the configuration object is able to recreate its (modified) yaml file, by calling its
to_yaml()method:Legacy code removal and porting
This PR replaces Globals with the InvokeAIAppConfig system throughout, and therefore removes the
globals.pyandargs.pymodules. It also removesgenerateand the legacy CLI. The old CLI and web servers are now gone.I have ported the functionality of the configuration script, the model installer, and the merge and textual inversion scripts. The
invokeaicommand will now launchinvokeai-node-cli, andinvokeai-webwill launch the web server.I have changed the continuous invocation tests to accommodate the new command syntax in
invokeai-node-cli. As a convenience function, you can also pass invocations toinvokeai-node-cli(or its aliasinvokeai) on the command line as as standard input: