> This page is for version 26.07 · v1.3.0.
> For other versions, use one of these documentation indexes:
> - Latest · v1.4.0 (26.09) (default): https://docs.nvidia.com/nemo/curator/latest/llms.txt
> - Main · preview: https://docs.nvidia.com/nemo/curator/main/llms.txt
> - 26.09 · v1.4.0: https://docs.nvidia.com/nemo/curator/v26.09/llms.txt
> - 26.07 · v1.3.0: https://docs.nvidia.com/nemo/curator/v26.07/llms.txt
> - 26.04 · v1.2.0: https://docs.nvidia.com/nemo/curator/v26.04/llms.txt
> - 26.02 · v1.1.0: https://docs.nvidia.com/nemo/curator/v26.02/llms.txt
> - 25.09 · v1.0.0: https://docs.nvidia.com/nemo/curator/v25.09/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo/curator/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo/curator/_mcp/server.

# nemo_curator.utils.hf_download_utils

## Module Contents

### Functions

| Name                                                                                     | Description                         |
| ---------------------------------------------------------------------------------------- | ----------------------------------- |
| [`download_model_from_hf`](#nemo_curator-utils-hf_download_utils-download_model_from_hf) | Download a model from Hugging Face. |

### API

```python
nemo_curator.utils.hf_download_utils.download_model_from_hf(
    model_id: str,
    local_dir: str | pathlib.Path,
    ignore_patterns: list[str] | None = None,
    filename: str | None = None,
    revision: str | None = None
) -> None
```

Download a model from Hugging Face.

This function downloads either a specific file or the entire model repository
from Hugging Face Hub to a local directory.

**Parameters:**

**`model_id`** `str`

The Hugging Face model identifier (e.g., 'gpt2', 'bert-base-uncased')

---

**`local_dir`** `str | Path`

Local directory where the model will be downloaded

---

**`ignore_patterns`** `list[str] | None` — default: None

List of glob patterns to ignore when downloading.
Only used when filename is not provided. Defaults to None.

---

**`filename`** `str | None` — default: None

Specific file to download from the repository.
If provided, only this file will be downloaded and ignore\_patterns will be ignored.
Defaults to None.

---

**`revision`** `str | None` — default: None

Git revision (branch, tag, or commit hash) to download.
Defaults to None (latest main branch).

---

**Raises:**

* `ValueError`: If both filename and ignore\_patterns are provided (not supported).

**Examples:**

```python
# Download entire model repository
download_model_from_hf('gpt2', './models/gpt2')

# Download specific file
download_model_from_hf('gpt2', './models/gpt2', filename='config.json')

# Download with ignore patterns
download_model_from_hf('gpt2', './models/gpt2',
                      ignore_patterns=['*.bin', '*.safetensors'])

# Download specific revision
download_model_from_hf('gpt2', './models/gpt2', revision='main')
```