Skip to content

Commit 0dcfce1

Browse files
committed
hf upload
1 parent 6f508f7 commit 0dcfce1

1 file changed

Lines changed: 3 additions & 13 deletions

File tree

docs/hub/trusted-publishers.md

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
- uses: actions/setup-python@v5
5656
with:
5757
python-version: "3.11"
58-
- run: pip install --upgrade "huggingface_hub>=1.16.1"
58+
- run: pip install --upgrade "huggingface_hub>=1.18.0"
5959

6060
- name: Exchange GitHub OIDC token for a Hub token
6161
run: |
@@ -100,19 +100,9 @@ jobs:
100100
} >> "$GITHUB_ENV"
101101
102102
- name: Upload checkpoint
103-
# `hf upload` calls create_repo() first, which a Trusted Publisher token
104-
# isn't allowed to do. Call upload_folder() directly to skip that step.
105103
run: |
106-
python - <<'PY'
107-
import os
108-
from huggingface_hub import upload_folder
109-
110-
upload_folder(
111-
repo_id="acme/awesome-model",
112-
folder_path="./checkpoint",
113-
commit_message=f"Publish from {os.environ['GITHUB_SHA'][:7]}",
114-
)
115-
PY
104+
hf upload acme/awesome-model ./checkpoint . \
105+
--commit-message "Publish from ${GITHUB_SHA::7}"
116106
```
117107
118108
That's it — `huggingface_hub` picks up `HF_TOKEN` from the environment.

0 commit comments

Comments
 (0)