maxframe.learn.contrib.llm.deploy.config.ModelDeploymentConfig#
- class maxframe.learn.contrib.llm.deploy.config.ModelDeploymentConfig(*args, **kwargs)[源代码]#
用于通过自定义模型扩展 MaxFrame 的模型部署配置。
此配置适用于需要部署 MaxFrame 内置模型库中未提供的模型的用户。它提供了一种方式来指定自定义部署方案,通过告知每个 MaxFrame 工作节点使用哪个框架、加载哪个模型路径以及如何加载。
该配置假定模型已在容器镜像或挂载路径中设置好,并使用当前的 deploy_config 来加载它们。用户需负责确保运行时环境的状态和兼容性。
- 参数:
model_name (str) -- 模型的名称。
model_file (str) --
The local file path of the model, e.g.,
"/mnt/models/qwen/". When using OSS models, this should match one of themount_pathvalues infs_mounts.Note: OSS paths (
oss://...) are NOT supported directly. Usefs_mountsto mount OSS paths to local paths first.inference_framework_type (InferenceFrameworkEnum) -- 模型的推理框架。
required_resource_files (List[Union[str, Any]]) -- 模型所需的资源文件。
load_params (Dict[str, Any]) -- 模型的加载参数。
required_cpu (int) -- 模型所需的 CPU 资源。
required_memory (int) -- 模型所需的内存资源。
required_gu (int) -- 模型所需的 GU 资源。
required_gpu_memory (int) -- 模型所需的 GPU 显存。
device (str, optional) -- The device of the model. One of "cpu" or "cuda". Defaults to None, which allows the server to determine the device at runtime.
properties (Dict[str, Any]) -- 模型的属性。
tags (List[str]) -- 模型的标签。
fs_mounts (List[FsMountOptions]) --
File system mount configurations for mounting OSS models to local paths. Each FsMountOptions contains:
path: OSS source path, e.g.,"oss://bucket/models/qwen/"mount_path: Local mount path, e.g.,"/mnt/qwen"storage_options: Authentication config (role_arn)
envs (Dict[str, str]) -- Custom environment variables for the inference subprocess. Example:
{"CUDA_VISIBLE_DEVICES": "0", "HF_HOME": "/mnt/cache"}
备注
模型部署为预览版本,所有字段在未来可能会发生变更。
用户责任声明:用户必须完全理解自己正在执行的计算任务,并确保充分了解其配置选择所带来的影响。您需对以下事项负责:
确保模型与指定的推理框架兼容
验证模型文件在运行环境中存在且可访问
确认资源需求(CPU、内存、GPU)充足
验证所有依赖项和库均已正确安装
理解所选模型的计算行为和特性
- __init__(*args, **kwargs)#
方法
__init__(*args, **kwargs)check_validity()Validate the configuration and raise ValueError if invalid.
copy()copy_to(target)get_default_enable_thinking()is_reasoning_model()属性
required_gurequired_gpu_memorytagsload_paramsmodel_filerequired_cpuenvsrequired_memorydevicefs_mountsinference_framework_typeimageinference_parameterspropertiesmodel_namerequired_resource_files