mlclaw 0.1.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/.agents/skills/mlclaw/SKILL.md +63 -18
  2. package/Dockerfile +21 -4
  3. package/README.md +70 -24
  4. package/assets/hf-logo.svg +8 -0
  5. package/assets/hf-tooling/manifest.json +50 -0
  6. package/assets/hf-tooling/skills/hf-cli/SKILL.md +218 -0
  7. package/assets/hf-tooling/skills/hf-mem/SKILL.md +79 -0
  8. package/assets/hf-tooling/skills/huggingface-best/SKILL.md +134 -0
  9. package/assets/hf-tooling/skills/huggingface-datasets/SKILL.md +107 -0
  10. package/assets/hf-tooling/skills/huggingface-gradio/SKILL.md +298 -0
  11. package/assets/hf-tooling/skills/huggingface-gradio/examples.md +613 -0
  12. package/assets/hf-tooling/skills/huggingface-local-models/SKILL.md +113 -0
  13. package/assets/hf-tooling/skills/huggingface-local-models/references/hardware.md +38 -0
  14. package/assets/hf-tooling/skills/huggingface-local-models/references/hub-discovery.md +178 -0
  15. package/assets/hf-tooling/skills/huggingface-local-models/references/quantization.md +256 -0
  16. package/assets/hf-tooling/skills/huggingface-papers/SKILL.md +239 -0
  17. package/assets/hf-tooling/skills/huggingface-spaces/SKILL.md +239 -0
  18. package/assets/hf-tooling/skills/huggingface-spaces/references/buckets.md +89 -0
  19. package/assets/hf-tooling/skills/huggingface-spaces/references/debugging.md +236 -0
  20. package/assets/hf-tooling/skills/huggingface-spaces/references/gradio.md +200 -0
  21. package/assets/hf-tooling/skills/huggingface-spaces/references/grants.md +56 -0
  22. package/assets/hf-tooling/skills/huggingface-spaces/references/inference-providers.md +85 -0
  23. package/assets/hf-tooling/skills/huggingface-spaces/references/known-errors.md +232 -0
  24. package/assets/hf-tooling/skills/huggingface-spaces/references/requirements.md +169 -0
  25. package/assets/hf-tooling/skills/huggingface-spaces/references/zerogpu.md +349 -0
  26. package/assets/hf-tooling/skills/huggingface-tool-builder/SKILL.md +120 -0
  27. package/assets/hf-tooling/skills/huggingface-tool-builder/references/baseline_hf_api.py +57 -0
  28. package/assets/hf-tooling/skills/huggingface-tool-builder/references/baseline_hf_api.sh +40 -0
  29. package/assets/hf-tooling/skills/huggingface-tool-builder/references/baseline_hf_api.tsx +57 -0
  30. package/assets/hf-tooling/skills/huggingface-tool-builder/references/find_models_by_paper.sh +230 -0
  31. package/assets/hf-tooling/skills/huggingface-tool-builder/references/hf_enrich_models.sh +96 -0
  32. package/assets/hf-tooling/skills/huggingface-tool-builder/references/hf_model_card_frontmatter.sh +188 -0
  33. package/assets/hf-tooling/skills/huggingface-tool-builder/references/hf_model_papers_auth.sh +171 -0
  34. package/assets/hf-tooling/skills/huggingface-zerogpu/SKILL.md +289 -0
  35. package/assets/hf-tooling/skills/huggingface-zerogpu/references/concurrency.md +79 -0
  36. package/assets/hf-tooling/skills/huggingface-zerogpu/references/cuda-and-deps.md +66 -0
  37. package/assets/hf-tooling/skills/huggingface-zerogpu/references/how-quota-works.md +74 -0
  38. package/assets/hf-tooling/skills/huggingface-zerogpu/references/how-zerogpu-works.md +50 -0
  39. package/assets/hf-tooling/templates/.agents/mcp/huggingface.json +11 -0
  40. package/assets/hf-tooling/templates/.env.example +5 -0
  41. package/assets/hf-tooling/templates/examples/huggingface/README.md +16 -0
  42. package/assets/hf-tooling/templates/examples/huggingface/bucket-sync.md +19 -0
  43. package/assets/hf-tooling/templates/examples/huggingface/dataset-upload.py +22 -0
  44. package/assets/hf-tooling/templates/examples/huggingface/hf-discover.md +13 -0
  45. package/assets/hf-tooling/templates/examples/huggingface/runtime-inspection.py +9 -0
  46. package/assets/mlclaw-control-ui/assets/index-D2TFes32.js +9 -0
  47. package/assets/mlclaw-control-ui/assets/index-DP72PFuv.css +1 -0
  48. package/assets/mlclaw-control-ui/index.html +13 -0
  49. package/assets/mlclaw.svg +298 -124
  50. package/dist/hf-tooling-seed.js +261 -0
  51. package/dist/mlclaw-space-runtime.js +6634 -3321
  52. package/dist/mlclaw.mjs +428 -178
  53. package/entrypoint.sh +4 -0
  54. package/mlclaw.ps1 +4 -2
  55. package/mlclaw.sh +5 -3
  56. package/openclaw.default.json +1 -0
  57. package/package.json +16 -2
  58. package/space/README.md +32 -2
  59. package/tsconfig.json +3 -2
@@ -0,0 +1,169 @@
1
+ # requirements.txt for Spaces
2
+
3
+ Rules for what to pin, what to leave alone, where to source CUDA wheels, and which torch-side-cars drift silently.
4
+
5
+ ## What's preinstalled (do not list)
6
+
7
+ The Gradio SDK base image already installs these on every hardware tier — listing them in `requirements.txt` causes resolution failures or, worse, lets pip silently drift the runtime out of compatibility:
8
+
9
+ | Package | Pinning rules |
10
+ |---|---|
11
+ | `gradio` | Don't list. Locked by `sdk_version:` in README frontmatter; pinning here is ignored or breaks. |
12
+ | `spaces` | Don't list. Platform-pinned; a user pin always loses. |
13
+ | `huggingface_hub` | Don't list by default. Pin only as a workaround for old `gradio<5` that imports the removed `HfFolder` symbol (see [`known-errors.md`](known-errors.md)). |
14
+ | `torch` | **Pinnable, but only within `{2.8.0, 2.9.1, 2.10.0, 2.11.0}`.** Anything outside causes `CONFIG_ERROR: torch version in requirements.txt is not compatible`. Default is to leave unpinned (runtime preinstalls 2.11), but pinning is appropriate when (a) a specific version is known-good for your model, (b) you're matching a CUDA-extension wheel's `torch2.X` tag, or (c) a dep would otherwise drag torch outside the supported set. When you pin torch, also pin `torchvision` / `torchaudio` to the matching minor — see the "Torch-family side-car drift" section below. |
15
+
16
+ ## What to list
17
+
18
+ Everything you actually `import`, including the often-forgotten:
19
+
20
+ - `torchvision`, `torchaudio` — **not** preinstalled. Leave unpinned; pip resolves against the installed `torch` major.minor.
21
+ - `accelerate` — needed whenever you use `device_map=`. Listing it also silences `low_cpu_mem_usage=False` warnings.
22
+ - `sentencepiece` — required by most LLM tokenizers; rarely transitive.
23
+ - `einops` — required by `flash_attn.layers.rotary` and many model repos.
24
+ - Domain libs: `diffusers`, `transformers`, `safetensors`, `pillow`, `numpy`, etc.
25
+
26
+ If a research repo ships a Python package directory (`models/`, `pipeline/`, …), just upload the directory with the rest of the Space — the whole repo root is importable as `/home/user/app`. **Do not** try to reference local paths from `requirements.txt`.
27
+
28
+ ## Pinning torch
29
+
30
+ ZeroGPU accepts only `2.8.0`, `2.9.1`, `2.10.0`, `2.11.0`. Default is unpinned (runtime preinstalls the latest). Pinning is fine — and sometimes warranted — within that set:
31
+
32
+ - A specific torch is known-good for your model (numerics, attention kernel availability, etc.).
33
+ - A direct-URL CUDA wheel encodes a `torch2.X` tag (see "Prebuilt CUDA wheels" below) — pin torch to match.
34
+ - A dep's `setup.py` would otherwise downgrade torch outside the supported set.
35
+
36
+ `2.8.0` is the safest fallback for old requirements that refuse modern torch. `2.10.0` / `2.11.0` is the sweet spot for new code. When you pin torch, also pin `torchvision` / `torchaudio` to the matching minor — see the side-car drift section.
37
+
38
+ When a dep would silently downgrade torch (e.g. some forks of `demucs`, `audiocraft` pin `torchaudio<2.1`), install the offender from `app.py` with `--no-deps` rather than pinning torch around it:
39
+
40
+ ```python
41
+ import subprocess, sys
42
+ subprocess.run([sys.executable, "-m", "pip", "install", "--no-deps",
43
+ "git+https://github.com/facebookresearch/demucs"], check=True)
44
+ import spaces # safe now — torch wasn't touched
45
+ ```
46
+
47
+ List the offender's real runtime deps yourself in `requirements.txt`.
48
+
49
+ ## Torch-family side-car drift
50
+
51
+ `torchvision`, `torchaudio`, `torchcodec` are built against a specific `torch` major.minor. Listing them unpinned **usually** works, but two known drift patterns:
52
+
53
+ - `torchaudio==2.11.0` (and later) **dropped its `Requires-Dist: torch==X.Y.Z` line**. With torch pinned to 2.10, pip silently resolves torchaudio to 2.11.0 and the import fails on ABI mismatch.
54
+ - `torchcodec` declares no torch dependency in PyPI metadata at all.
55
+
56
+ Verification after `pip install` or `uv lock --upgrade`:
57
+
58
+ ```bash
59
+ curl -s https://pypi.org/pypi/<pkg>/<version>/json \
60
+ | python3 -c "import json,sys,re; rd=json.load(sys.stdin)['info'].get('requires_dist') or []; \
61
+ print('\n'.join(x for x in rd if re.match(r'^torch(?![a-z])', x)) or '(no torch constraint)')"
62
+ ```
63
+
64
+ When PyPI is silent, fall back to the project's README compatibility table (torchcodec's lives at https://github.com/pytorch/torchcodec).
65
+
66
+ ## Prebuilt CUDA wheels — the Blackwell wheels dataset
67
+
68
+ This is the **first** thing to reach for when a CUDA-extension package has no upstream wheel matching the ZeroGPU torch / CUDA / cxx11-abi cell. Prefer it over any runtime workaround (`pip install git+…` inside `@spaces.GPU`, committed stub packages, `sys.modules` injection, monkey-patch shims), all of which are slower, fragile, and eat `duration` budget. Canonical prebuilt sm_120 wheels:
69
+
70
+ > https://huggingface.co/datasets/multimodalart/zerogpu-blackwell-wheels
71
+
72
+ Wheels live at `wheels/<cell>/<wheel>`. A **cell** encodes torch × CUDA × Python as `pt<torch>-cu<cuda>-cp<pyver>`. Every cell ships the same seven packages:
73
+
74
+ `flash_attn` (two versions: `2.8.3` and `2.7.4.post1`), `xformers`, `pytorch3d`, `nvdiffrast`, `diff_gaussian_rasterization`, `torchmcubes`.
75
+
76
+ Current cells (12):
77
+
78
+ | torch | CUDA | Python cells available |
79
+ |---|---|---|
80
+ | 2.8.0 (`pt28`) | 12.8 | cp310, cp311, cp312 |
81
+ | 2.9.1 (`pt291`) | 12.8 | cp310 |
82
+ | 2.10.0 (`pt210`) | 12.8 / 13.0 | cp310 (cu128), cp312 (cu130) |
83
+ | 2.11.0 (`pt211`) | 13.0 | cp312, cp313 |
84
+ | 2.12.0 (`pt212`) | 13.0 | cp310, cp311, cp312, cp313 |
85
+
86
+ ### Picking a cell
87
+
88
+ 1. **Match `cp<pyver>` to your `python_version:`.** The wheels are cp-ABI-specific — a `cp310` wheel needs Python 3.10, `cp312` needs 3.12, etc. (`flash_attn` now ships cp310 **through** cp313, so this is a free choice, not a forced pin to 3.10 as in older versions of this doc.)
89
+ 2. **The wheels are torch-minor-tolerant.** The `flash_attn` / `xformers` filenames encode no torch version, so a `pt212-cu130-cp310` wheel runs fine on the live torch-2.11 cp310 runtime. `flash_attn` ships cp310 through cp313, so the Python choice is free. Pick the highest-torch cell for your Python version unless you've pinned an older torch — then match it (torch 2.8 → a `pt28-cu128-cp3XX` cell).
90
+ 3. **Copy the *exact* filename from the cell you pick.** The `xformers` build hash differs across cells (`0.0.34+3da0fc92…` on the cu130 / torch≥2.10 cells, `0.0.34+41531cee…` on the cu128 / torch 2.8–2.9 cells). Don't hardcode one filename across cells — list the cell (`hf download --repo-type dataset multimodalart/zerogpu-blackwell-wheels --include "wheels/<cell>/*"` or the Hub file browser) and copy what's there.
91
+
92
+ Reference by direct URL in `requirements.txt`:
93
+
94
+ ```
95
+ https://huggingface.co/datasets/multimodalart/zerogpu-blackwell-wheels/resolve/main/wheels/<cell>/<wheel>
96
+ ```
97
+
98
+ ### Per-package status
99
+
100
+ Each package's version is constant across cells; only the `cp`/torch/CUDA tags in the filename change. The "instead of" column is the runtime workaround to avoid — the wheel is the clean path.
101
+
102
+ | Package | Instead of | Version + caveats |
103
+ |---|---|---|
104
+ | `flash_attn` | committing a `flash_attn/` stub package; `sys.modules["flash_attn"] = …` injection | **2.8.3** (default) or **2.7.4.post1** (repos that pin `flash-attn<2.8`). Ships **cp310–cp313**. Needs `einops` for `flash_attn.layers.rotary`. Built `FLASH_ATTN_CUDA_ARCHS=120` (sm_120 only). This is FlashAttention-**2** — FA3/FA4 do **not** run on sm_120 (no TMEM); see [`zerogpu.md`](zerogpu.md) → Attention backends. Its real `flash_attn_2_cuda` also satisfies xformers' `flash_attn_gpu` probe. |
105
+ | `xformers` | an MEA→SDPA monkey-patch shim; a Cutlass-force shim | **0.0.34** (`Requires: torch>=2.10`). **Build hash differs per cell** — copy the exact filename. Auto-dispatch picks FA2 (`fa2F`) on sm_120; classic Cutlass / FA3 reject sm_120 but auto-dispatch never selects them. |
106
+ | `pytorch3d` | a runtime `pip install git+…pytorch3d.git` inside `@spaces.GPU` | **0.7.9**. Needs `numpy`, `iopath`, `fvcore` listed. No torch pin in metadata; loads cleanly on torch 2.11. |
107
+ | `nvdiffrast` | a runtime build with `TORCH_CUDA_ARCH_LIST=12.0` | **0.4.0**. Needs `numpy`. `RasterizeGLContext` is a deprecation alias for `RasterizeCudaContext` — no headless-GL footgun. |
108
+ | `diff_gaussian_rasterization` | a runtime build from `graphdeco-inria/diff-gaussian-rasterization.git` | **Upstream Inria API only** (returns 2-tuple `(color, radii)`). Does NOT match the ashawkey fork (4-tuple incl. alpha+depth) used by `ashawkey/LGM`, `dylanebert/LGM-mini`, etc. Forks need their own wheel. |
109
+ | `torchmcubes` | a runtime `pip install git+…torchmcubes.git` | **0.1.0**. **sm_120 only** (no fatbin for older archs). Works on ZeroGPU / Blackwell; not portable to a dedicated T4 / L4 / A10G Space. |
110
+
111
+ ### Pattern
112
+
113
+ Resolve the exact filenames from your chosen cell, then:
114
+
115
+ ```
116
+ # requirements.txt (cell = pt212-cu130-cp310 → needs python_version "3.10")
117
+ numpy
118
+ einops
119
+ https://huggingface.co/datasets/multimodalart/zerogpu-blackwell-wheels/resolve/main/wheels/pt212-cu130-cp310/flash_attn-2.8.3-cp310-cp310-linux_x86_64.whl
120
+ https://huggingface.co/datasets/multimodalart/zerogpu-blackwell-wheels/resolve/main/wheels/pt212-cu130-cp310/xformers-0.0.34+3da0fc92.d20260528-cp39-abi3-linux_x86_64.whl
121
+ ```
122
+
123
+ ```yaml
124
+ # README frontmatter — pin Python to match the wheel cell's cp tag
125
+ python_version: "3.10"
126
+ ```
127
+
128
+ **Do not** install these from `@spaces.GPU` startup. A `subprocess.check_call` pip-install at first GPU acquire is strictly worse than the wheel URL — slower cold start, eats `duration` budget, breaks reproducibility, and the build sometimes exceeds the `@spaces.GPU(duration=1500)` cap.
129
+
130
+ ### When you need a wheel that's not in the dataset
131
+
132
+ Three options, in preference order:
133
+
134
+ 1. **kernels-community** — https://huggingface.co/kernels-community handles ABI matching for you. Often the simplest path; no version pinning needed.
135
+ 2. **Upstream wheel matrix** — e.g. flash-attention's releases page ships a fairly complete `cu12 / torch / Python` matrix at https://github.com/Dao-AILab/flash-attention/releases. Pin `torch==X.Y.Z` in `requirements.txt` to match the wheel's `torch2.X` tag.
136
+ 3. **Build it yourself and host on HF Hub.** Last resort — see [`debugging.md`](debugging.md) for the in-`@spaces.GPU` source-build pattern as a stopgap while a wheel is being built.
137
+
138
+ ## Reading a CUDA wheel filename
139
+
140
+ ```
141
+ flash_attn-2.8.3+cu130torch2.12cxx11abiFALSE-cp310-cp310-linux_x86_64.whl
142
+ ```
143
+
144
+ | Tag | Meaning |
145
+ |---|---|
146
+ | `cu130` | CUDA major version (13.0) |
147
+ | `torch2.12` | torch major.minor the wheel was compiled against |
148
+ | `cxx11abiFALSE` | C++ stdlib ABI choice (`TRUE` or `FALSE`) |
149
+ | `cp310-cp310` | CPython version (3.10) |
150
+
151
+ ABI / symbol mismatches at any of these → `ImportError` on first import. Pin `torch` to match `torch2.X`. Set `python_version:` to match `cp3XX`.
152
+
153
+ ## Don't pin `xformers`
154
+
155
+ Leave bare in `requirements.txt` (or use the prebuilt URL above). Pip picks the wheel matching your installed torch.
156
+
157
+ ## Don't pin `spaces`
158
+
159
+ Even if a `uv export` produces it, exclude with `--no-emit-package spaces`. The platform always pins its own version.
160
+
161
+ ## Specifically about Python version
162
+
163
+ Pinning `python_version:` is effectively required:
164
+
165
+ - ZeroGPU officially supports **3.10.13** and **3.12.12**.
166
+ - The runtime default is 3.10.
167
+ - Pinning to a `cp3XX` wheel matrix (e.g. `cp310` flash_attn wheel) forces matching Python.
168
+
169
+ Both `"3.12"` and `"3.12.12"` forms are accepted in YAML.
@@ -0,0 +1,349 @@
1
+ # ZeroGPU
2
+
3
+ Read this whenever the Space targets ZeroGPU (`zero-a10g` flavor). The SKILL.md's 3-rule summary is a starting point; this file covers the model in enough detail to debug and design.
4
+
5
+ For numerical limits (per-tier daily quota minutes, runs-per-day caps, current backing GPU, supported Python / torch versions): https://huggingface.co/docs/hub/spaces-zerogpu. Those values change over time and are deliberately kept out of this skill.
6
+
7
+ ## The mental model
8
+
9
+ A ZeroGPU Space runs as **two processes**:
10
+
11
+ - **Main web process** — long-lived. Imports `app.py`, launches Gradio. Holds no VRAM and, after the startup "pack" step, no model weights in RAM either.
12
+ - **GPU worker** — short-lived. Forked per `@spaces.GPU` request (or reused if warm). Eventually killed by the ZeroGPU scheduler when another Space needs the slot. Your code never kills its own worker.
13
+
14
+ `import spaces` monkey-patches `torch.cuda.*` in the main process so that `.to("cuda")` and `torch.cuda.is_available()` work at module scope **without** a real GPU attached. Module-level `model.to("cuda")` is intercepted: the tensor data physically stays in main-process RAM at this point, with a CUDA-presenting "fake" tensor registered alongside. At a startup "pack" step, the backend writes those original CPU tensors to disk via `O_DIRECT` and frees the RAM. After pack, main holds no weights anywhere.
15
+
16
+ When a `@spaces.GPU` call lands, the scheduler routes it to a worker:
17
+
18
+ - **Cold worker** — forked from the main process; torch is unpatched; real CUDA is initialized; weights are streamed disk → pinned host → VRAM via a double-buffered pipeline. This is the cold-start cost.
19
+ - **Warm worker** — alive worker bound to the same slot; init is skipped; weights stay on VRAM from the previous call.
20
+
21
+ A warm worker eventually dies when another Space needs the slot. Occasional cold starts on a low-traffic Space are normal.
22
+
23
+ ## The three rules
24
+
25
+ ### 1. `import spaces` before any CUDA-touching import
26
+
27
+ ```python
28
+ import spaces # FIRST
29
+ import torch # then this
30
+ ```
31
+
32
+ If something initializes CUDA before `import spaces`, the patch can't apply and you get `RuntimeError: CUDA has been initialized before importing the spaces package`. For libraries that eagerly init CUDA on import (e.g. `numba.cuda`, NeMo via numba), set the disable env *before* the import:
33
+
34
+ ```python
35
+ import os
36
+ os.environ.setdefault("NUMBA_DISABLE_CUDA", "1")
37
+ import spaces
38
+ ```
39
+
40
+ ### 2. Load models at module scope, `.to("cuda")` eagerly
41
+
42
+ ```python
43
+ pipe = DiffusionPipeline.from_pretrained("...", torch_dtype=torch.bfloat16).to("cuda")
44
+ ```
45
+
46
+ Do **not** lazy-load inside `@spaces.GPU`. The hijack is designed for module-level placement; deferring it puts tens of seconds of checkpoint I/O + dtype cast + GPU move inside every cold request.
47
+
48
+ Use the **string `"cuda"`** — never an integer device id. ZeroGPU re-allocates device ids per request, so `.to(0)`, `device_map={"": 0}`, `torch.cuda.set_device(0)` silently break.
49
+
50
+ For plain `from_pretrained` loads, use `.to("cuda")`, **not** `device_map="cuda"` (which routes through `accelerate.set_module_tensor_to_device` and calls `torch._C._cuda_init()` at load time, bypassing the hijack). The exception is loaders that are ZeroGPU-aware — notably the `bitsandbytes` quantization path; `from_pretrained(..., quantization_config=BitsAndBytesConfig(...))` works with `device_map="cuda"`.
51
+
52
+ **Preloading multiple variants** (e.g. base + refiner, image + video model) is fine as long as their combined VRAM fits. Load all of them sequentially at module scope into a dict, then key per request. Don't unload/reload between requests — that puts the load cost back on the user.
53
+
54
+ ### 3. Decorate the function Gradio binds
55
+
56
+ ZeroGPU's startup scan walks Gradio's registered event handlers for `@spaces.GPU`-marked functions. If you decorate `inner_helper` but `click(fn=outer)` is what's wired up, you get `RuntimeError: No @spaces.GPU function detected during startup`. Always decorate the function passed to the event handler.
57
+
58
+ ```python
59
+ @spaces.GPU(duration=60)
60
+ def generate(prompt):
61
+ return pipe(prompt).images[0]
62
+
63
+ btn.click(fn=generate, inputs=prompt_box, outputs=image_out)
64
+ ```
65
+
66
+ ## Sizing duration
67
+
68
+ `@spaces.GPU(duration=N)` means "reserve N seconds of GPU time." Two failure modes:
69
+
70
+ - **`ZeroGPU illegal duration`** — `N` exceeds the visitor's tier cap. Lowering `duration` is the only fix.
71
+ - **`ZeroGPU quota exceeded`** — the visitor's remaining quota is less than `requested`. Compared as `requested vs remaining`, not `actual vs remaining` — so a 10-second task left at the default 60 s blocks the user as soon as their remaining drops below 60 s.
72
+
73
+ Smaller `duration` also ranks **higher** in the queue. Both reasons push toward declaring the realistic worst case, not a comfortable margin.
74
+
75
+ **Pick the value — don't guess.** A too-high duration deploys cleanly then errors on the first call; too-low silently truncates. Methodology:
76
+
77
+ 1. Ship with a placeholder (e.g. 180 s).
78
+ 2. Instrument with `time.perf_counter()` and return the seconds in the response.
79
+ 3. Run 2–3 representative calls via `gradio_client`.
80
+ 4. Set `duration = round(measured_max × 1.4)`.
81
+
82
+ For input-dependent runtime, pass a **callable**:
83
+
84
+ ```python
85
+ def _estimate(prompt, steps, *args, **kwargs):
86
+ # Swallow extras with *args, **kwargs — Gradio passes progress= positionally
87
+ # and a strict signature will raise "takes 5 positional arguments but 6 were given"
88
+ return min(240, 60 + int(steps * 3.5))
89
+
90
+ @spaces.GPU(duration=_estimate)
91
+ def generate(prompt, steps, ..., progress=gr.Progress(track_tqdm=True)):
92
+ ...
93
+ ```
94
+
95
+ ## Sizing memory: `large` vs `xlarge`
96
+
97
+ `size="large"` (default) is half the backing card (48 GB on Blackwell). `size="xlarge"` is the full card (96 GB) and costs **2× quota** per second — plus higher queue waits. Use `large` unless the workload genuinely OOMs.
98
+
99
+ Rough VRAM sizing:
100
+
101
+ | Mode | Memory rule | 7B | 27B | 70B |
102
+ |------|------------|------|------|------|
103
+ | bf16 | `params × 2` GB | 14 GB ✓ large | 54 GB → xlarge | 140 GB → quant + xlarge |
104
+ | int8 | `params × 1` GB | 7 GB ✓ large | 27 GB ✓ large | 70 GB → xlarge |
105
+ | 4-bit (NF4 / int4) | `params × ~0.55` GB | 4 GB ✓ large | 15 GB ✓ large | 40 GB ✓ large |
106
+
107
+ Numbers are for weights only; activations and KV cache add on top (significant for long context).
108
+
109
+ ## Quantization
110
+
111
+ ZeroGPU supports two quantization stacks: **`bitsandbytes`** (drop-in for transformers, well-trodden) and **`torchao`** (torch-native, newer, smaller install). Pick by what your model's `from_pretrained` actually wires up; if both work, default to `bitsandbytes` for transformers LLMs and `torchao` for diffusers.
112
+
113
+ ### bitsandbytes (NF4 / int8)
114
+
115
+ ```python
116
+ import spaces, torch
117
+ from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
118
+
119
+ bnb = BitsAndBytesConfig(
120
+ load_in_4bit=True,
121
+ bnb_4bit_quant_type="nf4",
122
+ bnb_4bit_use_double_quant=True,
123
+ bnb_4bit_compute_dtype=torch.bfloat16,
124
+ )
125
+ tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
126
+ model = AutoModelForCausalLM.from_pretrained(
127
+ MODEL_ID,
128
+ quantization_config=bnb,
129
+ device_map="cuda", # OK here — bnb's loader is ZeroGPU-aware
130
+ dtype=torch.bfloat16,
131
+ ).eval()
132
+ ```
133
+
134
+ This is the one case where `device_map="cuda"` is **safe** on ZeroGPU at module scope (bitsandbytes' loader path intercepts cleanly). For non-bnb loads, stick to `.to("cuda")`.
135
+
136
+ `load_in_8bit=True` swaps the 4-bit block for int8 — same hijack-safe loader. Bigger but higher quality, no `compute_dtype` knob.
137
+
138
+ ### torchao
139
+
140
+ ```python
141
+ import spaces, torch
142
+ from diffusers import DiffusionPipeline
143
+ from torchao.quantization import quantize_, Int8WeightOnlyConfig
144
+
145
+ pipe = DiffusionPipeline.from_pretrained(MODEL_ID, torch_dtype=torch.bfloat16).to("cuda")
146
+ quantize_(pipe.transformer, Int8WeightOnlyConfig()) # mutates in place
147
+ ```
148
+
149
+ `torchao` is more flexible (fine-grained per-module quantization, `Int4WeightOnlyConfig`, `Float8WeightOnlyConfig`, etc.) and works with diffusers' `from_pretrained(..., quantization_config=TorchAoConfig(...))` integration too. No CUDA build dependency — installs as a wheel.
150
+
151
+ ### Attention backends
152
+
153
+ **Default to `attn_implementation="sdpa"`** — torch-native, works everywhere on sm_120, and is the right choice for the overwhelming majority of Spaces. Reach for a Flash-Attention backend only when the **upstream repo already references FA** (its config/model code defaults to or recommends `flash_attn`) — match what it expects rather than forcing SDPA. If FA then breaks on Blackwell, fall back to SDPA.
154
+
155
+ **Flash Attention 2** — when you do need it, use the prebuilt wheel at `multimodalart/zerogpu-blackwell-wheels` ([`requirements.md`](requirements.md)), cp310–cp313. Drop the wheel URL in `requirements.txt`; no monkey-patch, no runtime build. The wheel's real `flash_attn_2_cuda` also satisfies xformers' import-time probes.
156
+
157
+ **xformers** — same wheels dataset; auto-dispatch picks FA2 on sm_120 with no monkey-patch.
158
+
159
+ **FA2 is the ceiling on ZeroGPU Blackwell — FA3 and FA4 cannot run on sm_120.** The RTX PRO 6000 (sm_120) lacks the TMEM / `tcgen05` tensor-memory subsystem the FA3/FA4 kernels are built on; those kernels only exist for Hopper (sm_90a) and datacenter Blackwell (sm_100a). This is a **hardware** limit, not a packaging gap — no wheel or branch fixes it:
160
+
161
+ - `kernels-community/flash-attn3` (any revision, including `fake-ops-return-probs`), `vllm-flash-attn3`, `sgl-flash-attn3` all either fail to load (no matching build) or hard-fault at call time with `CUDA error: no kernel image is available for execution on the device` — which **kills the ZeroGPU worker** (surfaces as `GPU task aborted`); it does not fall back.
162
+ - Verified empirically on the live runtime (`NVIDIA RTX PRO 6000 Blackwell … sm_120`, torch 2.11 / cu130) and confirmed upstream — every framework (vLLM, SGLang) falls back to FA2 on sm_120.
163
+
164
+ So on ZeroGPU the ladder is **SDPA (default) → FA2 (only if the repo uses FA)**. Don't wire in FA3/FA4 — a stray `config.json` `kernels` entry loading `flash-attn3` will abort the worker on first GPU call.
165
+
166
+ ## Concurrency
167
+
168
+ Handlers run **concurrently by default**. Three rules:
169
+
170
+ 1. **No mutable global state.** Handlers writing to a module-level dict / list race each other.
171
+ 2. **No fixed output paths.** Two concurrent calls writing to `output.png` clobber each other (and leak data across users). Use `tempfile.NamedTemporaryFile(suffix=...)`.
172
+ 3. **Read-only globals are safe** — models, tokenizers, configs loaded once and only read inside handlers.
173
+
174
+ ## Process isolation and pickle
175
+
176
+ `@spaces.GPU` runs in a separate fork. Arguments and return values cross via pickle:
177
+
178
+ - **Only picklable objects** in/out. File handles, locks, lambdas, closures over unpicklable state → `PicklingError`.
179
+ - **Never return CUDA tensors.** Unpickling in the main process triggers `torch.cuda._lazy_init()`, which ZeroGPU blocks → the call hangs. Convert to CPU first: `return tensor.cpu()` or `.cpu().numpy()`.
180
+ - CPU tensors, numpy arrays, PIL Images, plain Python objects work fine.
181
+ - `gr.SelectData` is a special case — its `__getattr__` recurses under pickle. Extract the fields you need (`evt.index[0]`, etc.) in a thin un-decorated wrapper, pass plain values to the `@spaces.GPU` function.
182
+
183
+ ### `gr.State` across the fork
184
+
185
+ `gr.State` is pickled on every yield. The handler receives a **copy**:
186
+
187
+ - In-place mutations inside the fork are invisible to other handlers until you explicitly `yield` the mutated value back.
188
+ - Yielding `gr.update()` for a state slot **skips** the update — other handlers continue to see pre-yield value.
189
+ - For large state, minimize how often you yield it — ideally once at the end.
190
+ - CUDA tensors inside state must be CPU-d before yielding (same `_lazy_init` issue).
191
+
192
+ ## Generators and streaming
193
+
194
+ `@spaces.GPU` supports generator functions — first-class for progressive UI updates:
195
+
196
+ ```python
197
+ @spaces.GPU(duration=120)
198
+ def generate(prompt):
199
+ yield gr.update(value=None, label="Starting…")
200
+ for step in range(num_steps):
201
+ latent = step_fn(...)
202
+ yield gr.update(value=preview(latent), label=f"Step {step+1}/{num_steps}")
203
+ yield gr.update(value=final_image, label="Done")
204
+ ```
205
+
206
+ `gr.Progress(track_tqdm=True)` and `yield` compete with each other — pick one.
207
+
208
+ For streaming previews **inside** a diffusers `callback_on_step_end`, use a thread + queue inside the decorator (forks share threads):
209
+
210
+ ```python
211
+ @spaces.GPU(duration=180)
212
+ def generate(prompt, num_steps):
213
+ q = queue.Queue()
214
+ DONE = object()
215
+ def cb(pipe, step, t, kw):
216
+ q.put((step, taef1_preview(kw["latents"])))
217
+ return kw
218
+ def run():
219
+ out = pipeline(prompt=prompt, num_inference_steps=num_steps,
220
+ callback_on_step_end=cb,
221
+ callback_on_step_end_tensor_inputs=["latents"])
222
+ q.put((DONE, out))
223
+ threading.Thread(target=run, daemon=True).start()
224
+ while True:
225
+ idx, payload = q.get()
226
+ if idx is DONE: break
227
+ yield gr.update(value=payload, label=f"Step {idx+1}/{num_steps}")
228
+ ```
229
+
230
+ **Do not** use `ProcessPoolExecutor` / `multiprocessing.Pool` inside `@spaces.GPU` — the daemonic fork can't spawn children (`AssertionError: daemonic processes are not allowed to have children`). Threads only.
231
+
232
+ ## Compilation (AoTI)
233
+
234
+ `torch.compile` (JIT) is **not supported** on ZeroGPU — the forked GPU worker can't host the compile daemon. The supported path is PyTorch **ahead-of-time inductor (AoTI)**, wrapped by the `spaces` package (torch 2.8+, `spaces` ≥ 0.50). Its real value: compile a graph **once, offline**, publish it to the Hub, and have the serving Space load it — so serving cold starts pay no compile cost.
235
+
236
+ ### The `spaces` AoTI API
237
+
238
+ - `spaces.aoti_capture(module)` — context manager. Run one real forward pass inside it; it patches `module.forward` to record that call's `args`/`kwargs` and abort the run. Gives you real example inputs for export.
239
+ - `spaces.aoti_compile(exported, inductor_configs=None)` → an in-memory `ZeroGPUCompiledModel`.
240
+ - `spaces.aoti_compile_and_save(package_dir, exported, inductor_configs=None)` — compile and write `{package_dir}/root/package.pt2`.
241
+ - `spaces.aoti_apply(compiled, module)` — swap `module.forward` for an in-memory compiled model, same process.
242
+ - `spaces.aoti_blocks_load(module, repo_id, variant=None)` — the high-level loader. For a module exposing `_repeated_blocks` (most diffusers transformers), it downloads `{BlockClass}[.{variant}]/package.pt2` from `repo_id` and patches every matching block. Weights stay **runtime inputs**, so one compiled block-graph serves any checkpoint with the same block architecture (e.g. a base and its distilled/turbo variant share one graph).
243
+
244
+ ### Recommended workflow: precompile the repeated block, load at runtime
245
+
246
+ Split into a **compile Space** (run by hand, occasionally) and the **serving Space**, connected by a Hub **model** repo (`aoti_blocks_load` downloads with the default `repo_type="model"`).
247
+
248
+ **Compile Space** — capture one repeated block's inputs, export, compile, save, upload:
249
+
250
+ ```python
251
+ import os, spaces, torch, tempfile, shutil
252
+ from pathlib import Path
253
+ from huggingface_hub import HfApi
254
+
255
+ pipe = DiffusionPipeline.from_pretrained(MODEL_ID, torch_dtype=torch.bfloat16).to("cuda")
256
+ block = pipe.transformer.transformer_blocks[0] # one representative repeated block
257
+ BLOCK = type(block).__name__
258
+
259
+ @spaces.GPU(duration=1500)
260
+ def compile_and_upload():
261
+ with spaces.aoti_capture(block) as call: # capture the block's real inputs…
262
+ pipe("a prompt", num_inference_steps=1) # …from the first block call of a 1-step run
263
+ exported = torch.export.export(
264
+ block, call.args, call.kwargs,
265
+ dynamic_shapes=None, # start static; see note below
266
+ strict=False,
267
+ )
268
+ tmp = Path(tempfile.mkdtemp())
269
+ spaces.aoti_compile_and_save(tmp, exported) # -> tmp/root/package.pt2
270
+ out = Path(tempfile.mkdtemp()); (out / BLOCK).mkdir()
271
+ shutil.copy(tmp / "root" / "package.pt2", out / BLOCK / "package.pt2")
272
+ HfApi(token=os.environ["HF_TOKEN"]).upload_folder(
273
+ folder_path=str(out), repo_id=REPO, repo_type="model")
274
+ ```
275
+
276
+ The repo ends up as `{BlockClass}[.{variant}]/package.pt2`, optionally with a `config[.variant].json` listing custom `kernels` to fetch at load.
277
+
278
+ **Serving Space** — one line at module scope, with an eager fallback:
279
+
280
+ ```python
281
+ pipe = DiffusionPipeline.from_pretrained(MODEL_ID, torch_dtype=torch.bfloat16).to("cuda")
282
+ try:
283
+ spaces.aoti_blocks_load(pipe.transformer, REPO) # variant="fp8da" if you saved a variant
284
+ except Exception as e:
285
+ print(f"AoTI load failed ({e!r}); running eager")
286
+ ```
287
+
288
+ Only the repeated block is compiled, so the artifact is small and the same graph patches all N layers; compilation (minutes) happens offline, never on a serving cold start.
289
+
290
+ ### Footguns
291
+
292
+ - **Construct the block identically in both Spaces.** The compiled graph's constant FQNs must line up with the serving module. If the block chooses kernels/norms via env var or import probe (e.g. a triton fused RMSNorm vs the pure-torch path), pin the *same* choice in compile and serving.
293
+ - **Dynamic shapes.** `dynamic_shapes=None` bakes in the one resolution you captured. To serve variable sequence length / image size, pass `torch.export.Dim(...)` for those axes (e.g. `{"hidden_states": {1: torch.export.Dim("seq")}}`) — this is per-model tuning.
294
+ - **Data-dependent inputs don't export.** A block taking per-sample python int lists (some double-stream blocks) can make `torch.export` refuse to make them dynamic — those stay eager. Single-stream blocks taking only packed tensors export cleanly.
295
+ - **Custom kernels.** Ship a `config[.variant].json` with a `kernels` list (`repo_id` + `revision`); `aoti_blocks_load` calls `kernels.get_kernel(...)` before loading so the op is registered. (FA3 still won't run on sm_120 — see Attention backends.)
296
+ - **Simpler in-process variant.** For a one-off, skip the Hub round-trip: `spaces.aoti_apply(spaces.aoti_compile(exported), module)` compiles and applies in the same process — but you re-compile on every cold start.
297
+
298
+ ### Reference Spaces
299
+
300
+ - `multimodalart/Boogu-Image-0.1-Edit-aoti-compile` (compile + upload) and `multimodalart/Boogu-Image` (serving via block loading) — the blocks pattern end to end.
301
+ - `zerogpu-aoti/Qwen-Image`, `zerogpu-aoti/Wan2` — artifact repos showing the `{BlockClass}.{variant}/package.pt2` + `config.{variant}.json` layout.
302
+ - Deeper background on inductor configs and dynamic shapes: https://huggingface.co/blog/zerogpu-aoti
303
+
304
+ ## Local development
305
+
306
+ **Do NOT** wrap `import spaces` in `try/except` with a no-op fallback. Off-ZeroGPU, the `spaces` package is *already* a true no-op — the heavyweight behavior is gated on `SPACES_ZERO_GPU=1`, set only on ZeroGPU. `@spaces.GPU` returns the undecorated function unchanged elsewhere. The Gradio base image installs `spaces` on every hardware tier, so a duplicate onto T4 / A10G / CPU works without code changes too.
307
+
308
+ That said: **iterate ON the Space, not locally.** The Space environment (Python, torch, CUDA, drivers, env vars) differs from yours; passing local tests doesn't prove the Space works. Push early — even with the app not fully polished — and use the rung ladder ([`debugging.md`](debugging.md)) against the live URL.
309
+
310
+ ## Allocator config for memory pressure
311
+
312
+ If your workload hits transient allocation spikes (high-res pixel-space ops, large attention activations, SR models, video DiTs) and you see:
313
+
314
+ ```
315
+ RuntimeError: NVML_SUCCESS == r INTERNAL ASSERT FAILED at .../CUDACachingAllocator.cpp
316
+ ```
317
+
318
+ set expandable segments at the **very top** of `app.py`, before any torch import:
319
+
320
+ ```python
321
+ import os
322
+ os.environ.setdefault("PYTORCH_CUDA_ALLOC_CONF", "expandable_segments:True")
323
+ import spaces
324
+ import torch
325
+ ```
326
+
327
+ Often single-line fix for what looks like an OOM. See [`known-errors.md`](known-errors.md).
328
+
329
+ ## Example caching
330
+
331
+ `gr.Examples` defaults on ZeroGPU:
332
+
333
+ - `cache_examples=True`
334
+ - `cache_mode="lazy"` (eager would pre-run examples at startup, but no GPU is attached at startup)
335
+
336
+ Don't override to `cache_mode="eager"` on ZeroGPU — it will fail or burn the creator's daily quota. The cache is keyed by example **file path**, not content hash: regenerating an asset in place serves the stale cached output. Bump a `cache_version` constant if you replace example files.
337
+
338
+ ## Real-time sessions
339
+
340
+ For real-time apps (webcam, audio streaming), the per-call fork model is too costly. ZeroGPU supports reusable "real-time sessions" — one GPU allocation amortized across many small requests. Reference Spaces:
341
+
342
+ - https://huggingface.co/spaces/diffusers/unofficial-SDXL-Turbo-i2i-t2i
343
+ - https://huggingface.co/spaces/huggingface-projects/rf-detr-realtime-webcam
344
+
345
+ ## When things go wrong
346
+
347
+ For specific error strings (CUDA init order, illegal duration, allocator asserts, PicklingError, returning CUDA tensors, …): [`known-errors.md`](known-errors.md). It covers the ZeroGPU-specific patterns alongside everything else and is the single error lookup for the skill.
348
+
349
+ When the log endpoint can't explain a failure (device-side asserts, OOM under specific shapes, race conditions in pickle), dev mode + SSH is the last-resort tool — see [`debugging.md`](debugging.md).
@@ -0,0 +1,120 @@
1
+ ---
2
+ name: huggingface-tool-builder
3
+ description: Use this skill when the user wants to build tool/scripts or achieve a task where using data from the Hugging Face API would help. This is especially useful when chaining or combining API calls or the task will be repeated/automated. This Skill creates a reusable script to fetch, enrich or process data.
4
+ ---
5
+
6
+ # Hugging Face API Tool Builder
7
+
8
+ Your purpose is now is to create reusable command line scripts and utilities for using the Hugging Face API, allowing chaining, piping and intermediate processing where helpful. You can access the API directly, as well as use the `hf` command line tool. Model and Dataset cards can be accessed from repositories directly.
9
+
10
+ ## Script Rules
11
+
12
+ Make sure to follow these rules:
13
+ - Scripts must take a `--help` command line argument to describe their inputs and outputs
14
+ - Non-destructive scripts should be tested before handing over to the User
15
+ - Shell scripts are preferred, but use Python or TSX if complexity or user need requires it.
16
+ - IMPORTANT: Use the `HF_TOKEN` environment variable as an Authorization header. For example: `curl -H "Authorization: Bearer ${HF_TOKEN}" https://huggingface.co/api/`. This provides higher rate limits and appropriate authorization for data access.
17
+ - Investigate the shape of the API results before commiting to a final design; make use of piping and chaining where composability would be an advantage - prefer simple solutions where possible.
18
+ - Share usage examples once complete.
19
+
20
+ Be sure to confirm User preferences where there are questions or clarifications needed.
21
+
22
+ ## Sample Scripts
23
+
24
+ Paths below are relative to this skill directory.
25
+
26
+ Reference examples:
27
+ - `references/hf_model_papers_auth.sh` — uses `HF_TOKEN` automatically and chains trending → model metadata → model card parsing with fallbacks; it demonstrates multi-step API usage plus auth hygiene for gated/private content.
28
+ - `references/find_models_by_paper.sh` — optional `HF_TOKEN` usage via `--token`, consistent authenticated search, and a retry path when arXiv-prefixed searches are too narrow; it shows resilient query strategy and clear user-facing help.
29
+ - `references/hf_model_card_frontmatter.sh` — uses the `hf` CLI to download model cards, extracts YAML frontmatter, and emits NDJSON summaries (license, pipeline tag, tags, gated prompt flag) for easy filtering.
30
+
31
+ Baseline examples (ultra-simple, minimal logic, raw JSON output with `HF_TOKEN` header):
32
+ - `references/baseline_hf_api.sh` — bash
33
+ - `references/baseline_hf_api.py` — python
34
+ - `references/baseline_hf_api.tsx` — typescript executable
35
+
36
+ Composable utility (stdin → NDJSON):
37
+ - `references/hf_enrich_models.sh` — reads model IDs from stdin, fetches metadata per ID, emits one JSON object per line for streaming pipelines.
38
+
39
+ Composability through piping (shell-friendly JSON output):
40
+ - `references/baseline_hf_api.sh 25 | jq -r '.[].id' | references/hf_enrich_models.sh | jq -s 'sort_by(.downloads) | reverse | .[:10]'`
41
+ - `references/baseline_hf_api.sh 50 | jq '[.[] | {id, downloads}] | sort_by(.downloads) | reverse | .[:10]'`
42
+ - `printf '%s\n' openai/gpt-oss-120b meta-llama/Meta-Llama-3.1-8B | references/hf_model_card_frontmatter.sh | jq -s 'map({id, license, has_extra_gated_prompt})'`
43
+
44
+ ## High Level Endpoints
45
+
46
+ The following are the main API endpoints available at `https://huggingface.co`
47
+
48
+ ```
49
+ /api/datasets
50
+ /api/models
51
+ /api/spaces
52
+ /api/collections
53
+ /api/daily_papers
54
+ /api/notifications
55
+ /api/settings
56
+ /api/whoami-v2
57
+ /api/trending
58
+ /oauth/userinfo
59
+ ```
60
+
61
+ ## Accessing the API
62
+
63
+ The API is documented with the OpenAPI standard at `https://huggingface.co/.well-known/openapi.json`.
64
+
65
+ **IMPORTANT:** DO NOT ATTEMPT to read `https://huggingface.co/.well-known/openapi.json` directly as it is too large to process.
66
+
67
+ **IMPORTANT** Use `jq` to query and extract relevant parts. For example,
68
+
69
+ Command to Get All 160 Endpoints
70
+
71
+ ```bash
72
+ curl -s "https://huggingface.co/.well-known/openapi.json" | jq '.paths | keys | sort'
73
+ ```
74
+
75
+ Model Search Endpoint Details
76
+
77
+ ```bash
78
+ curl -s "https://huggingface.co/.well-known/openapi.json" | jq '.paths["/api/models"]'
79
+ ```
80
+
81
+ You can also query endpoints to see the shape of the data. When doing so constrain results to low numbers to make them easy to process, yet representative.
82
+
83
+ ## Using the HF command line tool
84
+
85
+ The `hf` command line tool gives you further access to Hugging Face repository content and infrastructure.
86
+
87
+ ```bash
88
+ ❯ hf --help
89
+ Usage: hf [OPTIONS] COMMAND [ARGS]...
90
+
91
+ Hugging Face Hub CLI
92
+
93
+ Options:
94
+ --help Show this message and exit.
95
+
96
+ Commands:
97
+ auth Manage authentication (login, logout, etc.).
98
+ buckets Commands to interact with buckets.
99
+ cache Manage local cache directory.
100
+ collections Interact with collections on the Hub.
101
+ datasets Interact with datasets on the Hub.
102
+ discussions Manage discussions and pull requests on the Hub.
103
+ download Download files from the Hub.
104
+ endpoints Manage Hugging Face Inference Endpoints.
105
+ env Print information about the environment.
106
+ extensions Manage hf CLI extensions.
107
+ jobs Run and manage Jobs on the Hub.
108
+ models Interact with models on the Hub.
109
+ papers Interact with papers on the Hub.
110
+ repos Manage repos on the Hub.
111
+ skills Manage skills for AI assistants.
112
+ spaces Interact with spaces on the Hub.
113
+ sync Sync files between local directory and a bucket.
114
+ upload Upload a file or a folder to the Hub.
115
+ upload-large-folder Upload a large folder to the Hub.
116
+ version Print information about the hf version.
117
+ webhooks Manage webhooks on the Hub.
118
+ ```
119
+
120
+ The `hf` CLI command has replaced the now deprecated `huggingface-cli` command.