You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/hub/datasets-upload-guide-llm.md
+17-10Lines changed: 17 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,9 @@
6
6
7
7
> Decision guide for uploading datasets to Hugging Face Hub. Optimized for Dataset Viewer compatibility and integration with the Hugging Face ecosystem.
8
8
9
+
> [!TIP]
10
+
> If you're an LLM or agent following this guide, check `hf --help` and `hf <command> --help` (e.g. `hf upload --help`, `hf auth --help`) for the exact flags before running upload commands. The CLI matches the installed `huggingface_hub` version, so prefer its output over flags recalled from memory.
11
+
9
12
## Overview
10
13
11
14
Your goal is to help a user upload a dataset to the Hugging Face Hub. Ideally, the dataset should be compatible with the Dataset Viewer (and thus the `load_dataset` function) to ensure easy access and usability. You should aim to meet the following criteria:
@@ -95,10 +98,10 @@ See https://huggingface.co/docs/hub/storage-limits#repository-limitations-and-re
95
98
| **Video files** | Use [videofolder](https://huggingface.co/docs/datasets/en/video_load#videofolder) for automatic organization | `load_dataset("videofolder", data_dir="./videos").push_to_hub("username/dataset")` |
96
99
| **PDF documents** | Use [pdffolder](https://huggingface.co/docs/datasets/en/document_dataset#pdffolder) for text extraction | `load_dataset("pdffolder", data_dir="./pdfs").push_to_hub("username/dataset")` |
97
100
| **Very large datasets (100GB+)** | Use `max_shard_size` to control memory usage | `dataset.push_to_hub("username/dataset", max_shard_size="5GB")` |
98
-
| **Many files / directories (>10k)** | Use upload_large_folder to avoid Git limitations | `api.upload_large_folder(folder_path="./data", repo_id="username/dataset", repo_type="dataset")` |
99
-
| **Streaming large media** | WebDataset format for efficient streaming | Create .tar shards, then `upload_large_folder()` |
| Commit size | <100 files*|`upload_folder`/`hf upload` auto-split large folders into multiple commits |
77
77
| Commits per repo | - | upload multiple files per commit and/or squash history |
78
78
79
79
_\* Not relevant when using `git` CLI directly_
@@ -113,8 +113,7 @@ git operation (addition or delete) is checked by the server. When a hundred Larg
113
113
each file is checked individually to ensure it's been correctly uploaded. When pushing data through HTTP,
114
114
a timeout of 60s is set on the request, meaning that if the process takes more time, an error is raised. However, it can
115
115
happen (in rare cases) that even if the timeout is raised client-side, the process is still
116
-
completed server-side. This can be checked manually by browsing the repo on the Hub. To prevent this timeout, we recommend
117
-
adding around 50-100 files per commit.
116
+
completed server-side. This can be checked manually by browsing the repo on the Hub. The [`upload_folder`](https://huggingface.co/docs/huggingface_hub/main/en/guides/upload) method and `hf upload` command avoid this automatically by splitting large folders into multiple commits. If you commit manually, keep around 50-100 files per commit.
0 commit comments