mirror of
https://github.com/ParisNeo/lollms.git
synced 2025-04-07 19:04:14 +00:00
updated
This commit is contained in:
parent
6ba81cb8a8
commit
b8e9a8661b
@ -173,19 +173,8 @@ class LLMBinding:
|
||||
"""
|
||||
return " ".join(tokens_list)
|
||||
|
||||
|
||||
# To implement by children
|
||||
# @staticmethod
|
||||
# def get_available_models():
|
||||
|
||||
|
||||
# ===============================
|
||||
|
||||
class BindingInstaller:
|
||||
def __init__(self, config: LOLLMSConfig) -> None:
|
||||
self.config = config
|
||||
|
||||
def reinstall_pytorch_with_cuda(self):
|
||||
@staticmethod
|
||||
def reinstall_pytorch_with_cuda():
|
||||
result = subprocess.run(["pip", "install", "--upgrade", "torch", "torchvision", "torchaudio", "--no-cache-dir", "--index-url", "https://download.pytorch.org/whl/cu117"])
|
||||
if result.returncode != 0:
|
||||
ASCIIColors.warning("Couldn't find Cuda build tools on your PC. Reverting to CPU.")
|
||||
@ -196,6 +185,13 @@ class BindingInstaller:
|
||||
ASCIIColors.error("Pytorch installed successfully!!")
|
||||
|
||||
|
||||
# To implement by children
|
||||
# @staticmethod
|
||||
# def get_available_models():
|
||||
|
||||
|
||||
# ===============================
|
||||
|
||||
class BindingBuilder:
|
||||
def build_binding(
|
||||
self,
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 721fdce27c00950364db64677bffc621907b791a
|
||||
Subproject commit df051a448c04579eb0cc8470691e43a50bbc3a8c
|
@ -1 +1 @@
|
||||
Subproject commit 25f8e84618c5a46c2bb7cb6fbb6817b53ef86c2d
|
||||
Subproject commit 8201e8a413c0522499f226083f5982687894cadc
|
@ -100,12 +100,12 @@ class LoLLMsServer:
|
||||
if self.config.binding_name is None:
|
||||
self.menu.select_binding()
|
||||
else:
|
||||
self.binding = self.build_binding(self.bindings_path, self.config)
|
||||
self.binding = BindingBuilder().build_binding(self.config, self.lollms_paths)
|
||||
if self.config.model_name is None:
|
||||
self.menu.select_model()
|
||||
else:
|
||||
try:
|
||||
self.active_model = self.binding(self.config)
|
||||
self.active_model = self.binding.build_model()
|
||||
except Exception as ex:
|
||||
print(f"{ASCIIColors.color_red}Couldn't load model Please select a valid model{ASCIIColors.color_reset}")
|
||||
print(f"{ASCIIColors.color_red}{ex}{ASCIIColors.color_reset}")
|
||||
@ -151,17 +151,18 @@ class LoLLMsServer:
|
||||
# cfg.download_model(url)
|
||||
else:
|
||||
try:
|
||||
self.binding = BindingBuilder().build_binding(self.lollms_paths.bindings_zoo_path, self.config)
|
||||
self.binding = BindingBuilder().build_binding(self.config, self.lollms_paths)
|
||||
except Exception as ex:
|
||||
print(ex)
|
||||
print(f"Couldn't find binding. Please verify your configuration file at {self.config.file_path} or use the next menu to select a valid binding")
|
||||
print(f"Trying to reinstall binding")
|
||||
self.binding = BindingBuilder().build_binding(self.lollms_paths.bindings_zoo_path, self.config,force_reinstall=True)
|
||||
self.binding = BindingBuilder().build_binding(self.config, self.lollms_paths, InstallOption.FORCE_INSTALL)
|
||||
self.menu.select_binding()
|
||||
|
||||
def load_model(self):
|
||||
try:
|
||||
self.model = ModelBuilder(self.binding).get_model()
|
||||
ASCIIColors.success("Model loaded successfully")
|
||||
except Exception as ex:
|
||||
ASCIIColors.error(f"Couldn't load model.")
|
||||
ASCIIColors.error(f"Binding returned this exception : {ex}")
|
||||
@ -367,7 +368,7 @@ class LoLLMsServer:
|
||||
self.cp_config = copy.deepcopy(self.config)
|
||||
self.cp_config["model_name"] = data['model_name']
|
||||
try:
|
||||
self.active_model = self.binding(self.cp_config)
|
||||
self.active_model = self.binding.build_model()
|
||||
emit('select_model', {'success':True, 'model_name': model_name}, room=request.sid)
|
||||
except Exception as ex:
|
||||
print(ex)
|
||||
|
Loading…
x
Reference in New Issue
Block a user