[`snapshot_download`] downloads the latest revision by default. If you want a specific repository revision, use the
`revision` parameter:

```python
>>> from huggingface_hub import snapshot_download
>>> snapshot_download(repo_id="lysandre/arxiv-nlp", revision="refs/pr/1")
```

### Filter files to download

[`snapshot_download`] provides an easy way to download a repository. However, you don't always want to download the
entire content of a repository. For example, you might want to prevent downloading all `.bin` files if you know you'll
only use the `.safetensors` weights. You can do that using `allow_patterns` and `ignore_patterns` parameters.

These parameters accept either a single pattern or a list of patterns. Patterns are Standard Wildcards (globbing
patterns) as documented [here](https://tldp.org/LDP/GNU-Linux-Tools-Summary/html/x11655.htm). The pattern matching is
based on [`fnmatch`](https://docs.python.org/3/library/fnmatch.html).

For example, you can use `allow_patterns` to only download JSON configuration files:

```python
>>> from huggingface_hub import snapshot_download
>>> snapshot_download(repo_id="lysandre/arxiv-nlp", allow_patterns="*.json")
```

On the other hand, `ignore_patterns` can exclude certain files from being downloaded. The
following example ignores the `.msgpack` and `.h5` file extensions:

```python
>>> from huggingface_hub import snapshot_download
>>> snapshot_download(repo_id="lysandre/arxiv-nlp", ignore_patterns=["*.msgpack", "*.h5"])
```

Finally, you can combine both to precisely filter your download. Here is an example to download all json and markdown
files except `vocab.json`.

```python
>>> from huggingface_hub import snapshot_download
>>> snapshot_download(repo_id="gpt2", allow_patterns=["*.md", "*.json"], ignore_patterns="vocab.json")
```

## Download file(s) to local folder
The context provides a clear explanation of how to download a specific revision of a repository using the `snapshot_download` function. It explicitly mentions the use of the `revision` parameter and provides a code example demonstrating its usage. This directly answers the question posed.


This question is quite useful for machine learning developers working with the Hugging Face ecosystem, particularly those who need to manage different versions of models or datasets. The `snapshot_download` function is a part of the Hugging Face `transformers` library, which allows users to download specific revisions of repositories. Understanding how to use this function effectively can help developers ensure they are working with the correct version of a model or dataset, which is crucial for reproducibility and consistency in experiments. Therefore, this question is relevant and practical for developers in this field.


The question is clear and specific about what is being asked. It refers to downloading a specific revision of a repository using a particular function, `snapshot_download`. While it mentions a function name, which might be technical, it does not rely on any additional context or external information to be understood. An operator with access to documentation or knowledge of the function can understand and answer the question without needing further context.

