-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.py
More file actions
74 lines (58 loc) · 2.17 KB
/
Copy pathinstall.py
File metadata and controls
74 lines (58 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/env python3
"""
Alice installer — run once to set up everything needed.
python install.py
"""
import os, json, shutil, sys
_SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.join(_SCRIPT_DIR, "server"))
from installer.helpers import CONFIG_FILE, CONF_DIR, ok, info
from installer.packages import check_python, install_packages
from installer.llama import install_llama_server
from installer.model import setup_model
from installer.tts_install import install_tts_models
from installer.forge_install import install_forge
from installer.fonts_install import install_fonts
# Re-export for tests: from install import _pick_llama_asset
from installer.llama import _pick_llama_asset # noqa: F401
def _bootstrap_configs():
"""Copy example configs to their live locations on first run."""
if not os.path.exists(CONFIG_FILE):
example = os.path.join(CONF_DIR, "alice.example.json")
if os.path.exists(example):
shutil.copy(example, CONFIG_FILE)
info("created alice.json from conf/alice.example.json")
personas_file = os.path.join(_SCRIPT_DIR, "personas.json")
if not os.path.exists(personas_file):
personas_example = os.path.join(CONF_DIR, "personas.example.json")
if os.path.exists(personas_example):
shutil.copy(personas_example, personas_file)
info("created personas.json from conf/personas.example.json")
def main():
print("=" * 50)
print(" Alice - Installer")
print("=" * 50)
check_python()
install_packages()
_bootstrap_configs()
with open(CONFIG_FILE, encoding="utf-8") as f:
cfg = json.load(f)
install_llama_server(cfg)
setup_model(cfg)
with open(CONFIG_FILE, "w", encoding="utf-8") as f:
json.dump(cfg, f, indent=4)
ok("alice.json saved")
install_tts_models()
install_forge(cfg)
install_fonts()
print("\n" + "=" * 50)
print(" Installation complete!")
print("=" * 50)
print()
print(" Start Alice:")
print(" python alice.py")
print()
print(" Then open: http://localhost:8000")
print()
if __name__ == "__main__":
main()