Setting up your environment this way avoids most errors on this page.
| Practice | What happens if you skip it |
|---|---|
| On networks that cannot reach huggingface.co, set HF_ENDPOINT before importing, for example export HF_ENDPOINT=https://hf-mirror.com. | Model loading fails to connect to huggingface.co or times out halfway. |
| Download the model to a local folder with hf download first, then load it from that folder in code. | Every run checks files online, and any network hiccup becomes an error. |
| For gated models, request access on the website and wait for approval before downloading with a token. | Downloads fail with 403 or 401, and switching tokens does not help. |
| Before downloading large models, set HF_HOME to a disk with enough space. | The default cache is ~/.cache/huggingface, which fills the system drive on Windows. |
| After upgrading huggingface_hub to 1.x, switch scripts to the hf command and the token argument. | Old scripts fail with huggingface-cli not found or unknown resume_download and use_auth_token arguments. |
Troubleshooting by error message
Find your exact error message. Each entry gives the cause, the fix, and what may come up after the fix.
OSError: We couldn't connect to 'https://huggingface.co' to load this file, couldn't find it in the cached files
Cause: Your network cannot reach huggingface.co and the file is not in the local cache.
Fix: Set HF_ENDPOINT=https://hf-mirror.com before importing transformers and run again; when setting it in code, put it before every import.
What may come next: The mirror does not support login, so gated models need --token on the hf download command; if the mirror returns an xet-read-token 404, also set HF_HUB_DISABLE_XET=1.
HTTPSConnectionPool(host='cdn-lfs.hf.co', port=443): Read timed out. (read timeout=10)
Cause: The download is too slow and exceeds the default 10-second read timeout.
Fix: Set HF_HUB_DOWNLOAD_TIMEOUT=60 and HF_HUB_ETAG_TIMEOUT=60 and run again; files that finished downloading are read from the cache.
What may come next: On an unstable network a longer timeout only reduces failures, and large files can still drop midway.
Max retries exceeded with url: /api/models/... (Caused by NewConnectionError ... Network is unreachable)
Cause: There is no network route from your machine to huggingface.co, typical on networks that need a proxy.
Fix: Set HTTPS_PROXY to a working proxy, or use a mirror as in the first entry.
What may come next: huggingface_hub 1.x only reads the HTTP_PROXY and HTTPS_PROXY environment variables; per-call proxies arguments in old code no longer work.
GatedRepoError: 403 Client Error. Cannot access gated repo for url https://huggingface.co/meta-llama/Llama-2-7b-hf/resolve/main/tokenizer_config.json.
Cause: This is a gated model and your account has no access yet. If the message says is awaiting a review from the repo authors, your request is still pending.
Fix: Sign in on huggingface.co and request access on the model page; once approved, log in with hf auth login or set HF_TOKEN and download again.
What may come next: Models with manual review can take days, and a rejected request means no download.
Invalid user token. The token from HF_TOKEN environment variable is invalid.
Cause: The token in HF_TOKEN was deleted, expired, or copied with extra spaces.
Fix: Create a new read token under Settings → Access Tokens on huggingface.co and set HF_TOKEN again without spaces or line breaks.
What may come next: HF_TOKEN overrides the token saved by hf auth login, so logging in again has no effect while an old variable is still set.
huggingface-cli: command not found (after upgrading huggingface_hub to 1.x)
Cause: huggingface_hub 1.0 removed huggingface-cli and replaced it with the hf command.
Fix: Use hf instead: huggingface-cli download becomes hf download, and huggingface-cli login becomes hf auth login.
What may come next: Every huggingface-cli command in tutorials and old scripts has to be rewritten.
TypeError: hf_hub_download() got an unexpected keyword argument 'resume_download'
Cause: huggingface_hub 1.0 removed the resume_download, force_filename, local_dir_use_symlinks and use_auth_token arguments.
Fix: Delete resume_download and local_dir_use_symlinks, and rename use_auth_token to token.
What may come next: Third-party libraries written for older huggingface_hub may raise the same error and need upgrading.
A warning on Windows that the cache cannot use symlinks
Cause: Windows does not let regular users create symlinks by default, so the cache has to copy files.
Fix: Turn on Developer Mode in Windows settings or run Python as administrator; to silence the message only, set HF_HUB_DISABLE_SYMLINKS_WARNING=1.
What may come next: Without it, each version of a model keeps a full copy of its files and uses more disk space.
Scientify is a cloud computer with research software installed and AI agents such as Codex and Claude Code built in. Describe what you need in one sentence, for example "embed these medical abstracts with BiomedBERT and cluster them by topic", and the agent uses the preinstalled Hugging Face to do the model download and computation, with no software to install and no code to write.
Compared with installing more on your own computer, the cloud computer reaches Hugging Face directly with no mirror, proxy or timeout settings, has transformers 5.21.0, huggingface_hub 1.32.0 and sentence-transformers 6.2.0 installed, and comes with more than ten medical and Chinese models such as BiomedBERT, MedCPT and Chinese BERT, and runs continue after you close your laptop.
The cloud computer comes with more computing power: CPU and GPU clusters can be called on demand for large-scale scientific computing. Compute is billed by the minutes you actually use, so nothing is wasted.
- Cloud computer
- 4 vCPU · 8 GB
- Top configuration, for data processing and small to medium jobs
- Callable GPU
- 96 GB VRAM
- Up to an RTX PRO 6000 per GPU; H800 80 GB and up to 8 × A10G also available
- Callable CPU
- 224 cores · 3 TB
- Largest spec, for large parallel computations
References
- Migrating to huggingface_hub v1.0 — huggingface-cli replaced by hf, removed arguments and proxy settings
- huggingface_hub environment variables — HF_HOME, HF_TOKEN, HF_HUB_DOWNLOAD_TIMEOUT defaults to 10s
- huggingface_hub cache management — Windows symlinks and Developer Mode
- Hugging Face gated models — Requesting access, manual review and authenticated downloads
- hf-mirror.com — HF_ENDPOINT usage, --token for gated models, HF_HUB_DISABLE_XET
- Hugging Face Forums: offline error — We couldn't connect to 'https://huggingface.co'
- Hugging Face Forums: ReadTimeoutError — Read timeouts on cdn-lfs.hf.co
- Hugging Face Forums: How to use gated models — Gated repo 403 and pending review
- Hugging Face Forums: 401 Unauthorized — 401 and Repository not found
- Hugging Face Forums: persistent 401 on gated models — Invalid user token