This commit is contained in:
Saifeddine ALOUI 2023-06-16 21:03:56 +02:00
commit ced2b05d9a
6 changed files with 22 additions and 3 deletions

View File

@ -19,6 +19,7 @@ from tqdm import tqdm
import urllib.request import urllib.request
import importlib import importlib
import shutil import shutil
import subprocess
__author__ = "parisneo" __author__ = "parisneo"
@ -203,6 +204,16 @@ class BindingInstaller:
def __init__(self, config: LOLLMSConfig) -> None: def __init__(self, config: LOLLMSConfig) -> None:
self.config = config self.config = config
def reinstall_pytorch_with_cuda(self):
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.")
result = subprocess.run(["pip", "install", "--upgrade", "torch", "torchvision", "torchaudio", "--no-cache-dir"])
if result.returncode != 0:
ASCIIColors.error("Couldn't install pytorch !!")
else:
ASCIIColors.error("Pytorch installed successfully!!")
class LLMBinding: class LLMBinding:

View File

@ -267,7 +267,7 @@ class Conversation:
self.config = LOLLMSConfig.autoload(self.lollms_paths, configuration_path) self.config = LOLLMSConfig.autoload(self.lollms_paths, configuration_path)
if self.config.model_name is None: if self.config.model_name is None:
self.menu.select_model(self) self.menu.select_model()
# load binding # load binding
@ -381,6 +381,8 @@ Participating personalities:
except Exception as ex: except Exception as ex:
print(ex) print(ex)
print(f"Couldn't find binding. Please verify your configuration file at {self.configuration_path} or use the next menu to select a valid binding") print(f"Couldn't find binding. Please verify your configuration file at {self.configuration_path} or use the next menu to select a valid binding")
print(f"Trying to reinstall binding")
self.binding_class = BindingBuilder().build_binding(self.lollms_paths.bindings_zoo_path, self.config,force_reinstall=True)
self.menu.select_binding() self.menu.select_binding()
def load_model(self): def load_model(self):

View File

@ -257,7 +257,6 @@ def install_package(package_name):
print(f"{package_name} has been successfully installed.") print(f"{package_name} has been successfully installed.")
class AIPersonality: class AIPersonality:
# Extra # Extra
@ -1041,3 +1040,6 @@ Date: {{date}}
output_string = re.sub(pattern, replace, input_string) output_string = re.sub(pattern, replace, input_string)
return output_string return output_string
class AIPersonalityInstaller:
def __init__(self, personality:AIPersonality) -> None:
self.personality = personality

View File

@ -58,6 +58,8 @@ class LoLLMsServer:
except Exception as ex: except Exception as ex:
print(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"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_class = BindingBuilder().build_binding(self.lollms_paths.bindings_zoo_path, self.config,force_reinstall=True)
self.menu.select_binding() self.menu.select_binding()
def load_model(self): def load_model(self):

View File

@ -153,6 +153,8 @@ Participating personalities:
except Exception as ex: except Exception as ex:
print(ex) print(ex)
print(f"Couldn't find binding. Please verify your configuration file at {self.cfg_path} or use the next menu to select a valid binding") print(f"Couldn't find binding. Please verify your configuration file at {self.cfg_path} or use the next menu to select a valid binding")
print(f"Trying to reinstall binding")
self.binding_class = BindingBuilder().build_binding(self.lollms_paths.bindings_zoo_path, self.config,force_reinstall=True)
self.menu.select_binding() self.menu.select_binding()
def load_model(self): def load_model(self):

View File

@ -26,7 +26,7 @@ def get_all_files(path):
setuptools.setup( setuptools.setup(
name="lollms", name="lollms",
version="1.1.84", version="1.1.91",
author="Saifeddine ALOUI", author="Saifeddine ALOUI",
author_email="aloui.saifeddine@gmail.com", author_email="aloui.saifeddine@gmail.com",
description="A python library for AI personality definition", description="A python library for AI personality definition",