fix(config): use get_config singleton, new paths

This commit is contained in:
psychedelicious 2024-03-11 23:17:26 +11:00
parent b8c46fb15b
commit deffeb9655
4 changed files with 8 additions and 10 deletions

View File

@ -25,10 +25,10 @@ from prompt_toolkit.completion import PathCompleter
from prompt_toolkit.key_binding import KeyBindings
from prompt_toolkit.shortcuts import message_dialog
from invokeai.app.services.config import InvokeAIAppConfig
from invokeai.app.services.config.config_default import get_config
from invokeai.app.util.misc import uuid_string
app_config = InvokeAIAppConfig.get_config()
app_config = get_config()
bindings = KeyBindings()

View File

@ -513,7 +513,6 @@ def list_models(installer: ModelInstallServiceBase, model_type: ModelType):
def select_and_download_models(opt: Namespace) -> None:
"""Prompt user for install/delete selections and execute."""
precision = "float32" if opt.full_precision else choose_precision(torch.device(choose_torch_device()))
# unsure how to avoid a typing complaint in the next line: config.precision is an enumerated Literal
config.precision = precision
install_helper = InstallHelper(config, logger)
installer = install_helper.installer

View File

@ -16,7 +16,7 @@ from typing import List, Optional, Tuple
import npyscreen
from npyscreen import widget
from invokeai.app.services.config import InvokeAIAppConfig
from invokeai.app.services.config.config_default import get_config
from invokeai.app.services.download import DownloadQueueService
from invokeai.app.services.image_files.image_files_disk import DiskImageFileStorage
from invokeai.app.services.model_install import ModelInstallService
@ -32,7 +32,7 @@ from invokeai.backend.model_manager.merge import ModelMerger
from invokeai.backend.util.logging import InvokeAILogger
from invokeai.frontend.install.widgets import FloatTitleSlider, SingleSelectColumns, TextBox
config = InvokeAIAppConfig.get_config()
config = get_config()
logger = InvokeAILogger.get_logger()
BASE_TYPES = [
@ -47,7 +47,7 @@ def _parse_args() -> Namespace:
parser.add_argument(
"--root_dir",
type=Path,
default=config.root,
default=config.root_path,
help="Path to the invokeai runtime directory",
)
parser.add_argument(
@ -408,7 +408,7 @@ def run_cli(args: Namespace):
def get_config_store() -> ModelRecordServiceSQL:
output_path = config.output_path
output_path = config.outputs_path
assert output_path is not None
image_files = DiskImageFileStorage(output_path / "images")
db = init_db(config=config, logger=InvokeAILogger.get_logger(), image_files=image_files)

View File

@ -20,7 +20,7 @@ from npyscreen import widget
from omegaconf import OmegaConf
import invokeai.backend.util.logging as logger
from invokeai.app.services.config import InvokeAIAppConfig
from invokeai.app.services.config.config_default import get_config
from invokeai.backend.install.install_helper import initialize_installer
from invokeai.backend.model_manager import ModelType
from invokeai.backend.training import do_textual_inversion_training, parse_args
@ -422,8 +422,7 @@ def main() -> None:
global config
args: Namespace = parse_args()
config = InvokeAIAppConfig.get_config()
config.parse_args([])
config = get_config()
# change root if needed
if args.root_dir: