update services to refactor

This commit is contained in:
Mathieu Broillet 2024-10-05 14:23:55 +02:00
parent 80e92d3cd3
commit 5afec336cc
Signed by: mathieu
GPG Key ID: A08E484FE95074C1
6 changed files with 26 additions and 16 deletions

View File

@ -27,7 +27,7 @@ def load_services():
if __name__ == '__main__':
setup_logger(logging.INFO)
setup_logger(logging.DEBUG)
logger.info("Starting AI Suite for ROCM")
setup_config()

View File

@ -1,3 +1,5 @@
from pathlib import Path
from core.stack import Stack
@ -11,13 +13,13 @@ class BackgroundRemovalDis(Stack):
)
def _install(self):
self.git_clone(url=self.url, dest="webui")
self.git_clone(url=self.url, dest=Path(self.path / "webui"))
self.install_requirements("webui/requirements.txt")
self.pip_install("gradio") # gradio is not in requirements.txt for some reason
self.remove_line_in_file("os.", "webui/app.py") # remove manual clone of DIS from app.py (done below)
self.git_clone("https://github.com/xuebinqin/DIS.git", dest="tmp-dis")
self.git_clone("https://github.com/xuebinqin/DIS.git", dest=Path("tmp-dis"))
self.move_all_files_in_dir("tmp-dis/IS-Net", "webui")
self.remove_dir("tmp-dis")
@ -27,5 +29,5 @@ class BackgroundRemovalDis(Stack):
# self.remove_dir("webui/.git") # saves a lot of space due to big repo
def _start(self):
self.python(f"app.py", current_dir="webui",
self.python(f"app.py", current_dir=Path(self.path / "webui"),
env=["TORCH_BLAS_PREFER_HIPBLASLT=0", f"GRADIO_SERVER_PORT={self.port}"], daemon=True)

View File

@ -1,3 +1,5 @@
from pathlib import Path
from core.stack import Stack
@ -12,22 +14,22 @@ class ComfyUi(Stack):
def _install(self):
# Install the webui
self.git_clone(url=self.url, dest="webui")
self.git_clone(url=self.url, dest=Path(self.path / "webui"))
self.install_requirements("webui/requirements.txt")
# Install the manager
self.git_clone(url="https://github.com/ltdrdata/ComfyUI-Manager.git", dest="webui/custom_nodes/manager")
self.git_clone(url="https://github.com/ltdrdata/ComfyUI-Manager.git", dest=Path("webui/custom_nodes/manager"))
# Add GGUF support
self.git_clone(url="https://github.com/city96/ComfyUI-GGUF.git", dest="webui/custom_nodes/ComfyUI-GGUF")
self.git_clone(url="https://github.com/city96/ComfyUI-GGUF.git", dest=Path("webui/custom_nodes/ComfyUI-GGUF"))
self.pip_install(["gguf", "numpy==1.26.4"])
# Add NF4 support for Flux
self.install_from_prebuilt("bitsandbytes")
self.git_clone(url="https://github.com/comfyanonymous/ComfyUI_bitsandbytes_NF4.git",
dest="webui/custom_nodes/ComfyUI_bitsandbytes_NF4")
dest=Path("webui/custom_nodes/ComfyUI_bitsandbytes_NF4"))
def _start(self):
args = ["--port", str(self.port), "--force-fp32"]
self.python(f"main.py", args=args, current_dir="webui",
self.python(f"main.py", args=args, current_dir=Path(self.path / "webui"),
env=["TORCH_BLAS_PREFER_HIPBLASLT=0"], daemon=True)

View File

@ -1,3 +1,5 @@
from pathlib import Path
from core.stack import Stack
@ -12,14 +14,14 @@ class StableDiffusionWebui(Stack):
def _install(self):
# Install the webui
self.git_clone(url=self.url, branch="dev", dest="webui")
self.git_clone(url=self.url, branch="dev", dest=Path(self.path / "webui"))
self.python("launch.py --skip-torch-cuda-test --exit", current_dir="webui")
self.python("launch.py --skip-torch-cuda-test --exit", current_dir=Path(self.path / "webui"))
# Add NF4 support for Flux
self.install_from_prebuilt("bitsandbytes")
def _start(self):
args = ["--listen", "--enable-insecure-extension-access", "--port", str(self.port)]
self.python(f"launch.py", args=args, current_dir="webui",
self.python(f"launch.py", args=args, current_dir=Path(self.path / "webui"),
env=["TORCH_BLAS_PREFER_HIPBLASLT=0"], daemon=True)

View File

@ -1,3 +1,5 @@
from pathlib import Path
from core.stack import Stack
@ -30,7 +32,7 @@ class TextGenerationWebui(Stack):
# self.pip("install -e .", path="triton")
# Install the webui
self.git_clone(url=self.url, dest="webui")
self.git_clone(url=self.url, dest=Path(self.path / "webui"))
self.remove_line_in_file(["accelerate", "lm_eval", "optimum", "autoawq", "llama_cpp_python"],
"webui/requirements_amd.txt")
self.install_requirements("webui/requirements_amd.txt")
@ -59,5 +61,5 @@ class TextGenerationWebui(Stack):
def _start(self):
args = ["--listen", "--listen-port", str(self.port)]
self.python(f"server.py", args=args, current_dir="webui",
self.python(f"server.py", args=args, current_dir=Path(self.path / "webui"),
env=["TORCH_BLAS_PREFER_HIPBLASLT=0"], daemon=True)

View File

@ -1,3 +1,5 @@
from pathlib import Path
from core.stack import Stack
@ -12,7 +14,7 @@ class XttsWebui(Stack):
def _install(self):
# Install the webui
self.git_clone(url=self.url, dest="webui")
self.git_clone(url=self.url, dest=Path(self.path / "webui"))
self.remove_line_in_file("torch", "webui/requirements.txt")
self.install_requirements("webui/requirements.txt")
@ -32,5 +34,5 @@ class XttsWebui(Stack):
def _start(self):
args = ["--host", "0.0.0.0", "--port", str(self.port)]
self.python(f"server.py", current_dir="webui",
self.python(f"server.py", current_dir=Path(self.path / "webui"),
env=["TORCH_BLAS_PREFER_HIPBLASLT=0"], args=args, daemon=True)