mirror of
https://github.com/ParisNeo/lollms.git
synced 2024-12-23 06:22:27 +00:00
Enhanced paths management
This commit is contained in:
parent
ce44d0c87d
commit
fbac0b8731
@ -4,6 +4,7 @@ from ascii_colors import ASCIIColors, trace_exception
|
|||||||
from lollms.config import BaseConfig
|
from lollms.config import BaseConfig
|
||||||
import subprocess
|
import subprocess
|
||||||
import os
|
import os
|
||||||
|
import yaml
|
||||||
|
|
||||||
lollms_path = Path(__file__).parent
|
lollms_path = Path(__file__).parent
|
||||||
lollms_default_cfg_path = lollms_path / "configs/config.yaml"
|
lollms_default_cfg_path = lollms_path / "configs/config.yaml"
|
||||||
@ -24,6 +25,19 @@ gptqlora_repo = "https://github.com/ParisNeo/gptqlora.git"
|
|||||||
class LollmsPaths:
|
class LollmsPaths:
|
||||||
def __init__(self, global_paths_cfg_path=None, lollms_path=None, personal_path=None, custom_default_cfg_path=None, tool_prefix=""):
|
def __init__(self, global_paths_cfg_path=None, lollms_path=None, personal_path=None, custom_default_cfg_path=None, tool_prefix=""):
|
||||||
self.global_paths_cfg_path = global_paths_cfg_path
|
self.global_paths_cfg_path = global_paths_cfg_path
|
||||||
|
if self.global_paths_cfg_path is not None:
|
||||||
|
try:
|
||||||
|
with(open(self.global_paths_cfg_path,"r") as f):
|
||||||
|
infos = yaml.safe_load(f)
|
||||||
|
if lollms_path is None:
|
||||||
|
lollms_path = infos["lollms_path"]
|
||||||
|
if personal_path is None:
|
||||||
|
personal_path = infos["lollms_personal_path"]
|
||||||
|
except Exception as ex:
|
||||||
|
ASCIIColors.error(ex)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
self.tool_prefix = tool_prefix
|
self.tool_prefix = tool_prefix
|
||||||
if lollms_path is None:
|
if lollms_path is None:
|
||||||
lollms_path = Path(__file__).parent
|
lollms_path = Path(__file__).parent
|
||||||
|
Loading…
Reference in New Issue
Block a user