skip to content

With LM Studio's lms CLI, how do you download a model, tell disk from memory, and import a GGUF you already have?

level: juniorimportance: should knowfreq 8%

answer

  1. two inventories, two commands
  2. downloads land in the models directory
  3. name@quant picks one download
  4. ls for disk, ps for memory
  5. import moves unless told otherwise

basics

~20 s

lms get downloads into LM Studio's models directory and lms ls lists what is on disk; lms load and lms ps load and list what is in memory; lms import adopts an existing file, moving it unless you pass --copy.

solid answer

~40 s

LM Studio keeps two inventories and `lms` has a command for each. `lms get <model>` searches and downloads into the LM Studio models directory; append `@<quant>` (for example `llama-3.1-8b@q4_k_m`) to pick one download option, and `--mlx` or `--gguf` to filter formats. `lms ls` lists everything downloaded, with size and architecture; `lms ps` lists only what is loaded in memory right now. `lms load <model_key>` puts a downloaded model into memory and `lms unload <model_key>` (or `--all`) takes it out. A GGUF you already have goes in with `lms import <file>`, which **moves** the file by default: add `--copy`, `--hard-link` or `--symbolic-link` to keep the original, and `--dry-run` to preview where it would land.

go deeper

for a junior

Recall the pairs: lms get downloads, lms ls lists disk, lms load and lms ps handle memory, lms unload frees it. Know that lms import moves the file unless you ask it to copy or link.

for a middle

Explain the disk-versus-memory split and why a server can report no model while lms ls lists twenty. Show name@quant for one download option and --json output for scripts.

for a senior

Show how you keep a build pipeline and LM Studio from fighting over the same GGUF, using a link or copy on import, and how you query loaded state with lms ps --json before routing traffic.

for a principal

Weigh where model files should live on shared machines: one models directory fed by import links from a controlled store, or every user pulling their own copies with lms get.

## Two inventories: disk and memory LM Studio separates **downloaded** models (files in its models directory) from **loaded** models (instances sitting in RAM or VRAM, ready to answer). Most beginner confusion with the `lms` command-line tool comes from mixing the two up: a model can be on disk for months without using a byte of memory, and a model is only usable by the local server or the SDKs once it is loaded (or loaded on demand by the server, which is a separate subject). | Question you are asking | Command | What it shows | |---|---|---| | What have I downloaded? | `lms ls` | every model on disk, with params, architecture and size | | What is in memory now? | `lms ps` | only loaded instances, by identifier | | Put one into memory | `lms load <model_key>` | loads it and prints the identifier to use in API calls | | Take it out | `lms unload <model_key>` / `lms unload --all` | frees the memory | `lms ls` takes `--llm` or `--embedding` to filter by type and `--json` for scripts. `lms ps` also takes `--json`. ## Downloading with `lms get` `lms get` searches online model repositories and downloads into the LM Studio models directory. With no argument it shows staff picks. - `lms get llama-3.1-8b` resolves a name and downloads a suitable option. - `lms get llama-3.1-8b@q4_k_m` names one specific quantization of a model that has several (what the label means is a question about GGUF quant types, not about `lms`). - `--mlx` or `--gguf` restricts results to that format; without either, results match the runtimes you have installed. - `--always-show-download-options` (`-a`) makes it prompt for the quantization even when one is auto-selected; `--yes` (`-y`) does the opposite and accepts the preselected option, which is what a script wants. ## Loading and unloading `lms load <model_key>` takes the key that `lms ls` prints. When it finishes it tells you the identifier to use in the API or SDK. If you omit the key, it opens an interactive picker. `lms unload` with no key also prompts; `lms unload --all` clears everything. The load flags (`--gpu`, `--context-length`, `--ttl`, `--identifier`, `--estimate-only`) matter once you script loads; a junior answer only needs to know they exist and that settings you leave out fall back to the model's saved defaults. ## Bringing your own file: `lms import` A teammate hands you a GGUF on a USB stick, or you built one yourself. `lms import <file-path>` registers it with LM Studio without downloading anything. 1. By default the file is **moved** into the models directory, so the original path stops existing. 2. `--copy` (`-c`) copies it instead; `--hard-link` (`-L`) and `--symbolic-link` (`-l`) link it. Only one of the three may be given. 3. `--user-repo <user>/<repo>` sets the target folder and skips the categorisation prompts; `--yes` tries to infer it from the file name. 4. `--dry-run` shows what would happen without doing it. The move default is the classic surprise: a build pipeline that keeps writing to `~/builds/model.gguf` finds the file gone after the first import. ## A first session, end to end A typical first run on a fresh laptop looks like this: 1. `lms get llama-3.1-8b@q4_k_m` downloads one option of the model. 2. `lms ls --llm` confirms it is on disk and shows the key to use. 3. `lms load <model_key>` loads it and prints the identifier. 4. `lms ps` confirms it is in memory; the local server or an SDK can now use it. 5. `lms unload <model_key>` frees the memory when you are done, and the file stays on disk for next time. Nothing in that sequence deletes a file: removing a download is a separate housekeeping step, and unloading is never it. ## A remote instance `lms ls`, `lms ps`, `lms load` and `lms unload` accept `--host <host>` to talk to another LM Studio instance on the network, provided it is running and reachable; the same commands then describe that machine's inventories, not yours. ## Mistakes worth avoiding - Reading `lms ls` as "what is running" and wondering why the server says no model is loaded. - Running `lms import` on the only copy of a file and losing track of it. - Expecting `--gguf` to choose a quantization; it filters formats, and `@<quant>` chooses the option.

  • How do you check from a script that a model is loaded before calling the server?
    Use `lms ps --json` and look for the identifier you expect; it lists only loaded instances, so a model that is downloaded but not loaded will not appear. `lms ls --json` answers a different question, what is on disk, and would report the model as present even when nothing is in memory.
  • Why would `lms import --symbolic-link` be the right choice for a build pipeline?
    The pipeline keeps owning the file at its own path and can overwrite it with each build, while LM Studio sees it in its models directory through the link. A move would take the file away from the pipeline, and a copy would double the disk use for a multi-gigabyte model.

  • lms ls shows the models that are currently running
  • lms import copies the file and leaves the original in place
  • --gguf picks the quantization to download
  • A downloaded model is ready for API calls without being loaded
  • lms unload deletes the model files from disk