52 lines
1.4 KiB
Python
52 lines
1.4 KiB
Python
|
|
#####################################################
|
|
## 1. use for Memory-Recycler
|
|
## .model_infos
|
|
## ['deepseek_mtp',]
|
|
##
|
|
## 2. waitting...
|
|
######################################################
|
|
|
|
import os
|
|
class ConfigManager():
|
|
def __init__(self):
|
|
self._config_name = ".model_infos"
|
|
|
|
def update_model_infos(self, model_infos : str):
|
|
from pathlib import Path
|
|
workspace_path = Path.cwd()
|
|
|
|
bootinfo_config = f'{workspace_path}/{self._config_name}'
|
|
try:
|
|
with open(bootinfo_config, 'w') as w:
|
|
w.write(model_infos)
|
|
except Exception as e:
|
|
print("[WARN] write model_infos fail, caused by ", e)
|
|
raise False
|
|
|
|
def get_model_infos(self):
|
|
from pathlib import Path
|
|
workspace_path = Path.cwd()
|
|
|
|
bootinfo_config = f'{workspace_path}/{self._config_name}'
|
|
bootinfo_inited = os.path.exists(bootinfo_config)
|
|
|
|
runner_model_infos = "default"
|
|
if bootinfo_inited:
|
|
try:
|
|
with open(bootinfo_config) as w:
|
|
runner_model_infos = w.readline()
|
|
except Exception as e:
|
|
print("[WARN] model_infos load fail ", e)
|
|
|
|
return runner_model_infos
|
|
|
|
config_manager = None
|
|
|
|
def vllm_vacc_config_manager():
|
|
global config_manager
|
|
|
|
if config_manager is None:
|
|
config_manager = ConfigManager()
|
|
return config_manager
|
|
|