This guide will show you how to download datasets and models from a Hugging Face repository.
Before you begin, ensure you have installed the huggingface_hub
library:
pip install huggingface_hub
You can clone an entire repository using git clone
command:
git clone https://huggingface.co/datasets/d4rk3r/invoices
To download a specific file from a repository, use the hf_hub_download()
function, replace path/to/file
to actual file path:
from huggingface_hub import hf_hub_download
file_path = hf_hub_download(repo_id="d4rk3r/invoices", filename="path/to/file", repo_type="dataset")
To download an entire repository, use the snapshot_download()
function:
from huggingface_hub import snapshot_download
folder_path = snapshot_download(repo_id="d4rk3r/invoices", repo_type="dataset")