# Hugging Face Mirror (ML models, model hub) in Iran

Canonical: https://mirror.rasanegaar.com/guides/en/hf.html
Language: en

Hugging Face mirror for ML model, dataset and transformer downloads from Iran — mirror.rasanegaar.com/hf/

Hugging Face mirror (ML models, model hub) — Download Hugging Face models and datasets from Iran — point huggingface_hub and transformers at mirror.rasanegaar.com/hf/.

## About

Hugging Face hosts ML models, tokenizers, and datasets; files are often multi-gigabyte.
Rasanegaar Mirror exposes the same API in Iran — using standard clients like huggingface_hub and transformers.

## Mirror in Iran

Endpoint: `https://mirror.rasanegaar.com/hf/` — same path on `repository.rasanegaar.com/hf/`.
There is no separate “request a model” form: a successful CLI download caches that model for everyone.
Landing page: `/repos/hf/`.

Browse URL: https://mirror.rasanegaar.com/hf/

## Configuration

1. Install the client:
pip install -U huggingface_hub
2. Set environment variables (in `~/.bashrc` or before each command):
export HF_ENDPOINT=https://mirror.rasanegaar.com/hf
export HF_HUB_ETAG_TIMEOUT=86400
export HF_HUB_DOWNLOAD_TIMEOUT=86400
3. Download a public model:
huggingface-cli download google-bert/bert-base-uncased
4. Gated models (e.g. Llama) need a token — set your Hugging Face token:
export HF_TOKEN=
5. In Python / `transformers`, before importing:
import os
os.environ.setdefault("HF_ENDPOINT", "https://mirror.rasanegaar.com/hf")
from transformers import AutoModel, AutoTokenizer
6. Quick connectivity check:
curl -s "https://mirror.rasanegaar.com/hf/api/models/google-bert/bert-base-uncased" | head

## Updates

**Ollama** does not use this endpoint as a built-in download source. Fetch GGUF files with `huggingface-cli` via the mirror, then `ollama create` from the local path.
**LM Studio** often ignores `HF_ENDPOINT` in the GUI. Download with the CLI first, then open the local folder in LM Studio.
Each successful CLI download makes that model available for later requests through the mirror.

## Related

Registry landing: https://mirror.rasanegaar.com/repos/hf/en/
Guide HTML: https://mirror.rasanegaar.com/guides/en/hf.html
