Deduplicate default extra network registration
This commit is contained in:
parent
de3abc29ae
commit
21ee46eea7
@ -14,6 +14,11 @@ def register_extra_network(extra_network):
|
|||||||
extra_network_registry[extra_network.name] = extra_network
|
extra_network_registry[extra_network.name] = extra_network
|
||||||
|
|
||||||
|
|
||||||
|
def register_default_extra_networks():
|
||||||
|
from modules.extra_networks_hypernet import ExtraNetworkHypernet
|
||||||
|
register_extra_network(ExtraNetworkHypernet())
|
||||||
|
|
||||||
|
|
||||||
class ExtraNetworkParams:
|
class ExtraNetworkParams:
|
||||||
def __init__(self, items=None):
|
def __init__(self, items=None):
|
||||||
self.items = items or []
|
self.items = items or []
|
||||||
|
@ -236,6 +236,15 @@ def initialize():
|
|||||||
extra_pages.clear()
|
extra_pages.clear()
|
||||||
|
|
||||||
|
|
||||||
|
def register_default_pages():
|
||||||
|
from modules.ui_extra_networks_textual_inversion import ExtraNetworksPageTextualInversion
|
||||||
|
from modules.ui_extra_networks_hypernets import ExtraNetworksPageHypernetworks
|
||||||
|
from modules.ui_extra_networks_checkpoints import ExtraNetworksPageCheckpoints
|
||||||
|
register_page(ExtraNetworksPageTextualInversion())
|
||||||
|
register_page(ExtraNetworksPageHypernetworks())
|
||||||
|
register_page(ExtraNetworksPageCheckpoints())
|
||||||
|
|
||||||
|
|
||||||
class ExtraNetworksUi:
|
class ExtraNetworksUi:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.pages = None
|
self.pages = None
|
||||||
|
16
webui.py
16
webui.py
@ -34,8 +34,7 @@ startup_timer.record("import gradio")
|
|||||||
import ldm.modules.encoders.modules # noqa: F401
|
import ldm.modules.encoders.modules # noqa: F401
|
||||||
startup_timer.record("import ldm")
|
startup_timer.record("import ldm")
|
||||||
|
|
||||||
from modules import extra_networks, ui_extra_networks_checkpoints
|
from modules import extra_networks
|
||||||
from modules import extra_networks_hypernet, ui_extra_networks_hypernets, ui_extra_networks_textual_inversion
|
|
||||||
from modules.call_queue import wrap_gradio_gpu_call, wrap_queued_call, queue_lock # noqa: F401
|
from modules.call_queue import wrap_gradio_gpu_call, wrap_queued_call, queue_lock # noqa: F401
|
||||||
|
|
||||||
# Truncate version number of nightly/local build of PyTorch to not cause exceptions with CodeFormer or Safetensors
|
# Truncate version number of nightly/local build of PyTorch to not cause exceptions with CodeFormer or Safetensors
|
||||||
@ -214,12 +213,11 @@ def initialize():
|
|||||||
startup_timer.record("reload hypernets")
|
startup_timer.record("reload hypernets")
|
||||||
|
|
||||||
ui_extra_networks.initialize()
|
ui_extra_networks.initialize()
|
||||||
ui_extra_networks.register_page(ui_extra_networks_textual_inversion.ExtraNetworksPageTextualInversion())
|
ui_extra_networks.register_default_pages()
|
||||||
ui_extra_networks.register_page(ui_extra_networks_hypernets.ExtraNetworksPageHypernetworks())
|
|
||||||
ui_extra_networks.register_page(ui_extra_networks_checkpoints.ExtraNetworksPageCheckpoints())
|
|
||||||
|
|
||||||
extra_networks.initialize()
|
extra_networks.initialize()
|
||||||
extra_networks.register_extra_network(extra_networks_hypernet.ExtraNetworkHypernet())
|
extra_networks.register_default_extra_networks()
|
||||||
|
|
||||||
startup_timer.record("extra networks")
|
startup_timer.record("extra networks")
|
||||||
|
|
||||||
if cmd_opts.tls_keyfile is not None and cmd_opts.tls_keyfile is not None:
|
if cmd_opts.tls_keyfile is not None and cmd_opts.tls_keyfile is not None:
|
||||||
@ -420,12 +418,10 @@ def webui():
|
|||||||
startup_timer.record("reload hypernetworks")
|
startup_timer.record("reload hypernetworks")
|
||||||
|
|
||||||
ui_extra_networks.initialize()
|
ui_extra_networks.initialize()
|
||||||
ui_extra_networks.register_page(ui_extra_networks_textual_inversion.ExtraNetworksPageTextualInversion())
|
ui_extra_networks.register_default_pages()
|
||||||
ui_extra_networks.register_page(ui_extra_networks_hypernets.ExtraNetworksPageHypernetworks())
|
|
||||||
ui_extra_networks.register_page(ui_extra_networks_checkpoints.ExtraNetworksPageCheckpoints())
|
|
||||||
|
|
||||||
extra_networks.initialize()
|
extra_networks.initialize()
|
||||||
extra_networks.register_extra_network(extra_networks_hypernet.ExtraNetworkHypernet())
|
extra_networks.register_default_extra_networks()
|
||||||
startup_timer.record("initialize extra networks")
|
startup_timer.record("initialize extra networks")
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user