mirror of
https://github.com/Bing-su/adetailer.git
synced 2026-02-23 16:44:10 +00:00
fix: trace controlnet import error
This commit is contained in:
@@ -13,6 +13,9 @@
|
||||
- scripts_args를 딥카피함
|
||||
- postprocess_image를 약간 분리함
|
||||
|
||||
- v23.5.6.post0
|
||||
- `init_controlnet_ext`에서 에러메세지를 자세히 볼 수 있음
|
||||
|
||||
### 2023-05-04
|
||||
|
||||
- v23.5.4
|
||||
|
||||
@@ -1 +1 @@
|
||||
__version__ = "23.5.6"
|
||||
__version__ = "23.5.6.post0"
|
||||
|
||||
@@ -34,20 +34,16 @@ class ControlNetExt:
|
||||
self.cn_available = False
|
||||
self.external_cn = None
|
||||
|
||||
def init_controlnet(self) -> bool:
|
||||
def init_controlnet(self):
|
||||
if is_in_builtin:
|
||||
import_path = "extensions-builtin.sd-webui-controlnet.scripts.external_code"
|
||||
else:
|
||||
import_path = "extensions.sd-webui-controlnet.scripts.external_code"
|
||||
|
||||
try:
|
||||
self.external_cn = importlib.import_module(import_path, "external_code")
|
||||
self.cn_available = True
|
||||
models = self.external_cn.get_models()
|
||||
self.cn_models.extend(m for m in models if "inpaint" in m)
|
||||
return True
|
||||
except ImportError:
|
||||
return False
|
||||
self.external_cn = importlib.import_module(import_path, "external_code")
|
||||
self.cn_available = True
|
||||
models = self.external_cn.get_models()
|
||||
self.cn_models.extend(m for m in models if "inpaint" in m)
|
||||
|
||||
def _update_scripts_args(self, p, model: str, weight: float):
|
||||
cn_units = [
|
||||
|
||||
@@ -2,6 +2,7 @@ from __future__ import annotations
|
||||
|
||||
import platform
|
||||
import sys
|
||||
import traceback
|
||||
from copy import copy, deepcopy
|
||||
from itertools import zip_longest
|
||||
from pathlib import Path
|
||||
@@ -253,9 +254,14 @@ class AfterDetailerScript(scripts.Script):
|
||||
def init_controlnet_ext(self):
|
||||
if self.controlnet_ext is None:
|
||||
self.controlnet_ext = ControlNetExt()
|
||||
success = self.controlnet_ext.init_controlnet()
|
||||
if not success:
|
||||
print("[-] ADetailer: ControlNetExt init failed.", file=sys.stderr)
|
||||
try:
|
||||
self.controlnet_ext.init_controlnet()
|
||||
except ImportError:
|
||||
error = traceback.format_exc()
|
||||
print(
|
||||
f"[-] ADetailer: ControlNetExt init failed:\n{error}",
|
||||
file=sys.stderr,
|
||||
)
|
||||
|
||||
def is_ad_enabled(self, args: ADetailerArgs):
|
||||
return args.ad_enable is True and args.ad_model != "None"
|
||||
|
||||
Reference in New Issue
Block a user