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
|
import invokeai.configs as configs
|
||||||
|
|
||||||
from invokeai.app.services.config import (
|
from invokeai.app.services.config import (
|
||||||
get_invokeai_config,
|
|
||||||
InvokeAIAppConfig,
|
InvokeAIAppConfig,
|
||||||
)
|
)
|
||||||
from invokeai.frontend.install.model_install import addModelsForm, process_and_execute
|
from invokeai.frontend.install.model_install import addModelsForm, process_and_execute
|
||||||
@ -45,6 +44,8 @@ from invokeai.frontend.install.widgets import (
|
|||||||
CenteredButtonPress,
|
CenteredButtonPress,
|
||||||
IntTitleSlider,
|
IntTitleSlider,
|
||||||
set_min_terminal_size,
|
set_min_terminal_size,
|
||||||
|
MIN_COLS,
|
||||||
|
MIN_LINES,
|
||||||
)
|
)
|
||||||
from invokeai.backend.install.legacy_arg_parsing import legacy_parser
|
from invokeai.backend.install.legacy_arg_parsing import legacy_parser
|
||||||
from invokeai.backend.install.model_install_backend import (
|
from invokeai.backend.install.model_install_backend import (
|
||||||
@ -55,10 +56,7 @@ from invokeai.backend.install.model_install_backend import (
|
|||||||
UserSelections,
|
UserSelections,
|
||||||
)
|
)
|
||||||
|
|
||||||
from invokeai.app.services.config import InvokeAIAppConfig
|
|
||||||
|
|
||||||
warnings.filterwarnings("ignore")
|
warnings.filterwarnings("ignore")
|
||||||
|
|
||||||
transformers.logging.set_verbosity_error()
|
transformers.logging.set_verbosity_error()
|
||||||
|
|
||||||
|
|
||||||
@ -72,10 +70,6 @@ Weights_dir = "ldm/stable-diffusion-v1/"
|
|||||||
Default_config_file = config.model_conf_path
|
Default_config_file = config.model_conf_path
|
||||||
SD_Configs = config.legacy_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']
|
PRECISION_CHOICES = ['auto','float16','float32','autocast']
|
||||||
|
|
||||||
INIT_FILE_PREAMBLE = """# InvokeAI initialization file
|
INIT_FILE_PREAMBLE = """# InvokeAI initialization file
|
||||||
@ -691,7 +685,9 @@ def run_console_ui(
|
|||||||
invokeai_opts = default_startup_options(initfile)
|
invokeai_opts = default_startup_options(initfile)
|
||||||
invokeai_opts.root = program_opts.root
|
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
|
# the install-models application spawns a subprocess to install
|
||||||
# models, and will crash unless this is set before running.
|
# models, and will crash unless this is set before running.
|
||||||
|
@ -45,19 +45,16 @@ from invokeai.frontend.install.widgets import (
|
|||||||
CenteredTitleText,
|
CenteredTitleText,
|
||||||
MultiSelectColumns,
|
MultiSelectColumns,
|
||||||
SingleSelectColumns,
|
SingleSelectColumns,
|
||||||
OffsetButtonPress,
|
|
||||||
TextBox,
|
TextBox,
|
||||||
BufferBox,
|
BufferBox,
|
||||||
FileBox,
|
FileBox,
|
||||||
set_min_terminal_size,
|
set_min_terminal_size,
|
||||||
select_stable_diffusion_config_file,
|
select_stable_diffusion_config_file,
|
||||||
|
MIN_COLS,
|
||||||
|
MIN_LINES,
|
||||||
)
|
)
|
||||||
from invokeai.app.services.config import InvokeAIAppConfig
|
from invokeai.app.services.config import InvokeAIAppConfig
|
||||||
|
|
||||||
# minimum size for the UI
|
|
||||||
MIN_COLS = 140
|
|
||||||
MIN_LINES = 50
|
|
||||||
|
|
||||||
config = InvokeAIAppConfig.get_config()
|
config = InvokeAIAppConfig.get_config()
|
||||||
|
|
||||||
# build a table mapping all non-printable characters to None
|
# 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,
|
def ask_user_for_config_file(model_path: Path,
|
||||||
tui_conn: Connection=None
|
tui_conn: Connection=None
|
||||||
)->Path:
|
)->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:
|
if tui_conn:
|
||||||
return _ask_user_for_cf_tui(model_path, tui_conn)
|
return _ask_user_for_cf_tui(model_path, tui_conn)
|
||||||
else:
|
else:
|
||||||
@ -847,7 +844,9 @@ def select_and_download_models(opt: Namespace):
|
|||||||
# needed because the torch library is loaded, even though we don't use it
|
# needed because the torch library is loaded, even though we don't use it
|
||||||
torch.multiprocessing.set_start_method("spawn")
|
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)
|
installApp = AddModelApplication(opt)
|
||||||
try:
|
try:
|
||||||
installApp.run()
|
installApp.run()
|
||||||
|
@ -16,8 +16,12 @@ from npyscreen import fmPopup
|
|||||||
from shutil import get_terminal_size
|
from shutil import get_terminal_size
|
||||||
from curses import BUTTON2_CLICKED,BUTTON3_CLICKED
|
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()
|
ts = get_terminal_size()
|
||||||
width = max(columns,ts.columns)
|
width = max(columns,ts.columns)
|
||||||
height = max(lines,ts.lines)
|
height = max(lines,ts.lines)
|
||||||
@ -29,7 +33,8 @@ def set_terminal_size(columns: int, lines: int):
|
|||||||
# in the Windows 10 environment.
|
# in the Windows 10 environment.
|
||||||
if 'IA_RELAUNCHED' not in os.environ:
|
if 'IA_RELAUNCHED' not in os.environ:
|
||||||
args=['conhost']
|
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.environ['IA_RELAUNCHED'] = 'True'
|
||||||
os.execvp('conhost',args)
|
os.execvp('conhost',args)
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user