mirror of
https://github.com/ParisNeo/lollms.git
synced 2024-12-24 06:46:40 +00:00
fixed model install
This commit is contained in:
parent
f6eb8c3672
commit
339160812a
@ -88,7 +88,8 @@ class LLMBinding:
|
||||
self.models_folders = config.lollms_paths.binding_models_paths
|
||||
self.models_dir_names = models_dir_names
|
||||
else:
|
||||
self.models_folders = [config.lollms_paths.personal_models_path / self.binding_folder_name]
|
||||
config.lollms_paths.binding_models_paths= [config.lollms_paths.personal_models_path / self.binding_folder_name]
|
||||
self.models_folders = config.lollms_paths.binding_models_paths
|
||||
self.models_dir_names = [self.binding_folder_name]
|
||||
for models_folder in self.models_folders:
|
||||
models_folder.mkdir(parents=True, exist_ok=True)
|
||||
@ -207,6 +208,17 @@ class LLMBinding:
|
||||
ASCIIColors.red(f"UnInstalling {self.binding_folder_name}")
|
||||
ASCIIColors.blue("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*")
|
||||
|
||||
def searchModelParentFolder(self, model_name:str):
|
||||
model_path=None
|
||||
for mn in self.models_folders:
|
||||
if mn.name in model_name.lower():
|
||||
model_path = mn
|
||||
break
|
||||
if model_path is None:
|
||||
model_path = self.models_folders[0]
|
||||
return model_path
|
||||
|
||||
|
||||
def searchModelPath(self, model_name:str):
|
||||
model_path=None
|
||||
for mn in self.models_folders:
|
||||
|
@ -139,10 +139,20 @@ class LOLLMSConfig(BaseConfig):
|
||||
except Exception as ex:
|
||||
print(f"Exception in checking model existance: {ex}")
|
||||
return False
|
||||
|
||||
|
||||
def searchModelPath(self, model_name:str):
|
||||
model_path=None
|
||||
for mn in self.lollms_paths.binding_models_paths:
|
||||
if mn.name in model_name.lower():
|
||||
model_path = mn/model_name
|
||||
break
|
||||
if model_path is None:
|
||||
model_path = self.lollms_paths.binding_models_paths[0]/model_name
|
||||
return model_path
|
||||
|
||||
def download_model(self, url, binding, callback = None):
|
||||
model_name = url.split("/")[-1]
|
||||
folder_path = binding.config.searchModelPath(model_name)
|
||||
folder_path = self.searchModelPath(model_name)
|
||||
model_full_path = (folder_path / model_name)
|
||||
if binding is not None and hasattr(binding,'download_model'):
|
||||
binding.download_model(url, model_full_path, callback)
|
||||
@ -169,8 +179,8 @@ class LOLLMSConfig(BaseConfig):
|
||||
|
||||
def reference_model(self, path):
|
||||
path = str(path).replace("\\","/")
|
||||
folder_path = self.lollms_paths.personal_models_path/self.binding_name
|
||||
model_name = path.split("/")[-1]+".reference"
|
||||
folder_path = self.searchModelPath(model_name)
|
||||
model_full_path = (folder_path / model_name)
|
||||
|
||||
# Check if file already exists in folder
|
||||
|
Loading…
Reference in New Issue
Block a user