slight refactoring of code; configure --yes should work now

This commit is contained in:
Lincoln Stein
2023-06-02 23:19:14 -04:00
parent 72d1e4e404
commit 77b7680b32
3 changed files with 24 additions and 31 deletions

View File

@ -49,6 +49,7 @@ from invokeai.backend.install.model_install_backend import (
download_from_hf,
hf_download_with_resume,
recommended_datasets,
UserSelections,
)
from invokeai.app.services.config import (
get_invokeai_config,
@ -636,9 +637,9 @@ def default_startup_options(init_file: Path) -> Namespace:
opts.nsfw_checker = True
return opts
def default_user_selections(program_opts: Namespace) -> Namespace:
return Namespace(
starter_models=default_dataset()
def default_user_selections(program_opts: Namespace) -> UserSelections:
return UserSelections(
install_models=default_dataset()
if program_opts.default_only
else recommended_datasets()
if program_opts.yes_to_all
@ -646,8 +647,6 @@ def default_user_selections(program_opts: Namespace) -> Namespace:
purge_deleted_models=False,
scan_directory=None,
autoscan_on_startup=None,
import_model_paths=None,
convert_to_diffusers=None,
)

View File

@ -12,6 +12,7 @@ from tempfile import TemporaryFile
from typing import List, Dict
import requests
from dataclasses import dataclass,field
from diffusers import AutoencoderKL
from huggingface_hub import hf_hub_url, HfFolder
from omegaconf import OmegaConf
@ -56,6 +57,21 @@ class ModelInstallList:
install_models: List[str]
remove_models: List[str]
@dataclass
class UserSelections():
install_models: List[str]= field(default_factory=list)
remove_models: List[str]=field(default_factory=list)
purge_deleted_models: bool=field(default_factory=list)
install_cn_models: List[str] = field(default_factory=list)
remove_cn_models: List[str] = field(default_factory=list)
install_lora_models: List[str] = field(default_factory=list)
remove_lora_models: List[str] = field(default_factory=list)
install_ti_models: List[str] = field(default_factory=list)
remove_ti_models: List[str] = field(default_factory=list)
scan_directory: Path = None
autoscan_on_startup: bool=False
import_model_paths: str=None
def default_config_file():
return config.model_conf_path