x
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
@@ -151,3 +152,25 @@ def resolve_model_profile(
|
||||
if "VLLM_WORKER_MULTIPROC_METHOD" not in env_vars:
|
||||
env_vars["VLLM_WORKER_MULTIPROC_METHOD"] = "spawn"
|
||||
return model_key, updates, env_vars
|
||||
|
||||
|
||||
def load_app_config(config_file: str = "config.json") -> dict[str, Any]:
|
||||
"""
|
||||
统一的应用配置加载函数,封装完整的配置加载流程。
|
||||
|
||||
Args:
|
||||
config_file: 配置文件路径,默认为 "config.json"
|
||||
|
||||
Returns:
|
||||
包含合并后配置的字典,包括 runtime settings 和 model profile updates
|
||||
"""
|
||||
catalog = load_catalog(config_file)
|
||||
runtime = resolve_runtime_settings(catalog)
|
||||
_, updates, env_vars = resolve_model_profile(
|
||||
content=catalog,
|
||||
requested_model=runtime["model_key"],
|
||||
requested_tp=runtime["tensor_parallel_size"],
|
||||
)
|
||||
for key, value in env_vars.items():
|
||||
os.environ[key] = value
|
||||
return {**runtime, **updates}
|
||||
|
||||
Reference in New Issue
Block a user