O
OpenClaw
首页博客关于文档社区
O
OpenClaw

OpenClaw - 你的AI助手平台。连接AI能力,让工作更高效,生活更有趣。

导航

  • 首页
  • 博客
  • 关于
  • 文档
  • 社区

资源

  • GitHub
  • Discord
  • 使用文档
© 2026 OpenClaw. All rights reserved.Powered by OpenClaw & Next.js
返回首页
技术

LM Studio 本地部署大模型指南

A
AI 玩家
2026年3月19日
|
1 阅读
|
2 分钟阅读
分享:

# LM Studio 本地部署大模型指南


图形界面本地运行 AI 大模型,易上手、功能强大


LM Studio 简介


LM Studio 是一个本地大语言模型运行工具:

  • 🖥️ 图形界面,操作简单
  • 🤖 支持多种模型格式 (GGUF, LLama2, Mistral 等)
  • ⚡ GPU 加速支持
  • 🔌 提供 OpenAI 兼容 API

支持的系统


  • macOS 12+ (Apple Silicon 和 Intel)
  • Windows 10/11
  • Linux (通过 AppImage)

安装


macOS

bash
# 下载 DMG
https://lmstudio.ai/

# 或使用 Homebrew
brew install --cask lm-studio

Windows

从官网下载 installer:

https://lmstudio.ai/


Linux

bash
# 下载 AppImage
chmod +x LM-Studio-*.AppImage
./LM-Studio-*.AppImage

使用教程


1. 下载模型


打开 LM Studio,在左侧搜索模型:

  • llama3
  • mistral
  • qwen
  • deepseek

点击 Download 下载模型。


2. 运行模型


  1. 1.选择已下载的模型
  1. 2.点击 Load 加载模型
  1. 3.在聊天界面开始对话

3. API 服务


  1. 1.点击左侧 "Developer"
  1. 2.选择 "OpenAI Compatibility"
  1. 3.点击 "Start Server"
  1. 4.默认端口:1234

4. 调用 API


python
import requests

response = requests.post(
    "http://localhost:1234/v1/chat/completions",
    json={
        "model": "llama3",
        "messages": [
            {"role": "user", "content": "你好!"}
        ]
    }
)
print(response.json())

配置选项


GPU 加速设置


点击模型旁边的 ⚙️ 图标:

  • GPU Layers:设置为显卡能承受的最大值
  • Context Length:默认 4096,可根据显存调整

模型参数调优


  • Temperature:创意程度 (0-2)
  • Top P:核采样
  • Max Tokens:最大输出长度

与 OpenClaw 集成


env
AI_PROVIDER=ollama
OLLAMA_BASE_URL=http://localhost:1234/v1
OLLAMA_MODEL=llama3

常见问题


模型加载失败


确保有足够内存:

  • 7B 模型需要约 8GB RAM
  • 13B 模型需要约 16GB RAM

GPU 未被调用


检查设置:

  1. 1.Settings → GPU Acceleration → Enabled
  1. 2.确认 NVIDIA Driver / ROCm 已安装

API 调用失败


确认服务器已启动:

bash
curl http://localhost:1234/v1/models

对比 Ollama


| 特性 | LM Studio | Ollama |

|------|-----------|--------|

| 界面 | 图形界面 | 命令行 |

| 模型格式 | GGUF | 原始格式 |

| API | OpenAI 兼容 | 部分兼容 |

| 易用性 | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐ |


---


相关教程:

  • [Ollama 本地部署](/post/ollama-local-llm)
  • [llama.cpp 部署](/post/llama-cpp-deployment)

标签

#LM Studio#大模型#本地部署#AI#GUI

相关文章

Ollama 本地部署大模型完全指南

使用 Ollama 在本地部署大语言模型的完整指南,涵盖安装、模型选择、API 调用和性能优化。

2026-03-20

llama.cpp 本地部署大模型指南

# llama.cpp 本地部署大模型指南 > 纯 C++ 实现的高效推理引擎,最极致的性能追求 ## 什么是 llama.cpp? - ⚡ 由 Georgi Gerganov 开发 - 🚀

2026-03-20

5个让你效率翻倍的AI Prompt技巧

分享5个实用的AI提示词技巧,帮助你更好地与AI协作。

2026-03-19
上一篇

Ollama 本地部署大模型完全指南

下一篇

llama.cpp 本地部署大模型指南

订阅博客更新

通过 RSS 订阅,及时获取最新文章

RSS 订阅链接
返回文章列表

评论 (0)

发表评论

0/1000