目前 LM Studio 下载的模型无法直接通过 Ollama 运行,因为两者在模型的存储路径、命名方式和格式处理上存在显著差异,反之亦然。不过,可以通过以下方法实现模型共用:
方法一:使用Gollama(前身为Llamalink) 工具
Llamalink 是一个开源的命令行工具,可以自动将 Ollama 模型链接到 LM Studio 的目录结构中,反之亦然。
- Llamalink主页:https://github.com/sammcj/llamalink,项目在2024.7.15日由作者停止,作者开发了新款开源工具Gollama来替代。
- Gollama主页:https://github.com/sammcj/gollama,1.4K stars
Gollama 是一个用于管理 Ollama 模型的 macOS/Linux 开源工具。它提供了一个 TUI(文本用户界面),用于列出、检查、删除、复制和推送 Ollama 模型,以及与 LM Studio 的双向同步。该应用程序允许用户使用热键以交互方式选择模型、排序、过滤、编辑、运行、卸载和执行操作。
Gollama的特征
- 列出可用的模型
- 显示元数据,例如大小、量化级别、模型系列和修改日期
- 编辑/更新模型的模型文件
- 按名称、大小、修改日期、量化级别、系列等对模型进行排序
- 选择和删除模型
- 运行和卸载模型
- 检查模型以获取更多详细信息
- 计算模型的近似 vRAM 使用情况
- 与 LM Studio 双向同步:将 Ollama 模型链接到 LM Studio从 LM Studio 模型创建 Ollama 模型(实验性的功能)
- 复制/重命名模型
- 将模型推送到注册表
- 将模型复制到远程主机(spit)
- 显示正在运行的模型
安装
go install github.com/sammcj/gollama@HEAD
也可以手动下载和安装:在release页面下载打包好的zip版本,将其解压到/usr/local/bin目录下。
方法二:手动转换并导入 Ollama(适合 GGUF 模型)
如果 LM Studio 下载的是 .gguf 格式模型,你可以手动将其导入 Ollama:
转换的步骤
以我在 Windows 11 系统上通过 LM Studio 下载的
Qwen3-4B-Instruct-2507-GGUF 模型为例:
1)找到 LM Studio 下载的 .gguf 模型文件(macOS 系统通常在
~/Library/Caches/LMStudio/models 路径)
我的在目录 C:\Users\jackt\.lmstudio\models\lmstudio-community\
Qwen3-4B-Instruct-2507-GGUF,可以看到有一个GGUF文件:
Qwen3-4B-Instruct-2507-Q4_K_M.gguf。
2)创建一个 Modelfile 文件,内容如下:写清楚模型的路径 FROM /path/to/your/model.gguf
FROM C:/Users/jackt/.lmstudio/models/lmstudio-community/Qwen3-4B-Instruct-2507-GGUF/Qwen3-4B-Instruct-2507-Q4_K_M.gguf
3)在终端运行:ollama create my-model-name -f Modelfile
$ ollama create qwen3-instruct-2507:4b -f Modelfile
gathering model components
copying file sha256:8cdb57cbb880d313736a9bc4e3d3d2485f145b5e19cf33783746e753e82641fc 100%
parsing GGUF
using existing layer sha256:8cdb57cbb880d313736a9bc4e3d3d2485f145b5e19cf33783746e753e82641fc
writing manifest
success
4)启动模型:
# 查看本地的模型
$ ollama list
NAME ID SIZE MODIFIED
qwen3-instruct-2507:4b 616ad349ff24 2.5 GB 29 seconds ago
embeddinggemma:latest 693ca723e5e7 621 MB 8 days ago
...
# 可见`qwen3-instruct-2507:4b`已经顺利放入Ollama的模型仓库中
# 运行模型
$ ollama run qwen3-instruct-2507:4b
注意:Ollama 不识别 LM Studio 的模型元数据,需手动指定路径和参数。
注意事项:
- LM Studio 和 Ollama 的模型管理方式不同,不能简单复制粘贴使用;
- 若模型格式不是 GGUF,可能需要先转换(如使用 llama.cpp 工具);
- 模型路径和命名方式不同,建议统一命名规范以便管理。