llmfit 如何用 --force-runtime 在 Apple Silicon 上强制 llama.cpp 推荐替代自动 MLX? 📅 发布时间:2026/9/11 4:46:36 👁 浏览次数: llmfit 如何用 --force-runtime 在 Apple Silicon 上强制 llama.cpp 推荐替代自动 MLX【免费下载链接】llmfitHundreds of models providers. One command to find what runs on your hardware.项目地址: https://gitcode.com/GitHub_Trending/ll/llmfit在 Apple Silicon 机器上运行 llmfit 做模型适配分析时运行时选择是自动的系统会优先给出 MLX 的推荐结果。如果你的目标是 llama.cpp——比如已经部署了 llama-server或需要 GGUF 量化路线——就需要用--force-runtime覆盖这个自动选择让 llmfit 按 llama.cpp 运行时重新出推荐列表。本文覆盖这个操作在 CLI 和 REST API 两条路径上的完整执行方式与验证方法。--force-runtime覆盖的是什么llmfit 在分析时会自动选择一个推理运行时force_runtime的作用是“override automatic runtime selection during analysis”覆盖分析过程中的自动运行时选择文档给出的典型例子就是在 Apple Silicon 上拿到 llama.cpp 推荐而不是 MLX。取值范围为mlx|llamacpp|vllm来源docs/cli.md、API.md。核心逻辑在 llmfit-core/src/fit.rs 中提供force_runtime时优先采用它否则走自动选择。对 Apple Silicon 硬件本身llmfit 通过system_profiler读取统一内存VRAM 即系统 RAM见 docs/how-it-works.md所以强制切换运行时不会改变内存检测只改变按哪条运行路径出推荐。主路径CLI 命令前置条件只有已安装的 llmfit CLI。recommend子命令默认输出 JSON直接执行# 强制 llama.cpp 运行时获取推荐列表 llmfit recommend --force-runtime llamacpp按使用场景收窄结果均为 docs/cli.md 中的原始示例# 只看编码场景限制返回 3 条 llmfit recommend --force-runtime llamacpp --use-case coding --limit 3可组合的其他参数--use-case general|coding|reasoning|chat|multimodal|embedding按用途过滤--limit默认 5返回条数--min-fit perfect|good|marginal默认marginal最低适配等级--runtime mlx|llamacpp|any按运行时过滤推荐项与--force-runtime分属两层——前者是结果过滤后者是分析时覆盖自动选择。注意区分--runtime只是从结果里筛选运行时列而--force-runtime改变的是分析阶段本身选用的运行时。标题场景Apple Silicon 上自动选 MLX、你想要 llama.cpp需要的是后者。验证推荐结果recommend默认输出 JSON字段包含name、fit_level、run_mode、score、estimated_tps、memory_required_gb、best_quant、runtime等见 llmfit-tui/src/main.rs 中recommend的字段说明。核对方法确认每条模型的runtime字段为llamacpp而不是不加参数时在 Apple Silicon 上常见的mlx对照fit_level与memory_required_gb/memory_available_gb判断该模型在你的统一内存上是否可运行。如果怀疑硬件检测本身有问题可以另开一条命令查看检测到的系统规格llmfit system可选路径REST API 参数force_runtime如果你在跑llmfit serve节点级 REST API同一个覆盖能力以查询参数形式提供取值同样是mlx|llamacpp|vllmAPI.md 的 Query parameters 一节# 启动服务以本机 8787 端口为例 llmfit serve --host 0.0.0.0 --port 8787# 强制 llama.cpp 运行时取 Top 5 可运行模型 curl http://localhost:8787/api/v1/models/top?limit5force_runtimellamacpp该参数同时作用于/api/v1/models和/api/v1/models/top。传入非法值时服务端返回 HTTP 400错误信息形如invalid force_runtime value: use mlx|llamacpp|vllm。限制与注意事项不能与--profile组合--profile硬件画像与--force-runtime目前不能同时使用CLI 会直接报错--profile cannot be combined with --force-runtime yetdocs/cli.md 的 Limitations 一节与 llmfit-tui/src/main.rs 的报错文案。serve 在--profile模式下运行时请求里的force_runtime同样会被拒绝见 llmfit-tui/src/serve_api.rs。需要模拟别的机器时只能二选一。版本该 flag 在 v0.9.7 加入CHANGELOG.md如果你的安装版本更早命令会提示未知参数需升级 llmfit。MLX 与 llama.cpp 的模型来源不同MLX 路线的下载映射到 HuggingFace 上的mlx-community/*仓库而 llama.cpp 路线面向 GGUF见 docs/providers.md。强制切换到llamacpp后选模型和拉取模型都要按 GGUF 来源执行。--force-runtime llamacpp只影响分析时的运行时选择不改变硬件检测、评分维度和内存估算公式拿到结果后estimated_tps与estimate_confidence字段仍可用来判断该估算来自实测还是纯公式。【免费下载链接】llmfitHundreds of models providers. One command to find what runs on your hardware.项目地址: https://gitcode.com/GitHub_Trending/ll/llmfit创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考