隆重推出 lms:LM Studio 的命令行界面

2024-05-02

LM Studio

今天,伴随着 LM Studio 0.2.22,我们发布了第一个版本的 lms —— LM Studio 的配套命令行工具。

使用 lms,您可以加载/卸载模型、启动/停止 API 服务器,并检查原始 LLM 输入(而不仅仅是输出)。它在 GitHub 上开发,我们欢迎社区提交问题和 PR。

lms 随 LM Studio 一起发布,位于 LM Studio 的工作目录下,即 ~/.lmstudio/bin/。当您更新 LM Studio 时,它也会更新您的 lms 版本。如果您是开发者,您也可以从源代码构建 lms

在您的系统上引导 lms

您需要至少运行一次 LM Studio,然后才能使用 lms

之后,打开您的终端并运行以下命令之一,具体取决于您的操作系统

# Mac / Linux:
~/.lmstudio/bin/lms bootstrap

# Windows:
cmd /c %USERPROFILE%/.lmstudio/bin/lms.exe bootstrap

之后,打开一个新的终端窗口并运行 lms

这是您将获得的当前输出

$ lms
lms - LM Studio CLI - v0.2.22
GitHub: https://github.com/lmstudio-ai/lmstudio-cli

Usage
lms <subcommand>

where <subcommand> can be one of:

- status - Prints the status of LM Studio
- server - Commands for managing the local server
- ls - List all downloaded models
- ps - List all loaded models
- load - Load a model
- unload - Unload a model
- create - Create a new project with scaffolding
- log - Log operations. Currently only supports streaming logs from LM Studio via `lms log stream`
- version - Prints the version of the CLI
- bootstrap - Bootstrap the CLI

For more help, try running `lms <subcommand> --help`

lms 采用 MIT 许可证,并在 GitHub 上的此仓库中开发。

https://github.com/lmstudio-ai/lms

使用 lms 自动化和调试您的工作流程

启动和停止本地服务器

lms server start
lms server stop

列出机器上的本地模型

lms ls

这会反映当前的 LM Studio 模型目录,您可以在应用中的📂 我的模型选项卡中设置该目录。

列出当前加载的模型

lms ps

加载模型(带选项)

lms load [--gpu=max|auto|0.0-1.0] [--context-length=1-N]

--gpu=1.0 意味着“尝试将 100% 的计算量卸载到 GPU”。

  • 可选地,为您的本地 LLM 分配一个标识符
lms load TheBloke/phi-2-GGUF --identifier="gpt-4-turbo"

如果您想保持模型标识符一致,这会很有用。

卸载模型

lms unload [--all]

使用 lms log stream 调试您的提示

lms log stream 允许您检查发送到模型的精确输入字符串。

这对于调试提示模板问题和其他意外的 LLM 行为特别有用。

$ lms log stream
I Streaming logs from LM Studio

timestamp: 5/2/2024, 9:49:47 PM
type: llm.prediction.input
modelIdentifier: TheBloke/TinyLlama-1.1B-1T-OpenOrca-GGUF/tinyllama-1.1b-1t-openorca.Q2_K.gguf
modelPath: TheBloke/TinyLlama-1.1B-1T-OpenOrca-GGUF/tinyllama-1.1b-1t-openorca.Q2_K.gguf
input: "Below is an instruction that describes a task. Write a response that appropriately completes the request.
#### Instruction:
Hello, what's your name?
#### Response:
"

lmstudio.js

lms 使用 lmstudio.js 与 LM Studio 交互。

您可以构建自己的程序,实现 lms 的功能以及更多。

lmstudio.js 目前处于预发布公开 alpha 阶段。请在 GitHub 上关注:https://github.com/lmstudio-ai/lmstudio.js


LM Studio Discord 服务器上的新 #dev-chat 频道中讨论所有关于 lmslmstudio.js 的内容。

https://lm-studio.cn 下载适用于 Mac / Windows / Linux 的 LM Studio。

LM Studio 0.2.22 AMD ROCm - 技术预览版可在 https://lm-studio.cn/rocm 获取

LM Studio 在 Twitter 上:https://twitter.com/lmstudio