* Copyright (c) Huawei Technologies Co., Ltd. 2025. All rights reserved.
* MindIE is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
*/
#ifndef CONFIG_MANAGER_H
#define CONFIG_MANAGER_H
#include <memory>
#include <mutex>
#include "config_info.h"
#include "log_config.h"
#include "nlohmann/json.hpp"
namespace mindie_llm {
class ConfigManager {
public:
ConfigManager() = delete;
ConfigManager(const ConfigManager &) = delete;
ConfigManager &operator=(const ConfigManager &) = delete;
static bool CreateInstance(std::string jsonPath = "");
static ConfigManager &GetInstance();
[[nodiscard]] const BackendConfig &GetBackendConfig() const;
[[nodiscard]] const LogConfig &GetLogConfig() const;
[[nodiscard]] const ServerConfig &GetServerConfig() const;
[[nodiscard]] const std::vector<ModelDeployConfig> &GetModelDeployConfig() const;
[[nodiscard]] const std::vector<LoraConfig> &GetLoraConfig() const;
[[nodiscard]] const ScheduleConfig &GetScheduleConfig() const;
[[nodiscard]] const RanktableParam &GetRanktableParam() const;
[[nodiscard]] bool CheckAllParam();
bool CheckAndInitLogParam();
void SetBlockNum(uint32_t cpuBlockNum, uint32_t npuBlockNum);
void SetMaxPositionEmbeddings(uint32_t maxPositionEmbeddings);
void SetTokenTimeout(uint64_t tokenTimeout);
void SetE2eTimeout(uint64_t e2eTimeout);
std::string GetConfigJsonStr();
bool IsMultiNodeInfer() const;
bool IslayerwiseDisaggregated() const;
bool IsLwdMultiNodesEnable() const;
std::string GetLwdRoleType() const;
private:
explicit ConfigManager(const std::string &jsonPath);
~ConfigManager();
class Impl;
std::unique_ptr<Impl> impl_;
};
}
#endif