mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
collapse all autoimport directories into a single folder
This commit is contained in:
parent
cb29ac63a8
commit
89a15f78dd
@ -380,10 +380,10 @@ setting environment variables INVOKEAI_<setting>.
|
|||||||
tiled_decode : bool = Field(default=False, description="Whether to enable tiled VAE decode (reduces memory consumption with some performance penalty)", category='Memory/Performance')
|
tiled_decode : bool = Field(default=False, description="Whether to enable tiled VAE decode (reduces memory consumption with some performance penalty)", category='Memory/Performance')
|
||||||
|
|
||||||
root : Path = Field(default=_find_root(), description='InvokeAI runtime root directory', category='Paths')
|
root : Path = Field(default=_find_root(), description='InvokeAI runtime root directory', category='Paths')
|
||||||
autoimport_dir : Path = Field(default='autoimport/main', description='Path to a directory of models files to be imported on startup.', category='Paths')
|
autoimport_dir : Path = Field(default='autoimport', description='Path to a directory of models files to be imported on startup.', category='Paths')
|
||||||
lora_dir : Path = Field(default='autoimport/lora', description='Path to a directory of LoRA/LyCORIS models to be imported on startup.', category='Paths')
|
lora_dir : Path = Field(default=None, description='Path to a directory of LoRA/LyCORIS models to be imported on startup.', category='Paths')
|
||||||
embedding_dir : Path = Field(default='autoimport/embedding', description='Path to a directory of Textual Inversion embeddings to be imported on startup.', category='Paths')
|
embedding_dir : Path = Field(default=None, description='Path to a directory of Textual Inversion embeddings to be imported on startup.', category='Paths')
|
||||||
controlnet_dir : Path = Field(default='autoimport/controlnet', description='Path to a directory of ControlNet embeddings to be imported on startup.', category='Paths')
|
controlnet_dir : Path = Field(default=None, description='Path to a directory of ControlNet embeddings to be imported on startup.', category='Paths')
|
||||||
conf_path : Path = Field(default='configs/models.yaml', description='Path to models definition file', category='Paths')
|
conf_path : Path = Field(default='configs/models.yaml', description='Path to models definition file', category='Paths')
|
||||||
models_dir : Path = Field(default='models', description='Path to the models directory', category='Paths')
|
models_dir : Path = Field(default='models', description='Path to the models directory', category='Paths')
|
||||||
legacy_conf_dir : Path = Field(default='configs/stable-diffusion', description='Path to directory of legacy checkpoint config files', category='Paths')
|
legacy_conf_dir : Path = Field(default='configs/stable-diffusion', description='Path to directory of legacy checkpoint config files', category='Paths')
|
||||||
|
@ -44,6 +44,7 @@ from invokeai.backend.util.logging import InvokeAILogger
|
|||||||
from invokeai.frontend.install.model_install import addModelsForm, process_and_execute
|
from invokeai.frontend.install.model_install import addModelsForm, process_and_execute
|
||||||
from invokeai.frontend.install.widgets import (
|
from invokeai.frontend.install.widgets import (
|
||||||
CenteredButtonPress,
|
CenteredButtonPress,
|
||||||
|
FileBox,
|
||||||
IntTitleSlider,
|
IntTitleSlider,
|
||||||
set_min_terminal_size,
|
set_min_terminal_size,
|
||||||
CyclingForm,
|
CyclingForm,
|
||||||
@ -409,21 +410,21 @@ Use cursor arrows to make a checkbox selection, and space to toggle.
|
|||||||
self.nextrely += 1
|
self.nextrely += 1
|
||||||
self.add_widget_intelligent(
|
self.add_widget_intelligent(
|
||||||
npyscreen.FixedText,
|
npyscreen.FixedText,
|
||||||
value="Directories containing textual inversion, controlnet and LoRA models (<tab> autocompletes, ctrl-N advances):",
|
value="Folder to recursively scan for new checkpoints, ControlNets, LoRAs and TI models (<tab> autocompletes, ctrl-N advances):",
|
||||||
editable=False,
|
editable=False,
|
||||||
color="CONTROL",
|
color="CONTROL",
|
||||||
)
|
)
|
||||||
self.autoimport_dirs = {}
|
self.autoimport_dirs = {}
|
||||||
for description, config_name, path in autoimport_paths(old_opts):
|
self.autoimport_dirs['autoimport_dir'] = self.add_widget_intelligent(
|
||||||
self.autoimport_dirs[config_name] = self.add_widget_intelligent(
|
FileBox,
|
||||||
npyscreen.TitleFilename,
|
name=f'Autoimport Folder',
|
||||||
name=description+':',
|
value=str(config.root_path / config.autoimport_dir),
|
||||||
value=str(path),
|
|
||||||
select_dir=True,
|
select_dir=True,
|
||||||
must_exist=False,
|
must_exist=False,
|
||||||
use_two_lines=False,
|
use_two_lines=False,
|
||||||
labelColor="GOOD",
|
labelColor="GOOD",
|
||||||
begin_entry_at=32,
|
begin_entry_at=32,
|
||||||
|
max_height = 3,
|
||||||
scroll_exit=True
|
scroll_exit=True
|
||||||
)
|
)
|
||||||
self.nextrely += 1
|
self.nextrely += 1
|
||||||
@ -575,19 +576,8 @@ def default_user_selections(program_opts: Namespace) -> InstallSelections:
|
|||||||
else [models[x].path or models[x].repo_id for x in installer.recommended_models()]
|
else [models[x].path or models[x].repo_id for x in installer.recommended_models()]
|
||||||
if program_opts.yes_to_all
|
if program_opts.yes_to_all
|
||||||
else list(),
|
else list(),
|
||||||
# scan_directory=None,
|
|
||||||
# autoscan_on_startup=None,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# -------------------------------------
|
|
||||||
def autoimport_paths(config: InvokeAIAppConfig):
|
|
||||||
return [
|
|
||||||
('Checkpoints & diffusers models', 'autoimport_dir', config.root_path / config.autoimport_dir),
|
|
||||||
('LoRA/LyCORIS models', 'lora_dir', config.root_path / config.lora_dir),
|
|
||||||
('Controlnet models', 'controlnet_dir', config.root_path / config.controlnet_dir),
|
|
||||||
('Textual Inversion Embeddings', 'embedding_dir', config.root_path / config.embedding_dir),
|
|
||||||
]
|
|
||||||
|
|
||||||
# -------------------------------------
|
# -------------------------------------
|
||||||
def initialize_rootdir(root: Path, yes_to_all: bool = False):
|
def initialize_rootdir(root: Path, yes_to_all: bool = False):
|
||||||
logger.info("** INITIALIZING INVOKEAI RUNTIME DIRECTORY **")
|
logger.info("** INITIALIZING INVOKEAI RUNTIME DIRECTORY **")
|
||||||
|
@ -956,8 +956,9 @@ class ModelManager(object):
|
|||||||
config.lora_dir,
|
config.lora_dir,
|
||||||
config.embedding_dir,
|
config.embedding_dir,
|
||||||
config.controlnet_dir,
|
config.controlnet_dir,
|
||||||
]
|
] if x
|
||||||
}
|
}
|
||||||
|
print(directories)
|
||||||
scanner = ScanAndImport(directories, self.logger, ignore=known_paths, installer=installer)
|
scanner = ScanAndImport(directories, self.logger, ignore=known_paths, installer=installer)
|
||||||
scanner.search()
|
scanner.search()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user