mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix conhost launch-with args
This commit is contained in:
parent
90333c0074
commit
e5024bf5e9
@ -37,7 +37,6 @@ from transformers import (
|
||||
import invokeai.configs as configs
|
||||
|
||||
from invokeai.app.services.config import (
|
||||
get_invokeai_config,
|
||||
InvokeAIAppConfig,
|
||||
)
|
||||
from invokeai.frontend.install.model_install import addModelsForm, process_and_execute
|
||||
@ -45,6 +44,8 @@ from invokeai.frontend.install.widgets import (
|
||||
CenteredButtonPress,
|
||||
IntTitleSlider,
|
||||
set_min_terminal_size,
|
||||
MIN_COLS,
|
||||
MIN_LINES,
|
||||
)
|
||||
from invokeai.backend.install.legacy_arg_parsing import legacy_parser
|
||||
from invokeai.backend.install.model_install_backend import (
|
||||
@ -55,10 +56,7 @@ from invokeai.backend.install.model_install_backend import (
|
||||
UserSelections,
|
||||
)
|
||||
|
||||
from invokeai.app.services.config import InvokeAIAppConfig
|
||||
|
||||
warnings.filterwarnings("ignore")
|
||||
|
||||
transformers.logging.set_verbosity_error()
|
||||
|
||||
|
||||
@ -72,10 +70,6 @@ Weights_dir = "ldm/stable-diffusion-v1/"
|
||||
Default_config_file = config.model_conf_path
|
||||
SD_Configs = config.legacy_conf_path
|
||||
|
||||
# minimum size for the UI
|
||||
MIN_COLS = 135
|
||||
MIN_LINES = 45
|
||||
|
||||
PRECISION_CHOICES = ['auto','float16','float32','autocast']
|
||||
|
||||
INIT_FILE_PREAMBLE = """# InvokeAI initialization file
|
||||
@ -690,8 +684,10 @@ def run_console_ui(
|
||||
# parse_args() will read from init file if present
|
||||
invokeai_opts = default_startup_options(initfile)
|
||||
invokeai_opts.root = program_opts.root
|
||||
|
||||
set_min_terminal_size(MIN_COLS, MIN_LINES)
|
||||
|
||||
# The third argument is needed in the Windows 11 environment to
|
||||
# launch a console window running this program.
|
||||
set_min_terminal_size(MIN_COLS, MIN_LINES,'invokeai-configure')
|
||||
|
||||
# the install-models application spawns a subprocess to install
|
||||
# models, and will crash unless this is set before running.
|
||||
|
@ -45,19 +45,16 @@ from invokeai.frontend.install.widgets import (
|
||||
CenteredTitleText,
|
||||
MultiSelectColumns,
|
||||
SingleSelectColumns,
|
||||
OffsetButtonPress,
|
||||
TextBox,
|
||||
BufferBox,
|
||||
FileBox,
|
||||
set_min_terminal_size,
|
||||
select_stable_diffusion_config_file,
|
||||
MIN_COLS,
|
||||
MIN_LINES,
|
||||
)
|
||||
from invokeai.app.services.config import InvokeAIAppConfig
|
||||
|
||||
# minimum size for the UI
|
||||
MIN_COLS = 140
|
||||
MIN_LINES = 50
|
||||
|
||||
config = InvokeAIAppConfig.get_config()
|
||||
|
||||
# build a table mapping all non-printable characters to None
|
||||
@ -698,7 +695,7 @@ class StderrToMessage():
|
||||
def ask_user_for_config_file(model_path: Path,
|
||||
tui_conn: Connection=None
|
||||
)->Path:
|
||||
logger.debug(f'Waiting for user action in dialog box (above).')
|
||||
logger.debug('Waiting for user action in dialog box (above).')
|
||||
if tui_conn:
|
||||
return _ask_user_for_cf_tui(model_path, tui_conn)
|
||||
else:
|
||||
@ -846,8 +843,10 @@ def select_and_download_models(opt: Namespace):
|
||||
else:
|
||||
# needed because the torch library is loaded, even though we don't use it
|
||||
torch.multiprocessing.set_start_method("spawn")
|
||||
|
||||
set_min_terminal_size(MIN_COLS, MIN_LINES)
|
||||
|
||||
# the third argument is needed in the Windows 11 environment in
|
||||
# order to launch and resize a console window running this program
|
||||
set_min_terminal_size(MIN_COLS, MIN_LINES,'invokeai-model-install')
|
||||
installApp = AddModelApplication(opt)
|
||||
try:
|
||||
installApp.run()
|
||||
|
@ -16,8 +16,12 @@ from npyscreen import fmPopup
|
||||
from shutil import get_terminal_size
|
||||
from curses import BUTTON2_CLICKED,BUTTON3_CLICKED
|
||||
|
||||
# minimum size for UIs
|
||||
MIN_COLS = 140
|
||||
MIN_LINES = 50
|
||||
|
||||
# -------------------------------------
|
||||
def set_terminal_size(columns: int, lines: int):
|
||||
def set_terminal_size(columns: int, lines: int, launch_command: str=None):
|
||||
ts = get_terminal_size()
|
||||
width = max(columns,ts.columns)
|
||||
height = max(lines,ts.lines)
|
||||
@ -29,7 +33,8 @@ def set_terminal_size(columns: int, lines: int):
|
||||
# in the Windows 10 environment.
|
||||
if 'IA_RELAUNCHED' not in os.environ:
|
||||
args=['conhost']
|
||||
args.extend(sys.argv)
|
||||
args.extend([launch_command] if launch_command else [sys.argv[0]])
|
||||
args.extend(sys.argv[1:])
|
||||
os.environ['IA_RELAUNCHED'] = 'True'
|
||||
os.execvp('conhost',args)
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user