Skip to content
,

How to Download Models From Hugging Face: Browser, hf CLI, Python and Apps (2026)

7–11 minutes
Excited woman in a teal blazer in a server room holding a HUGGING FACE card, with the hook Download any AI model fast

Almost every open AI model, from Qwen and Gemma to Flux and Whisper, lives on Hugging Face. Downloading one sounds simple, but beginners hit the same walls: which file to pick, “401 Unauthorized” on gated models, 50 GB repos filling the C: drive, and downloads that crawl or fail at 99%.

This guide shows every way to download models from Hugging Face in 2026: the website, the new hf command line, Python, and straight from apps like LM Studio, Ollama and ComfyUI.

You will also learn how tokens work, where files are saved, how to move the cache and how to clean it up. Commands are checked against the official huggingface_hub docs as of November 2026.

TL;DR

  • One file in the browser: model page > Files and versions > click the download icon next to the file.
  • Best tool: the hf CLI. Install with pip install -U huggingface_hub, brew install hf or the one-line installer.
  • Download: hf download user/model file.gguf --local-dir ./models
  • Gated models (Llama, some Gemma): accept the licence on the model page, create a Read token, run hf auth login.
  • Cache: ~/.cache/huggingface/hub by default. Move it with the HF_HOME environment variable.
  • Clean up: hf cache ls, hf cache rm model/name, hf cache prune.

How to Read a Hugging Face Model Page

Every model has an address like huggingface.co/owner/model-name. That owner/model-name part is the repo ID you use in commands.

Tab or area What it tells you
Model card What the model does, licence, hardware needs, example code
Files and versions Every file with its size; this is where you download
Licence banner “You need to agree to share your contact information” means the model is gated
Quantizations / model tree Links to GGUF and other smaller versions made by the community
Use this model One-click snippets for LM Studio, Ollama, llama.cpp and other apps

Tip: official repos usually hold the full-size Safetensors weights. For running on a home PC, look for a GGUF repo of the same model, often from well-known community quantizers.

Which File Should You Download?

File type Used by When to pick it
.gguf LM Studio, Ollama, llama.cpp, ComfyUI-GGUF Running LLMs on a normal PC or Mac; pick one quant (e.g. Q4_K_M)
.safetensors ComfyUI, Python (Transformers, Diffusers), vLLM Image/video models, full-quality LLMs, LoRAs
MLX folders LM Studio and mlx-lm on Apple Silicon Fast inference on M-series Macs
.bin / .pt / .ckpt Older tools Avoid unless you trust the source; these can contain code

For GGUF, you only need one quant file, not the whole repo. Q4_K_M is the usual sweet spot; Q5_K_M or Q6_K if you have spare VRAM. Our GGUF quantization guide explains every letter, and the VRAM guide tells you what fits.

Method 1: Download in the Browser

  1. Open the model page on huggingface.co.
  2. Click “Files and versions”.
  3. Find the file you need and check its size.
  4. Click the download arrow next to the file name.
  5. Move the file to the folder your app expects (for example ComfyUI’s models/checkpoints).

Good for one or two files. For big files, browsers often stall or restart from zero, so the CLI is safer.

Method 2: The hf Command Line (Best)

The old huggingface-cli has been replaced by the shorter hf command. It resumes broken downloads, downloads in parallel and uses Hugging Face’s faster Xet storage backend.

Install

Method Command
pip (any system with Python) pip install -U "huggingface_hub"
Mac/Linux installer curl -LsSf https://hf.co/cli/install.sh | bash
Windows PowerShell installer powershell -ExecutionPolicy ByPass -c "irm https://hf.co/cli/install.ps1 | iex"
Homebrew brew install hf
No install (uv) uvx hf download ...

Check it works with hf --help or hf version. Update later with hf update.

Common downloads

# One file into a folder you choose
hf download Qwen/Qwen3-8B-GGUF Qwen3-8B-Q4_K_M.gguf --local-dir ./models

# Whole repo into the cache
hf download HuggingFaceH4/zephyr-7b-beta

# Only some files, using patterns
hf download stabilityai/stable-diffusion-xl-base-1.0 --include "*.safetensors" --exclude "*.fp16.*"

# A file inside a subfolder
hf download HiDream-ai/HiDream-I1-Full text_encoder/model.safetensors

# A specific branch, tag or commit
hf download owner/model --revision v1.1

# See what would download, without downloading
hf download openai-community/gpt2 --dry-run

The repo and file names in the first line are examples; copy the exact names from the model’s Files tab. The command prints the final path on its last line, and --quiet prints only the path (handy in scripts).

Option What it does
--local-dir PATH Saves real files to a folder instead of the shared cache
--include / --exclude Download only matching files (saves tens of GB)
--revision Pick a branch, tag or commit
--repo-type dataset Download datasets (or space for Spaces)
--cache-dir PATH Use a different cache for this command
--dry-run Preview the download list and size

Gated Models, Tokens and Login

Some models (many Llama releases, some Gemma and Flux versions) require you to accept a licence first. Without that, downloads fail with 401 or 403 errors.

  1. Create a free Hugging Face account and sign in.
  2. Open the gated model page and fill in the form or click the button to agree to the licence. Some approve instantly, others take hours.
  3. Create a token: profile picture > Settings > Access Tokens > create a token. A Read token is enough for downloads.
  4. Log in on your PC: run hf auth login. It shows a link and code to approve in your browser, or you can paste the token.
  5. Check: hf auth whoami shows your username.
  6. Download as normal with hf download.

For scripts, set the token as the HF_TOKEN environment variable instead of typing it, and never paste tokens into public code or chats. Note that hf auth logout does not log you out while HF_TOKEN is set.

Method 3: Download With Python

from huggingface_hub import hf_hub_download, snapshot_download

# One file
path = hf_hub_download(repo_id="openai-community/gpt2", filename="config.json")
print(path)

# Whole repo, only safetensors files
folder = snapshot_download(repo_id="owner/model", allow_patterns=["*.safetensors", "*.json"])
print(folder)

Libraries like Transformers and Diffusers call these functions automatically the first time you load a model, which is why the cache can grow without you noticing.

Method 4: Download From Inside Apps

App How to get a Hugging Face model
LM Studio Discover tab: search a name or paste the Hugging Face URL, then pick a quant
Ollama ollama run hf.co/owner/repo-GGUF:Q4_K_M for GGUF repos, or import a file with a Modelfile
llama.cpp llama-server -hf owner/repo-GGUF:Q4_K_M downloads and runs in one step (see our llama.cpp guide)
ComfyUI Download files with hf download ... --local-dir ComfyUI/models/<folder>, or use ComfyUI’s model downloader prompts

For ComfyUI folder names, see how to install ComfyUI.

Where Files Go and How to Move the Cache

System Default cache
Windows C:\Users\<you>\.cache\huggingface\hub
Mac / Linux ~/.cache/huggingface/hub

Inside, each model gets a folder like models--owner--name/snapshots/<hash>/. Apps that use the cache share files, so the same model is not downloaded twice.

Move the cache to another drive

  1. Pick a folder on a big drive, for example D:\hf.
  2. Windows: run setx HF_HOME "D:\hf", then open a new terminal.
  3. Mac/Linux: add export HF_HOME=/data/hf to your ~/.bashrc or ~/.zshrc.
  4. Optional: move the old hub folder into the new location to keep existing downloads.
  5. Check with hf env, which prints the paths in use.

Free Up Space: Clean the Cache

# See what is taking space
hf cache ls --sort size:desc --limit 10

# Remove one model completely
hf cache rm model/gpt2

# Preview first, or skip the prompt
hf cache rm model/gpt2 --dry-run
hf cache rm model/gpt2 --yes

# Remove old revisions, broken partial files and orphan blobs
hf cache prune

# Check files are not corrupted
hf cache verify gpt2

Safety: Is It Safe to Download Models?

  • Prefer .safetensors and .gguf. They store weights only. Old pickle formats (.bin, .pt, .ckpt) can run code when loaded.
  • Prefer official or well-known uploaders. Check downloads, likes and the model tree.
  • Be careful with trust_remote_code=True in Python; it runs code from the repo.
  • Read the licence. Some models are non-commercial or have use restrictions.

Troubleshooting

Problem Fix
401 / 403 / “gated repo” Accept the licence on the model page, then hf auth login with a Read token
command not found: hf Reinstall, open a new terminal, or run with uvx hf; old installs only have huggingface-cli
Timeouts on slow internet Set HF_HUB_DOWNLOAD_TIMEOUT=30 and rerun; downloads resume
C: drive full Use --local-dir on another drive or set HF_HOME
Downloaded the whole repo by mistake Use --include "*Q4_K_M*.gguf" next time; clean with hf cache rm
App cannot find the model Cache files sit in hashed folders; use --local-dir to get plain files in the app’s folder
Corrupted file errors Run hf cache verify and re-download
Corporate network blocks Xet Try HF_HUB_DISABLE_XET=1

My Take

Install the hf CLI once and you will never fight browser downloads again. Use --local-dir plus --include to grab exactly the file you need into the right folder.

Set HF_HOME to a big drive on day one, and run hf cache ls every few weeks before your disk fills up.

FAQ

Is downloading models from Hugging Face free?

Yes. Public and gated models are free to download; you only need a free account for gated ones.

Do I need an account to download?

Not for public models. Gated models need an account, an accepted licence and a token.

What replaced huggingface-cli?

The hf command, for example hf download and hf auth login.

Where does Hugging Face save models on Windows?

In C:\Users\<you>\.cache\huggingface\hub unless you set HF_HOME or use --local-dir.

How do I download only one GGUF file?

Name the file: hf download owner/repo-GGUF model-Q4_K_M.gguf --local-dir ./models.

Can I resume a failed download?

Yes. Run the same hf download command again and it continues.

How do I delete downloaded models?

Use hf cache ls to find them and hf cache rm model/name to remove them, or delete your --local-dir folder.

Sources

Free weekly email

Get new AI guides every week

One short weekly email with our newest local AI, ComfyUI and AI tool guides. No spam, no pop-ups, just the good stuff.

Free. Unsubscribe anytime in one click. We only use your email to send this newsletter. See our privacy policy.

Excited woman in a teal blazer in a server room holding a HUGGING FACE card, with the hook Download any AI model fast