Added gguf support

This commit is contained in:
Saifeddine ALOUI 2023-08-25 21:47:36 +02:00
parent 4908ed7e6d
commit 1364c74954
5 changed files with 6 additions and 9 deletions

View File

@ -11,7 +11,7 @@ Here's a breakdown of the important components and methods in the LLMBinding cla
- `config` (LOLLMSConfig): The global configuration object for LOLLMS.
- `binding_config` (TypedConfig): The configuration object specific to the binding.
- `installation_option` (InstallOption, optional): The installation option for the binding. Defaults to `InstallOption.INSTALL_IF_NECESSARY`.
- `file_extension` (str, optional): The file extension for models supported by the binding. Defaults to `"*.bin"`.
- `supported_file_extensions` (str, optional): The file extension for models supported by the binding. Defaults to `"*.bin"`.
- Description: The constructor initializes the LLMBinding object and sets up various properties based on the provided parameters. It also handles the installation of the binding if necessary.
2. **Installation Methods:**

View File

@ -40,7 +40,7 @@ class LLMBinding:
config:LOLLMSConfig,
binding_config:TypedConfig,
installation_option:InstallOption=InstallOption.INSTALL_IF_NECESSARY,
file_extension='*.bin'
supported_file_extensions='*.bin'
) -> None:
self.binding_dir = binding_dir
@ -48,7 +48,7 @@ class LLMBinding:
self.lollms_paths = lollms_paths
self.config = config
self.binding_config = binding_config
self.file_extension = file_extension
self.supported_file_extensions = supported_file_extensions
self.seed = config["seed"]
self.configuration_file_path = lollms_paths.personal_configuration_path/"bindings"/self.binding_folder_name/f"config.yaml"
@ -254,7 +254,7 @@ class LLMBinding:
"""Lists the models for this binding
"""
models_dir = self.lollms_paths.personal_models_path/config["binding_name"] # replace with the actual path to the models folder
return [f.name for f in models_dir.iterdir() if f.suffix == self.file_extension.replace("*","") or f.suffix==".reference"]
return [f.name for f in models_dir.iterdir() if f.suffix in self.supported_file_extensions or f.suffix==".reference"]
@staticmethod
def reinstall_pytorch_with_cuda():

View File

@ -1006,9 +1006,6 @@ class APScript(StateMachine):
else:
self.load_personality_config()
self.models_folder = self.personality.lollms_paths.personal_models_path / self.personality.personality_folder_name
self.models_folder.mkdir(parents=True, exist_ok=True)
def load_personality_config(self):
"""

View File

@ -112,7 +112,7 @@ class File64BitsManager:
return Image.open(io.BytesIO(base64.b64decode(image_data)))
@staticmethod
def get_file_extension_from_base64(b64data):
def get_supported_file_extensions_from_base64(b64data):
# Extract the file extension from the base64 data
data_match = re.match(r'^data:(.*?);base64,', b64data)
if data_match:

View File

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