ai-suite-rocm-local/services/stable_diffusion_webui.py

28 lines
912 B
Python
Raw Permalink Normal View History

2024-10-05 14:23:55 +02:00
from pathlib import Path
from core.stack import Stack
2024-08-28 10:39:27 +02:00
class StableDiffusionWebui(Stack):
2024-08-28 10:39:27 +02:00
def __init__(self):
super().__init__(
'StableDiffusion WebUI',
'stable_diffusion_webui',
2024-08-28 10:39:27 +02:00
5002,
'https://github.com/AUTOMATIC1111/stable-diffusion-webui'
)
def _install(self):
2024-08-28 10:39:27 +02:00
# Install the webui
2024-10-05 14:23:55 +02:00
self.git_clone(url=self.url, branch="dev", dest=Path(self.path / "webui"))
2024-08-28 10:39:27 +02:00
2024-10-05 14:23:55 +02:00
self.python("launch.py --skip-torch-cuda-test --exit", current_dir=Path(self.path / "webui"))
2024-08-28 10:39:27 +02:00
# Add NF4 support for Flux
self.install_from_prebuilt("bitsandbytes")
def _start(self):
2024-08-28 10:39:27 +02:00
args = ["--listen", "--enable-insecure-extension-access", "--port", str(self.port)]
2024-10-05 14:23:55 +02:00
self.python(f"launch.py", args=args, current_dir=Path(self.path / "webui"),
env=["TORCH_BLAS_PREFER_HIPBLASLT=0"], daemon=True)