Skip to content
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

Installer tweaks #4070

Merged
merged 5 commits into from
Jul 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions installer/lib/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def app_venv(self, path: str = None):
return venv_dir

def install(
self, root: str = "~/invokeai-3", version: str = "latest", yes_to_all=False, find_links: Path = None
self, root: str = "~/invokeai", version: str = "latest", yes_to_all=False, find_links: Path = None
) -> None:
"""
Install the InvokeAI application into the given runtime path
Expand All @@ -168,7 +168,8 @@ def install(

messages.welcome()

self.dest = Path(root).expanduser().resolve() if yes_to_all else messages.dest_path(root)
default_path = os.environ.get("INVOKEAI_ROOT") or Path(root).expanduser().resolve()
self.dest = default_path if yes_to_all else messages.dest_path(root)

# create the venv for the app
self.venv = self.app_venv()
Expand Down
3 changes: 2 additions & 1 deletion installer/lib/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""

import argparse
import os
from pathlib import Path
from installer import Installer

Expand All @@ -15,7 +16,7 @@
dest="root",
type=str,
help="Destination path for installation",
default="~/invokeai",
default=os.environ.get("INVOKEAI_ROOT") or "~/invokeai",
)
parser.add_argument(
"-y",
Expand Down
2 changes: 1 addition & 1 deletion invokeai/frontend/install/invokeai_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def main():

extras = get_extras()

print(f":crossed_fingers: Upgrading to [yellow]{tag if tag else release}[/yellow]")
print(f":crossed_fingers: Upgrading to [yellow]{tag or release or branch}[/yellow]")
if release:
cmd = f'pip install "invokeai{extras} @ {INVOKE_AI_SRC}/{release}.zip" --use-pep517 --upgrade'
elif tag:
Expand Down
22 changes: 20 additions & 2 deletions invokeai/frontend/install/model_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@
# from https://stackoverflow.com/questions/92438/stripping-non-printable-characters-from-a-string-in-python
NOPRINT_TRANS_TABLE = {i: None for i in range(0, sys.maxunicode + 1) if not chr(i).isprintable()}

# maximum number of installed models we can display before overflowing vertically
MAX_OTHER_MODELS = 72


def make_printable(s: str) -> str:
"""Replace non-printable characters in a string"""
Expand Down Expand Up @@ -102,7 +105,7 @@ def create(self):
SingleSelectColumns,
values=[
"STARTER MODELS",
"MORE MODELS",
"MAIN MODELS",
"CONTROLNETS",
"LORA/LYCORIS",
"TEXTUAL INVERSION",
Expand Down Expand Up @@ -271,6 +274,11 @@ def add_model_widgets(
)
)

truncation = False
if len(model_labels) > MAX_OTHER_MODELS:
model_labels = model_labels[0:MAX_OTHER_MODELS]
truncation = True

widgets.update(
models_selected=self.add_widget_intelligent(
MultiSelectColumns,
Expand All @@ -289,6 +297,16 @@ def add_model_widgets(
models=model_list,
)

if truncation:
widgets.update(
warning_message=self.add_widget_intelligent(
npyscreen.FixedText,
value=f"Too many models to display (max={MAX_OTHER_MODELS}). Some are not displayed.",
editable=False,
color="CAUTION",
)
)

self.nextrely += 1
widgets.update(
download_ids=self.add_widget_intelligent(
Expand All @@ -313,7 +331,7 @@ def add_pipeline_widgets(
widgets = self.add_model_widgets(
model_type=model_type,
window_width=window_width,
install_prompt=f"Additional {model_type.value.title()} models already installed.",
install_prompt=f"Installed {model_type.value.title()} models. Unchecked models in the InvokeAI root directory will be deleted. Enter URLs, paths or repo_ids to import.",
**kwargs,
)

Expand Down
Loading