llama_load_model_hf: Load a model directly from Hugging Face

View source: R/hf.R

llama_load_model_hfR Documentation

Load a model directly from Hugging Face

Description

Convenience function that downloads a GGUF model from Hugging Face (if not already cached) and loads it via llama_load_model.

Usage

llama_load_model_hf(repo_id, ..., n_gpu_layers = 0L)

Arguments

repo_id

Character. Hugging Face repository in "org/repo" format.

...

Additional arguments passed to llama_hf_download (e.g. pattern, cache_dir, force).

n_gpu_layers

Integer. Number of layers to offload to GPU. Use -1L for all layers. Defaults to 0L (CPU only).

Value

An external pointer to the loaded model, as returned by llama_load_model.

Examples

## Not run: 
model <- llama_load_model_hf("TheBloke/Llama-2-7B-GGUF",
                              pattern = "*q2_k*")

## End(Not run)

llamaR documentation built on May 28, 2026, 1:06 a.m.