fixed models loading

This commit is contained in:
Saifeddine ALOUI 2023-10-19 03:03:17 +02:00
parent 339160812a
commit d6aa7a11bd
2 changed files with 12 additions and 3 deletions

View File

@ -223,7 +223,16 @@ class LLMBinding:
model_path=None
for mn in self.models_folders:
if mn.name in model_name.lower():
model_path = mn/model_name
if mn.name == "ggml":
idx = model_name.index("-GGML")
models=[m for m in mn.iterdir() if model_name[:idx] in m.name]
model_path = mn/models[0].name
elif mn.name == "gguf":
idx = model_name.index("-GGUF")
models=[m for m in mn.iterdir() if model_name[:idx] in m.name]
model_path = mn/models[0].name
else:
model_path = mn/model_name
break
if model_path is None:
model_path = self.models_folders[0]/model_name
@ -352,7 +361,7 @@ class LLMBinding:
"""
models = []
for models_folder in self.models_folders:
if models_folder in ["ggml","gguf"]:
if models_folder.name in ["ggml","gguf"]:
models+=[f.name for f in models_folder.iterdir() if f.suffix in self.supported_file_extensions or f.suffix==".reference"]
else:
models+=[f.name for f in models_folder.iterdir() if f.is_dir() and not f.stem.startswith(".") or f.suffix==".reference"]

View File

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