File size: 5,997 Bytes
7522066 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | # ContentVault
Content packs for [Lucky Robots](https://luckyrobots.com). Each pack contains a `metadata.yaml`, a `thumbnail.png`, and a `.zip` with the pack contents.
## Content Packs
| Pack | Description |
|------|-------------|
| ExamplePack | Example content pack |
| Go1VelocityTracking | Unitree Go1 velocity tracking |
| MujocoExample | MuJoCo simulation example |
| Oscillator | Oscillator environment |
| Panda | Franka Panda robot |
| Piper | Piper robot |
| Piper-Pick-Place | Piper pick and place task |
| PiperUnscrewCap | Piper cap unscrewing task |
| Skies-Vol-1 | Sky HDRIs volume 1 |
| TheBungalow | Bungalow environment |
| TheLoft | Loft environment |
| TheOffice | Office environment |
| UnitreeG1 | Unitree G1 humanoid |
| UnitreeGo1 | Unitree Go1 quadruped |
| Welcome | Welcome / intro pack |
## CDN
All content packs are served globally via Cloudflare CDN:
```
https://contentvault.luckyrobots.com/{PackName}/{filename}
```
For example:
```
https://contentvault.luckyrobots.com/ExamplePack/metadata.yaml
https://contentvault.luckyrobots.com/TheLoft/TheLoft.zip
```
## How sync works
A Cloudflare Worker (`worker/`) listens for webhooks from HuggingFace. When a push is made to the [HuggingFace dataset repo](https://huggingface.co/datasets/luckyrobots/ContentVault), the Worker:
1. Lists all files in the repo via the HuggingFace API
2. Streams each file directly to Cloudflare R2 (no buffering, handles large zip files)
3. R2 serves the files through Cloudflare's CDN with a 30-day cache, cached at 300+ edge locations worldwide
## Worker setup
```bash
cd worker
npm install
```
### Secrets (set via wrangler)
```bash
npx wrangler secret put HF_WEBHOOK_SECRET
npx wrangler secret put HF_TOKEN
```
### Deploy
```bash
npx wrangler deploy
```
### Commands
## Setup
```bash
# Install huggingface_hub with fast upload backend
pip install -U "huggingface_hub[hf_xet]"
# Login (requires write-access token from https://huggingface.co/settings/tokens)
hf auth login
```
---
## CLI Commands
### Upload entire folder
```bash
hf upload <repo-id> <local-folder> . --repo-type dataset --commit-message "Your message"
```
### Upload a single pack/subfolder
```bash
hf upload <repo-id> <local-folder>/<pack-name> <pack-name> --repo-type dataset --commit-message "Add <pack-name>"
```
### Upload a single file
```bash
hf upload <repo-id> <local-file> <path-in-repo> --repo-type dataset --commit-message "Add file"
```
### Upload large folder (resumable, multi-threaded, auto-retry)
```bash
hf upload-large-folder <repo-id> <local-folder> --repo-type=dataset
```
### Delete files remotely (without re-uploading everything)
```bash
hf upload <repo-id> . . --repo-type dataset --include="" --delete="<folder-name>/*" --commit-message "Remove <folder-name>"
```
### Create a new dataset repo
```bash
hf repo create <repo-name> --type dataset
```
### Create under an organization
```bash
hf repo create <repo-name> --type dataset --organization <org-name>
```
---
## Python One-Liners
### Upload large folder (resumable)
```bash
python -c "from huggingface_hub import HfApi; HfApi().upload_large_folder(repo_id='<repo-id>', repo_type='dataset', folder_path='<local-folder>')"
```
### Upload a single folder/pack
```bash
python -c "from huggingface_hub import HfApi; HfApi().upload_folder(folder_path='<local-folder>', path_in_repo='<path-in-repo>', repo_id='<repo-id>', repo_type='dataset', commit_message='Your message')"
```
### Upload a single file
```bash
python -c "from huggingface_hub import HfApi; HfApi().upload_file(path_or_fileobj='<local-file>', path_in_repo='<path-in-repo>', repo_id='<repo-id>', repo_type='dataset', commit_message='Your message')"
```
### Delete a folder
```bash
python -c "from huggingface_hub import HfApi; HfApi().delete_folder('<folder-name>', repo_id='<repo-id>', repo_type='dataset', commit_message='Remove <folder-name>')"
```
### Delete a single file
```bash
python -c "from huggingface_hub import HfApi; HfApi().delete_file('<file-path>', repo_id='<repo-id>', repo_type='dataset', commit_message='Remove <file-path>')"
```
### Create a repo
```bash
python -c "from huggingface_hub import HfApi; HfApi().create_repo(repo_id='<repo-id>', repo_type='dataset')"
```
---
## Python Script Examples
### Upload large folder (full script with options)
```python
from huggingface_hub import HfApi
api = HfApi()
api.upload_large_folder(
repo_id="<repo-id>",
repo_type="dataset",
folder_path="<local-folder>",
)
```
### Upload a folder to a specific path in the repo
```python
from huggingface_hub import HfApi
api = HfApi()
api.upload_folder(
folder_path="<local-folder>",
path_in_repo="<path-in-repo>",
repo_id="<repo-id>",
repo_type="dataset",
commit_message="Your message",
ignore_patterns=["*.cache", ".git/*"],
)
```
### Batch delete + upload in one commit
```python
from huggingface_hub import HfApi, CommitOperationAdd, CommitOperationDelete
api = HfApi()
operations = [
CommitOperationDelete(path_in_repo="<old-folder>/"),
CommitOperationAdd(path_in_repo="<file-path>", path_or_fileobj="<local-file>"),
]
api.create_commit(
repo_id="<repo-id>",
repo_type="dataset",
operations=operations,
commit_message="Your message",
)
```
---
## Tips
- **Resumable uploads**: `upload_large_folder` and `hf upload-large-folder` are resumable. If interrupted, run the same command again.
- **Don't use raw `git push`** for large files -- use the CLI/API instead. They handle LFS/Xet automatically.
- **Write token required**: Tokens default to read-only. Enable write access at https://huggingface.co/settings/tokens.
- **50 GB max per file** on HuggingFace. Split larger files before uploading.
- **Ignore patterns**: Use `--include` and `--exclude` (CLI) or `ignore_patterns` (Python) to filter what gets uploaded.
- **Delete the `.cache/huggingface/` folder** inside your local folder to reset upload state if something goes wrong with `upload_large_folder`.
|