mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-11-25 17:29:22 +01:00
Fix loading extensions with "-" in the name (closes #5557)
This commit is contained in:
parent
0f68c6fb5b
commit
d34126255d
@ -1,3 +1,4 @@
|
|||||||
|
import importlib
|
||||||
import traceback
|
import traceback
|
||||||
from functools import partial
|
from functools import partial
|
||||||
from inspect import signature
|
from inspect import signature
|
||||||
@ -33,13 +34,11 @@ def load_extensions():
|
|||||||
logger.info(f'Loading the extension "{name}"')
|
logger.info(f'Loading the extension "{name}"')
|
||||||
try:
|
try:
|
||||||
try:
|
try:
|
||||||
exec(f"import extensions.{name}.script")
|
extension = importlib.import_module(f"extensions.{name}.script")
|
||||||
except ModuleNotFoundError:
|
except ModuleNotFoundError:
|
||||||
logger.error(f"Could not import the requirements for '{name}'. Make sure to install the requirements for the extension.\n\nLinux / Mac:\n\npip install -r extensions/{name}/requirements.txt --upgrade\n\nWindows:\n\npip install -r extensions\\{name}\\requirements.txt --upgrade\n\nIf you used the one-click installer, paste the command above in the terminal window opened after launching the cmd script for your OS.")
|
logger.error(f"Could not import the requirements for '{name}'. Make sure to install the requirements for the extension.\n\nLinux / Mac:\n\npip install -r extensions/{name}/requirements.txt --upgrade\n\nWindows:\n\npip install -r extensions\\{name}\\requirements.txt --upgrade\n\nIf you used the one-click installer, paste the command above in the terminal window opened after launching the cmd script for your OS.")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
extension = getattr(extensions, name).script
|
|
||||||
|
|
||||||
# Only run setup() and apply settings from settings.yaml once
|
# Only run setup() and apply settings from settings.yaml once
|
||||||
if extension not in setup_called:
|
if extension not in setup_called:
|
||||||
apply_settings(extension, name)
|
apply_settings(extension, name)
|
||||||
|
Loading…
Reference in New Issue
Block a user