Skip to content

Commit a8a654b

Browse files
davanstrienclaudeWauplin
authored
Align dataset upload guide + storage limits with upload_folder/hf upload multi-commit (huggingface_hub 1.20) (#2580)
* Docs: reflect upload_folder/hf upload multi-commit (huggingface_hub 1.20) upload_folder/hf upload now auto-split large folders into multiple resumable commits, so the old manual guidance has drifted: - datasets-upload-guide-llm: drop the removed `multi_commits=True` recommendation; add a note on automatic multi-commit, resumable/ idempotent re-runs, the create_pr+revision restriction, and agent/non-TTY progress behavior - storage-limits: manual "<100 files per commit" splitting is now handled automatically by upload_folder/hf upload Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * Update docs/hub/datasets-upload-guide-llm.md Co-authored-by: Lucain <lucainp@gmail.com> * Update docs/hub/datasets-upload-guide-llm.md Co-authored-by: Lucain <lucainp@gmail.com> * Update docs/hub/datasets-upload-guide-llm.md Co-authored-by: Lucain <lucainp@gmail.com> * Update docs/hub/datasets-upload-guide-llm.md Co-authored-by: Lucain <lucainp@gmail.com> * Update docs/hub/datasets-upload-guide-llm.md Co-authored-by: Lucain <lucainp@gmail.com> * Update docs/hub/datasets-upload-guide-llm.md Co-authored-by: Lucain <lucainp@gmail.com> * Update docs/hub/datasets-upload-guide-llm.md Co-authored-by: Lucain <lucainp@gmail.com> * Docs: address review — reword agent TIP, drop upload_large_folder snippet + redundant 1.20 note Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-authored-by: Lucain <lucainp@gmail.com>
1 parent e52befd commit a8a654b

2 files changed

Lines changed: 19 additions & 13 deletions

File tree

docs/hub/datasets-upload-guide-llm.md

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
> Decision guide for uploading datasets to Hugging Face Hub. Optimized for Dataset Viewer compatibility and integration with the Hugging Face ecosystem.
88
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+
912
## Overview
1013

1114
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
9598
| **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")` |
9699
| **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")` |
97100
| **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()` |
101+
| **Many files / directories (>10k)** | Use `upload_folder`/`hf upload` (handles large/many-file uploads) | `hf upload username/dataset ./data --repo-type=dataset` |
102+
| **Streaming large media** | WebDataset format for efficient streaming | Create .tar shards, then `hf upload` |
100103
| **Scientific data (HDF5, NetCDF)** | Convert to Parquet with Array features | See [Scientific Data](#scientific-data) section |
101-
| **Custom/proprietary formats** | Document thoroughly if conversion impossible | `upload_large_folder()` with comprehensive README |
104+
| **Custom/proprietary formats** | Document thoroughly if conversion impossible | `hf upload` with comprehensive README |
102105

103106
## Upload Workflow
104107

@@ -119,7 +122,7 @@ See https://huggingface.co/docs/hub/storage-limits#repository-limitations-and-re
119122

120123
- **Small files (<1GB) with hub-compatible format**: Can use [Hub UI](https://huggingface.co/new-dataset) for quick uploads
121124
- **Built-in loader available**: Use the loader + `push_to_hub()` (see Quick Reference table)
122-
- **Large datasets or many files**: Use `upload_large_folder()` for files >100GB or >10k files
125+
- **Large datasets or many files**: Use `upload_folder` / `hf upload` which handles large uploads (auto multi-commit, resumable).
123126
- **Custom formats**: Convert to hub-compatible format if possible, otherwise document thoroughly
124127

125128
4. ✓ **Test locally** (if using built-in loader):
@@ -363,16 +366,21 @@ Use when you've loaded/converted data using the datasets library
363366
dataset.push_to_hub("username/dataset", max_shard_size="5GB")
364367
```
365368

366-
**Pre-existing files (use upload_large_folder)**:
367-
Use when you have hub-compatible files (e.g., Parquet files) already prepared and organized
369+
**Pre-existing files (use `upload_folder` / `hf upload`)**:
370+
Use when you have hub-compatible files (e.g., Parquet files) already prepared and organized.
368371

369372
```python
370373
from huggingface_hub import HfApi
371374
api = HfApi()
372-
api.upload_large_folder(folder_path="./data", repo_id="username/dataset", repo_type="dataset", num_workers=16)
375+
api.upload_folder(folder_path="./data", repo_id="username/dataset", repo_type="dataset")
376+
```
377+
378+
```bash
379+
# Or from the CLI:
380+
hf upload username/dataset ./data --repo-type=dataset
373381
```
374382

375-
**Important**: Before using `upload_large_folder`, verify the files meet repository limits:
383+
**Important**: Before uploading, verify the files meet repository limits:
376384

377385
- Check folder structure if you have file access: ensure no folder contains >10k files
378386
- Ask the user to confirm: "Are your files in a hub-compatible format (Parquet/CSV/JSON) and organized appropriately?"
@@ -420,7 +428,6 @@ api.upload_large_folder(folder_path="./data", repo_id="username/dataset", repo_t
420428
| "Repository not found" | Run `hf auth login` |
421429
| Memory errors | Use `max_shard_size="500MB"` |
422430
| Dataset viewer not working | Wait 5-10min, check README.md config |
423-
| Timeout errors | Use `multi_commits=True` |
424431
| Files >50GB | Split into smaller files |
425432
| "File not found" | Use relative paths in metadata |
426433

@@ -510,7 +517,7 @@ For streaming large media datasets:
510517

511518
- Create 1-5GB tar shards
512519
- Consistent internal structure
513-
- Upload with `upload_large_folder`
520+
- Upload with `hf upload`
514521

515522
### Scientific Data
516523

docs/hub/storage-limits.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ We gathered a list of tips and recommendations for structuring your repo. If you
7373
| Files per repo | <100k | merge data into fewer files |
7474
| Entries per folder | <10k | use subdirectories in repo |
7575
| File size | <200GB | split data into chunked files |
76-
| Commit size | <100 files* | upload files in multiple commits |
76+
| Commit size | <100 files* | `upload_folder`/`hf upload` auto-split large folders into multiple commits |
7777
| Commits per repo | - | upload multiple files per commit and/or squash history |
7878

7979
_\* 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
113113
each file is checked individually to ensure it's been correctly uploaded. When pushing data through HTTP,
114114
a timeout of 60s is set on the request, meaning that if the process takes more time, an error is raised. However, it can
115115
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.
118117

119118
### Sharing large datasets on the Hub
120119

0 commit comments

Comments
 (0)