文档
模型 (model.yaml)
model.yaml
简介
使用跨平台 model.yaml
规范描述模型。
草稿
model.yaml
在一个可移植的文件中描述模型及其所有变体。LM Studio 的模型目录中的所有模型都使用 model.yaml 实现。
这允许抽象底层格式(GGUF、MLX 等),并为给定模型提供一个单一的入口点。此外,model.yaml 文件支持嵌入额外的元数据、加载和推理选项,甚至自定义逻辑(例如,启用/禁用思考)。
您可以在 LM Studio Hub 上克隆现有的 model.yaml 文件,甚至可以发布您自己的!
model
以 publisher/model
形式的规范标识符。
model: qwen/qwen3-8b
base
指向“具体”模型文件或其他虚拟模型。每个条目都使用唯一的 key
和一个或多个可从中获取文件的 sources
。
下面的代码片段演示了一个模型 (qwen/qwen3-8b
) 可以解析为 3 个不同具体模型中的一个的案例。
model: qwen/qwen3-8b base: - key: lmstudio-community/qwen3-8b-gguf sources: - type: huggingface user: lmstudio-community repo: Qwen3-8B-GGUF - key: lmstudio-community/qwen3-8b-mlx-4bit sources: - type: huggingface user: lmstudio-community repo: Qwen3-8B-MLX-4bit - key: lmstudio-community/qwen3-8b-mlx-8bit sources: - type: huggingface user: lmstudio-community repo: Qwen3-8B-MLX-8bit
具体模型文件指实际的权重。
metadataOverrides
覆盖基础模型的元数据。这对于展示很有用,例如在 LM Studio 的模型目录或应用程序模型搜索中。它不用于模型的任何功能更改。
metadataOverrides: domain: llm architectures: - qwen3 compatibilityTypes: - gguf - safetensors paramsStrings: - 8B minMemoryUsageBytes: 4600000000 contextLengths: - 40960 vision: false reasoning: true trainedForToolUse: true
config
使用此选项“嵌入”默认运行时设置(如采样参数),甚至加载时选项。这与每个模型的默认值类似。
operation:
推理时间参数load:
加载时间参数config: operation: fields: - key: llm.prediction.topKSampling value: 20 - key: llm.prediction.temperature value: 0.7 load: fields: - key: llm.load.contextLength value: 42690
customFields
定义模型特定的自定义字段。
customFields: - key: enableThinking displayName: Enable Thinking description: Controls whether the model will think before replying type: boolean defaultValue: true effects: - type: setJinjaVariable variable: enable_thinking
为了使上述示例生效,Jinja 模板需要有一个名为 enable_thinking
的变量。
摘自https://lm-studio.cn/models/qwen/qwen3-8b
# model.yaml is an open standard for defining cross-platform, composable AI models # Learn more at https://modelyaml.org model: qwen/qwen3-8b base: - key: lmstudio-community/qwen3-8b-gguf sources: - type: huggingface user: lmstudio-community repo: Qwen3-8B-GGUF - key: lmstudio-community/qwen3-8b-mlx-4bit sources: - type: huggingface user: lmstudio-community repo: Qwen3-8B-MLX-4bit - key: lmstudio-community/qwen3-8b-mlx-8bit sources: - type: huggingface user: lmstudio-community repo: Qwen3-8B-MLX-8bit metadataOverrides: domain: llm architectures: - qwen3 compatibilityTypes: - gguf - safetensors paramsStrings: - 8B minMemoryUsageBytes: 4600000000 contextLengths: - 40960 vision: false reasoning: true trainedForToolUse: true config: operation: fields: - key: llm.prediction.topKSampling value: 20 - key: llm.prediction.minPSampling value: checked: true value: 0 customFields: - key: enableThinking displayName: Enable Thinking description: Controls whether the model will think before replying type: boolean defaultValue: true effects: - type: setJinjaVariable variable: enable_thinking
GitHub 规范包含更多详细信息和最新架构。
此页面源代码可在 GitHub 上获取