use heuristic to select RAM cache size during headless install; blackified

This commit is contained in:
Lincoln Stein
2023-09-25 19:18:58 -04:00
committed by Kent Keirsey
parent 0c97a1e7e7
commit d59e534cad
10 changed files with 39 additions and 40 deletions

View File

@ -344,12 +344,12 @@ class InvokeAiInstance:
auto_install = True
sys.argv = new_argv
import requests # to catch download exceptions
import messages
import requests # to catch download exceptions
auto_install = auto_install or messages.user_wants_auto_configuration()
if auto_install:
sys.argv.append('--yes')
sys.argv.append("--yes")
else:
messages.introduction()

View File

@ -7,7 +7,7 @@ import os
import platform
from pathlib import Path
from prompt_toolkit import prompt, HTML
from prompt_toolkit import HTML, prompt
from prompt_toolkit.completion import PathCompleter
from prompt_toolkit.validation import Validator
from rich import box, print
@ -97,13 +97,17 @@ def user_wants_auto_configuration() -> bool:
padding=(1, 1),
)
)
choice = prompt(HTML("Choose <b>&lt;a&gt;</b>utomatic or <b>&lt;m&gt;</b>anual configuration [a/m] (a): "),
validator=Validator.from_callable(
lambda n: n=='' or n.startswith(('a', 'A', 'm', 'M')),
error_message="Please select 'a' or 'm'"
),
) or 'a'
return choice.lower().startswith('a')
choice = (
prompt(
HTML("Choose <b>&lt;a&gt;</b>utomatic or <b>&lt;m&gt;</b>anual configuration [a/m] (a): "),
validator=Validator.from_callable(
lambda n: n == "" or n.startswith(("a", "A", "m", "M")), error_message="Please select 'a' or 'm'"
),
)
or "a"
)
return choice.lower().startswith("a")
def dest_path(dest=None) -> Path:
"""
@ -209,7 +213,7 @@ def graphical_accelerator():
"cpu",
)
idk = (
"I'm not sure what to choose",
"I'm not sure what to choose",
"idk",
)