This commit is contained in:
Saifeddine ALOUI 2023-06-21 23:22:04 +02:00
parent 84bed4806e
commit fb5b467966
2 changed files with 11 additions and 4 deletions

View File

@ -27,8 +27,6 @@ __license__ = "Apache 2.0"
class LLMBinding: class LLMBinding:
file_extension='*.bin'
def __init__( def __init__(
self, self,
@ -36,13 +34,16 @@ class LLMBinding:
lollms_paths:LollmsPaths, lollms_paths:LollmsPaths,
config:LOLLMSConfig, config:LOLLMSConfig,
binding_config:TypedConfig, binding_config:TypedConfig,
installation_option:InstallOption=InstallOption.INSTALL_IF_NECESSARY installation_option:InstallOption=InstallOption.INSTALL_IF_NECESSARY,
file_extension='*.bin'
) -> None: ) -> None:
self.binding_dir = binding_dir self.binding_dir = binding_dir
self.binding_folder_name = binding_dir.stem self.binding_folder_name = binding_dir.stem
self.lollms_paths = lollms_paths self.lollms_paths = lollms_paths
self.config = config self.config = config
self.binding_config = binding_config self.binding_config = binding_config
self.file_extension = file_extension
self.configuration_file_path = lollms_paths.personal_configuration_path/f"binding_{self.binding_folder_name}.yaml" self.configuration_file_path = lollms_paths.personal_configuration_path/f"binding_{self.binding_folder_name}.yaml"
@ -172,6 +173,12 @@ class LLMBinding:
""" """
return " ".join(tokens_list) return " ".join(tokens_list)
def list_models(self, config:dict):
"""Lists the models for this binding
"""
models_dir = self.lollms_paths.bindings_zoo_path/config["binding_name"] # replace with the actual path to the models folder
return [f.name for f in models_dir.glob(self.file_extension)]
@staticmethod @staticmethod
def reinstall_pytorch_with_cuda(): 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"]) result = subprocess.run(["pip", "install", "--upgrade", "torch", "torchvision", "torchaudio", "--no-cache-dir", "--index-url", "https://download.pytorch.org/whl/cu117"])

View File

@ -26,7 +26,7 @@ def get_all_files(path):
setuptools.setup( setuptools.setup(
name="lollms", name="lollms",
version="2.0.5", version="2.0.6",
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",