Skip to contents

Builds the specification that lets llm_local_install() download any GGUF model file from a Hugging Face repository, in addition to the models it knows by name (llm_local_models()). The file is pinned to a commit and verified by its sha256; when revision or sha256 is not supplied, both are read from the Hugging Face API at install time and then recorded, so later sessions use exactly the same file.

Usage

llm_local_model(
  repo,
  file,
  name = NULL,
  kind = c("chat", "embedding"),
  revision = "main",
  sha256 = NULL,
  size = NULL,
  license = NULL,
  ctx = NULL,
  prefixes = NULL,
  default_task = NULL,
  base = FALSE
)

Arguments

repo

Hugging Face repository, such as "Qwen/Qwen3-1.7B-GGUF".

file

Name of the .gguf file within the repository.

name

Name to refer to the model by in llm_config(); by default the file name without its extension, in lower case.

kind

"chat" for a generative model or "embedding".

revision

A commit hash, or a branch name such as "main", which is resolved to its current commit at install time.

sha256, size

The expected sha256 and size in bytes of the file; read from Hugging Face when NULL.

license

License name shown before download; read from the repository's metadata when NULL.

ctx

Context length to start the server with.

prefixes

For embedding models, a named character vector mapping task names to the prefix the model expects (see the model's card).

default_task

The task used when llm_config() names none.

base

TRUE for a pretrained model without instruction tuning.

Value

An llmr_local_model specification.

Examples

spec <- llm_local_model("Qwen/Qwen3-1.7B-GGUF", "Qwen3-1.7B-Q8_0.gguf")
spec$name