diff --git a/modules/LoRA.py b/modules/LoRA.py index 0e1504ac..9d8a9cda 100644 --- a/modules/LoRA.py +++ b/modules/LoRA.py @@ -19,7 +19,14 @@ def add_lora_to_model(lora_names): def add_lora_exllama(lora_names): - from exllama.lora import ExLlamaLora + try: + from exllama.lora import ExLlamaLora + except: + try: + from repositories.exllama.lora import ExLlamaLora + except: + logger.error("Could not find the file repositories/exllama/lora.py. Make sure that exllama is cloned inside repositories/ and is up to date.") + return if len(lora_names) == 0: shared.model.generator.lora = None diff --git a/modules/exllama.py b/modules/exllama.py index ced98ec0..3b7103a0 100644 --- a/modules/exllama.py +++ b/modules/exllama.py @@ -4,9 +4,22 @@ from pathlib import Path from modules import shared from modules.logging_colors import logger -from exllama.generator import ExLlamaGenerator -from exllama.model import ExLlama, ExLlamaCache, ExLlamaConfig -from exllama.tokenizer import ExLlamaTokenizer +try: + from exllama.generator import ExLlamaGenerator + from exllama.model import ExLlama, ExLlamaCache, ExLlamaConfig + from exllama.tokenizer import ExLlamaTokenizer +except: + logger.warning('Exllama module failed to load. Will attempt to load from repositories.') + try: + from modules.relative_imports import RelativeImport + + with RelativeImport("repositories/exllama"): + from generator import ExLlamaGenerator + from model import ExLlama, ExLlamaCache, ExLlamaConfig + from tokenizer import ExLlamaTokenizer + except: + logger.error("Could not find the file repositories/exllama/lora.py. Make sure that exllama is cloned inside repositories/ and is up to date.") + raise class ExllamaModel: