Almost every open AI model, from chat models to image generators, is published on Hugging Face. Apps like LM Studio can download from it for you, but sooner or later you'll want a model or a file your app doesn't list, or you'll want to put large downloads on a different drive. This guide covers the official way to do it, based on Hugging Face's documentation.
Before you start: pick the right file
A model repository often contains many files, and you rarely need all of them.
For llama.cpp, LM Studio and similar apps, you usually want a single GGUF file. Hugging Face describes GGUF as a binary format optimised for quick loading and saving of models, designed for use with GGML and other executors, and created by the developer of llama.cpp. GGUF repositories typically offer several quantisation levels; our GGUF quantisation explainer explains which to choose, and how much VRAM you need depends on that choice and the context length.
For Python tools such as Transformers or ComfyUI, you'll usually want safetensors files. See GGUF vs safetensors for the difference.
Check the file sizes in the repository's file list before downloading. Large models can run to tens of gigabytes, so make sure you have space (see how much storage you need for local AI).
Hugging Face's CLI documentation lists a standalone installer as the recommended method. On Windows, run this in PowerShell:
powershell -ExecutionPolicy ByPass -c "irm https://hf.co/cli/install.ps1 | iex"
If you already use Python, you can instead install it with pip install -U "huggingface_hub". Hugging Face says you can update later with hf update.
Step 2: Download a single file
To download one file, give the repository name and the file name:
hf download gpt2 config.json
That's Hugging Face's own example. For a model, replace them with the repository ID (shown at the top of the model page, in the form organisation/model-name) and the exact GGUF file name from the repository's file list. The command prints the path of the downloaded file on its last line.
Step 3: Download several files, or filter by pattern
If you want a subset of a repository, Hugging Face's documentation shows two methods. List the files one after another:
hf download gpt2 config.json model.safetensors
Or use --include and --exclude patterns. Hugging Face's example downloads all safetensors files from Stable Diffusion XL except the FP16 versions:
hf download stabilityai/stable-diffusion-xl-base-1.0 --include "*.safetensors" --exclude "*.fp16.*"
Running hf download with only a repository ID downloads the whole repository, which is rarely what you want for GGUF models with many quantisations.
Step 4: Choose where files go
By default, files go into Hugging Face's cache. The documentation gives the default cache location as ~/.cache/huggingface/hub (on Windows, that's inside your user folder), and says you can change it with the HF_HOME or HF_HUB_CACHE environment variables, or per download with --cache-dir.
If you'd rather put a file in a normal folder, for example on a second SSD where your app looks for models, use --local-dir:
hf download adept/fuyu-8b model-00001-of-00002.safetensors --local-dir fuyu
Hugging Face notes that a small .cache/huggingface folder is created inside that directory to track what's already been downloaded, so files aren't fetched again if they're up to date.
One Windows note from the documentation: the cache normally uses symlinks, which aren't supported on all machines, especially on Windows. When they're not available, files are stored directly and the cache still works, but it can be less efficient, because the same file may be downloaded more than once across different revisions of a repository.
Step 5: Gated models need a login
Some models are "gated": the authors ask you to accept terms before downloading. Hugging Face's documentation says you need to be logged in to a Hugging Face account and request access from your browser on the model's page. Once you have access, log the CLI in with:
hf auth login
The CLI then uses the saved token for downloads, or you can pass one with --token.
Step 6: Manage and clean up the cache
Model files add up quickly. The CLI includes cache commands: hf cache ls lists what's stored, hf cache rm removes specific items and hf cache prune removes unreferenced revisions.
Stay safe: prefer safetensors and GGUF
Hugging Face's security documentation warns that pickle, the default format for PyTorch model weights, can be used for arbitrary code execution attacks when a file is loaded, and suggests loading models from users and organisations you trust. It also points to safetensors, a newer serialisation format for weights. In practice, stick to GGUF or safetensors files from reputable uploaders, and be wary of repositories that only offer pickle-based files.
Our verdict
The hf command-line tool is the most reliable way to get models from Hugging Face: download only the GGUF or safetensors files you need, use --local-dir to put them on the drive your app uses, and log in only when a model is gated. If you'd rather avoid the command line, LM Studio's built-in search is easier; our guide to choosing models in LM Studio covers that route, and our best local LLM models list suggests what to download first.