mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-11-28 18:48:04 +01:00
Add backwards compatibility
This commit is contained in:
parent
8ad658ea4a
commit
570ba7766c
@ -19,7 +19,14 @@ def add_lora_to_model(lora_names):
|
|||||||
|
|
||||||
def add_lora_exllama(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:
|
if len(lora_names) == 0:
|
||||||
shared.model.generator.lora = None
|
shared.model.generator.lora = None
|
||||||
|
@ -4,9 +4,22 @@ from pathlib import Path
|
|||||||
from modules import shared
|
from modules import shared
|
||||||
from modules.logging_colors import logger
|
from modules.logging_colors import logger
|
||||||
|
|
||||||
from exllama.generator import ExLlamaGenerator
|
try:
|
||||||
from exllama.model import ExLlama, ExLlamaCache, ExLlamaConfig
|
from exllama.generator import ExLlamaGenerator
|
||||||
from exllama.tokenizer import ExLlamaTokenizer
|
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:
|
class ExllamaModel:
|
||||||
|
Loading…
Reference in New Issue
Block a user