2024-08-28 22:20:36 +02:00
|
|
|
from core.stack import Stack
|
2024-08-28 10:39:27 +02:00
|
|
|
|
|
|
|
|
2024-08-28 22:20:36 +02:00
|
|
|
class ComfyUi(Stack):
|
2024-08-28 10:39:27 +02:00
|
|
|
def __init__(self):
|
|
|
|
super().__init__(
|
|
|
|
'ComfyUI',
|
2024-08-28 22:20:36 +02:00
|
|
|
'comfy_ui',
|
2024-08-28 10:39:27 +02:00
|
|
|
5004,
|
|
|
|
'https://github.com/comfyanonymous/ComfyUI.git'
|
|
|
|
)
|
|
|
|
|
2024-08-29 12:26:37 +02:00
|
|
|
def _install(self):
|
2024-08-28 10:39:27 +02:00
|
|
|
# Install the webui
|
|
|
|
self.git_clone(url=self.url, dest="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")
|
|
|
|
|
|
|
|
# Add GGUF support
|
2024-09-14 10:43:24 +02:00
|
|
|
self.git_clone(url="https://github.com/city96/ComfyUI-GGUF.git", dest="webui/custom_nodes/ComfyUI-GGUF")
|
2024-08-28 10:39:27 +02:00
|
|
|
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")
|
|
|
|
|
2024-08-29 12:26:37 +02:00
|
|
|
def _start(self):
|
2024-09-14 10:43:24 +02:00
|
|
|
args = ["--port", str(self.port), "--force-fp32"]
|
2024-08-29 12:03:37 +02:00
|
|
|
self.python(f"main.py", args=args, current_dir="webui",
|
2024-08-28 22:20:36 +02:00
|
|
|
env=["TORCH_BLAS_PREFER_HIPBLASLT=0"], daemon=True)
|