mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
(installer) add a --y[es[to_all]] argument for a fully hands-off install/config
This commit is contained in:
parent
4b659982b7
commit
242abac12d
@ -141,28 +141,30 @@ class Installer:
|
|||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def install(self, path: str = "~/invokeai", version: str = "latest") -> None:
|
def install(self, root: str = "~/invokeai", version: str = "latest", yes_to_all=False) -> None:
|
||||||
"""
|
"""
|
||||||
Install the InvokeAI application into the given runtime path
|
Install the InvokeAI application into the given runtime path
|
||||||
|
|
||||||
:param path: Destination path for the installation
|
:param root: Destination path for the installation
|
||||||
:type path: str
|
:type root: str
|
||||||
:param version: InvokeAI version to install
|
:param version: InvokeAI version to install
|
||||||
:type version: str
|
:type version: str
|
||||||
|
:param yes: Accept defaults to all questions
|
||||||
|
:type yes: bool
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import messages
|
import messages
|
||||||
|
|
||||||
messages.welcome()
|
messages.welcome()
|
||||||
|
|
||||||
self.dest = messages.dest_path(path)
|
self.dest = Path(root).expanduser().resolve() if yes_to_all else messages.dest_path(root)
|
||||||
|
|
||||||
self.venv = self.app_venv()
|
self.venv = self.app_venv()
|
||||||
|
|
||||||
self.instance = InvokeAiInstance(runtime=self.dest, venv=self.venv)
|
self.instance = InvokeAiInstance(runtime=self.dest, venv=self.venv)
|
||||||
|
|
||||||
# create the venv, install dependencies and the application
|
# create the venv, install dependencies and the application
|
||||||
self.instance.deploy(extra_index_url=get_torch_source())
|
self.instance.deploy(extra_index_url=get_torch_source() if not yes_to_all else None)
|
||||||
|
|
||||||
# run the configuration flow
|
# run the configuration flow
|
||||||
self.instance.configure()
|
self.instance.configure()
|
||||||
@ -288,6 +290,9 @@ class InvokeAiInstance:
|
|||||||
|
|
||||||
from ldm.invoke.config import configure_invokeai
|
from ldm.invoke.config import configure_invokeai
|
||||||
|
|
||||||
|
# NOTE: currently the config script does its own arg parsing! this means the command-line switches
|
||||||
|
# from the installer will also automatically propagate down to the config script.
|
||||||
|
# this may change in the future with config refactoring!
|
||||||
configure_invokeai.main()
|
configure_invokeai.main()
|
||||||
|
|
||||||
def install_user_scripts(self):
|
def install_user_scripts(self):
|
||||||
|
@ -8,14 +8,30 @@ from installer import Installer
|
|||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
|
|
||||||
parser.add_argument("-r", "--root", type=str, help="Destination path for installation", default="~/invokeai")
|
parser.add_argument(
|
||||||
|
"-r",
|
||||||
|
"--root",
|
||||||
|
dest="root",
|
||||||
|
type=str,
|
||||||
|
help="Destination path for installation",
|
||||||
|
default="~/invokeai",
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"-y",
|
||||||
|
"--yes",
|
||||||
|
"--yes-to-all",
|
||||||
|
dest="yes_to_all",
|
||||||
|
action="store_true",
|
||||||
|
help="Assume default answers to all questions",
|
||||||
|
default=False,
|
||||||
|
)
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
inst = Installer()
|
inst = Installer()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
inst.install(path=args.root)
|
inst.install(**args.__dict__)
|
||||||
except KeyboardInterrupt as exc:
|
except KeyboardInterrupt as exc:
|
||||||
print("\n")
|
print("\n")
|
||||||
print("Ctrl-C pressed. Aborting.")
|
print("Ctrl-C pressed. Aborting.")
|
||||||
|
@ -14,8 +14,8 @@ from rich.console import Console, Group
|
|||||||
from rich.panel import Panel
|
from rich.panel import Panel
|
||||||
from rich.prompt import Confirm
|
from rich.prompt import Confirm
|
||||||
from rich.style import Style
|
from rich.style import Style
|
||||||
from rich.text import Text
|
|
||||||
from rich.syntax import Syntax
|
from rich.syntax import Syntax
|
||||||
|
from rich.text import Text
|
||||||
|
|
||||||
"""
|
"""
|
||||||
INVOKE_AI_SRC=https://github.com/invoke-ai/InvokeAI/archive/refs/tags/${INVOKEAI_VERSION}.zip
|
INVOKE_AI_SRC=https://github.com/invoke-ai/InvokeAI/archive/refs/tags/${INVOKEAI_VERSION}.zip
|
||||||
@ -247,4 +247,4 @@ def introduction() -> None:
|
|||||||
"",
|
"",
|
||||||
"[i]At any point you may interrupt this program and resume later.",
|
"[i]At any point you may interrupt this program and resume later.",
|
||||||
)))
|
)))
|
||||||
console.line(2)
|
console.line(2)
|
||||||
|
Loading…
Reference in New Issue
Block a user